用下面的方法可以选择端点在已知点的直线,剩下的问题应该不难了吧
Sub tt() Dim ss As AcadSelectionSet Set ss = GetSel Dim ft(4) As Integer, fd(4) ft(0) = 0: fd(0) = "Line" ft(1) = -4: fd(1) = "<or" ft(2) = 10: fd(2) = CreatePoint(0, 0, 0) ft(3) = 11: fd(3) = CreatePoint(0, 0, 0) ft(4) = -4: fd(4) = "or>" ss.Select acSelectionSetAll, , , ft, fd MsgBox ss.Count End Sub
Function GetSel(Optional ByVal Name As String = "TlsTest") As AcadSelectionSet On Error Resume Next ThisDrawing.SelectionSets(Name).Delete Set GetSel = ThisDrawing.SelectionSets.Add(Name) End Function
Function CreatePoint(Optional ByVal X As Double = 0#, Optional ByVal Y As Double = 0#, Optional ByVal Z As Double = 0#) Dim pnt(2) As Double pnt(0) = X: pnt(1) = Y: pnt(2) = Z CreatePoint = pnt End Function
|