乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 41|回复: 1

请问如何用VBA获取样条曲线的拟合点个数

[复制链接]

3

主题

4

帖子

1

银币

初来乍到

Rank: 1

铜币
16
发表于 2012-7-5 21:15:00 | 显示全部楼层 |阅读模式
下面是从屏幕上拾取一条样条曲线并显示其有多少个拟合点的代码片段:
  1. dim splineObj as AcadEntity
  2. dim pickedPoint as Variant
  3. ThisDrawing.Utility.GetEntity splineObj,pickedPoint
  4. Msgbox "The selected spline has "&splineObj.NumberofFitPoints&" fitpoints"

但是运行时老是提示“类型不匹配”,请问是什么原因?请知道的朋友指导一下,非常感谢!
回复

使用道具 举报

14

主题

180

帖子

12

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
236
发表于 2012-7-6 09:41:00 | 显示全部楼层
帮助里有这个例子
Sub Example_NumberOfFitPoints()
    ' This example creates a spline object in model space.
    ' It then finds the number of control points for that spline.
    ' Create the spline
    Dim splineObj As AcadSpline
    Dim startTan(0 To 2) As Double
    Dim endTan(0 To 2) As Double
    Dim fitPoints(0 To 8) As Double
   
    startTan(0) = 0.5: startTan(1) = 0.5: startTan(2) = 0
    endTan(0) = 0.5: endTan(1) = 0.5: endTan(2) = 0
    fitPoints(0) = 1: fitPoints(1) = 1: fitPoints(2) = 0
    fitPoints(3) = 5: fitPoints(4) = 5: fitPoints(5) = 0
    fitPoints(6) = 10: fitPoints(7) = 0: fitPoints(8) = 0
    Set splineObj = ThisDrawing.ModelSpace.AddSpline(fitPoints, startTan, endTan)
    ZoomAll
   
    MsgBox "The Spline has " & splineObj.NumberOfFitPoints & " fit points.", , "NumberOfFitPoints Example"
End Sub
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-6-30 05:13 , Processed in 2.056662 second(s), 56 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表