再次请教"谁有vba的返回多义线所点击子段的端点坐标程序"
谁有vba的返回多义线所点击子段的端点坐标程序斑竹的是vlisp的,
谁有vba的返回多义线所点击子段的端点坐标程序 ,共享学习以下,谢谢了
多义线的Coordinates属性直接可以得到啊!
帮助中的例子-
Sub Example_Coordinates()
' This example creates a polyline. It then uses the Coordinates
' property to return all the coordinatesin the polyline. It then
' resets one of the vertices using the Coordinates property.
Dim plineObj As AcadPolyline ' Create Polyline
Dim points(5) As Double
points(0) = 3: points(1) = 7: points(2) = 0
points(3) = 9: points(4) = 2: points(5) = 0
Set plineObj = ThisDrawing.ModelSpace.AddPolyline(points)
ThisDrawing.Regen True ' Return all the coordinates of the polyline
Dim retCoord As Variant
retCoord = plineObj.Coordinates ' Display current coordinates for the first vertex
MsgBox "The current coordinates of the second vertex are: " & points(3) & ", " & points(4) & ", " & points(5), vbInformation, "Coordinates Example" ' Modify the coordinate of the second vertex to (5,5,0). Note that in
' case of a lightweight Polyline, indices will be different because the points are 2D only.
points(3) = 5
points(4) = 5
points(5) = 0
plineObj.Coordinates = points ' Update display
ThisDrawing.Regen True MsgBox "The new coordinates have been set to " & points(3) & ", " & points(4) & ", " & points(5), vbInformation, "Coordinates Example"
End Sub 谢谢斑竹,我的意思是多段线的有多个"子段",使用鼠标点击其中的一个"子段",使用vba编程显示此"子段"的两对坐标
关键是如何获得选中的子段,我是这样处理的:
1,炸开选中的多段线,获得子段集合
2,获得子段集合与选择点距离最近及选择点与子段两端点夹角最大的即是
你可以用对象捕捉的方式捕捉到实体上的点,看它在哪两个点之间。在同一直线上的三个点必然有两个点距离之和等与另两个点的距离,要是不在一直线上呢,就是距离不等了啊
就这就可以判断出在哪两点之间。要再不懂的话我给你发段源代码
谢谢了,楼上的
页:
[1]