- 积分
- 738
- 明经币
- 个
- 注册时间
- 2004-11-5
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2004-11-22 01:30:00
|
显示全部楼层
辛苦啦,三楼的例子刚试过,很好用,谢谢明总.
不过还是没明白怎么用这个类模块.我想实现这样的功能,不知可以不可以.就是程序运行中不和用户交互,自动画出曲线,并给出曲线中的一个点坐标,最后显示出点坐标到曲线端的曲线长度.我把三楼的例子按照自己的理解改了一下,不过还是出错了,请帮忙修改一下吧.
Sub getDistAtPnt() '定义引用曲线类模块 Dim ObjCurve As Curve Set ObjCurve = New Curve '自动画出曲线 Dim splineObj As AcadSpline Dim noOfPoints As Integer 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) splineObj.Update '确定曲线上一点坐标 Dim ppt(0 To 2) As Double ppt(0) = 5 ppt(1) = 5 ppt(2) = 0 Set ObjCurve = spline0bj Dim Dist As Double Dist = ObjCurve.GetDistanceAtPoint(ppt) '显示曲线长度 MsgBox "曲线上一点到曲线起点的长度为" & vbCrLf & vbCrLf & Dist, , "明经通道VBA示例" '取消曲线的亮显 Ent.Highlight False '释放变量 Set ObjCurve = Nothing End Sub
错误提示为:要求对象 |
|