算法讨论
<P>如题,对于一段任意曲线,如何能得到从起点开始,每隔一定距离的点的坐标?</P><P>或者其中一个特例,全部是直线的曲线,每隔一定距离的点的坐标。</P>
<P>大家有什么思路,请提示一下,谢谢。</P> <P>在VisualLISP中有专门的函数,在VBA中实现很困难</P> 可惜我不会lisp,只能用vba。 Sub Measure()
Dim Ent As AcadEntity
Dim Pnt As Variant
ThisDrawing.Utility.GetEntity Ent, Pnt, vbCr & "请选择要按距离取点的曲线:"
Ent.Highlight True
Dim Dis As Double
Dis = ThisDrawing.Utility.GetDistance(, vbCr & "选择长度:")
Dim Cnt As Long
Cnt = ThisDrawing.ModelSpace.Count
ThisDrawing.SendCommand "measure" & vbCr & _
GetDoubleEntTable(Ent, Pnt) & vbCr & Dis & vbCr
Dim i As Long
Dim Point As AcadPoint
Dim PntPos As Variant
For i = ThisDrawing.ModelSpace.Count - 1 To Cnt Step -1
If ThisDrawing.ModelSpace(i).ObjectName = "AcDbPoint" Then
Debug.Print ThisDrawing.ModelSpace(i).ObjectName
Set Point = ThisDrawing.ModelSpace(i)
PntPos = Point.Coordinates
Debug.Print PntPos(0) & "" & PntPos(1)
Point.Delete
End If
Next
End Sub
'转换双元表的函数
Public Function GetDoubleEntTable(entObj As AcadEntity, Pnt As Variant) As String
Dim entHandle As String
entHandle = entObj.Handle
GetDoubleEntTable = "(list(handent " & Chr(34) & entHandle & Chr(34) & _
")(list " & Str(Pnt(0)) & Str(Pnt(1)) & Str(Pnt(2)) & "))"
End Function
请教Mccad
请教Mccad,如何取得样条曲线上各节点的坐标?用vla-<FONT size=3>get-ControlPoints </FONT>Object函数只能取得样条曲线上的控制点坐标.
页:
[1]