谢谢,帮我看看这个程序红色部分是什么意思?另外,我怎么判断哪个数字标注属于哪条线的呢?
程序目的:将3D多段线转换为2D多段线; 程序思路:创建选择集,然后遍历,提取3D多段线的X,Y,然后画2D多段线,再删除3D多段线。 Sub test3Dto2D() 创建选择集 Dim selset As AcadSelectionSet Dim cor3 As Variant Dim n As Integer Dim a As Integer a = 0 Set selset = ThisDrawing.SelectionSets.Add("sset") selset.Select acSelectionSetAll
遍历选择集并将每一个对象镜相 Dim entry As AcadObject Dim pl As AcadLWPolyline
For Each entry In selset If entry.EntityName = "AcDb3dPolyline" Then cor3 = entry.Coordinates n = (UBound(cor3) + 1) * 2 / 3 Dim pt() As Double ReDim pt(0 To n - 1) As Double
For i = 0 To (n - 2) Step 2 pt(i) = cor3(a) pt(i + 1) = cor3(a + 1) a = a + 3 Next i
Set pl = ThisDrawing.ModelSpace.AddLightWeightPolyline(pt) 继承特性 pl.Layer = entry.Layer pl.color = entry.color entry.Delete a = 0 End If Next entry
selset.Delete 避免下次重复