明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1299|回复: 1

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

[复制链接]
发表于 2012-7-5 21:15:53 | 显示全部楼层 |阅读模式
下面是从屏幕上拾取一条样条曲线并显示其有多少个拟合点的代码片段:

  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"

但是运行时老是提示“类型不匹配”,请问是什么原因?请知道的朋友指导一下,非常感谢!
发表于 2012-7-6 09:41:10 | 显示全部楼层
帮助里有这个例子
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
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-25 16:57 , Processed in 0.173474 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表