管板交点 Sub Example_IntersectWith() ' This example creates a line and circle and finds the points at ' which they intersect. Dim Object As AcadEntity, Object1 As AcadEntity Dim ii As Integer Dim ppt As Variant For ii = 0 To ThisDrawing.ModelSpace.Count - 1 On Error Resume Next Set Object = ThisDrawing.ModelSpace.Item(ii) If ii = ThisDrawing.ModelSpace.Count - 1 Then Set Object1 = ThisDrawing.ModelSpace.Item(0) Else Set Object1 = ThisDrawing.ModelSpace.Item(ii + 1) End If 'Debug.Print Object.Handle, Object1.Handle ppt = Object1.IntersectWith(Object, acExtendBoth) Debug.Print ii, ppt(0), ppt(1), ppt(2) Next ii End Sub |