how get all intersection point

how get all intersection point

Anonymous
Not applicable
1,762 Views
3 Replies
Message 1 of 4

how get all intersection point

Anonymous
Not applicable
'i have code to draw circle to all intesection point but not all circle draw to intesection point
what wrong with mycode
Sub test() Dim ss As AcadSelectionSet Dim line As AcadLine, InterCord As Variant Dim cir As AcadCircle, Mtx As AcadMText, fd As Boolean, go As Boolean Set ss = ThisDrawing.SelectionSets.Add(Now) ss.SelectOnScreen For I = 0 To ss.Count - 1 If TypeOf ss.Item(I) Is AcadLine Then Set line = ss.Item(I) line.color = acMagenta line.Update For j = I + 1 To ss.Count - 1 Set line1 = ss.Item(j) line1.color = acRed line1.Update InterCord = line.IntersectWith(line1, acExtendNone) If UBound(InterCord) = 2 Then Debug.Print InterCord(0), InterCord(1), InterCord(2) Set cir = ThisDrawing.ModelSpace.AddCircle(InterCord, 0.2) ThisDrawing.Regen (acActiveViewport) fd = True Else Exit For End If Next j End If Next I End Sub
0 Likes
1,763 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable

Any body can help me ?

0 Likes
Message 3 of 4

Alfred.NESWADBA
Consultant
Consultant

Hi,

 

>> Any body can help me ?

Please add the dwg-file, we even don't know if you have real intersection points at the locations you are missing a circle.

 

Also please let us know which version of AutoCAD you are referring to (command _ABOUT and screenshot would be great).

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2026
------------------------------------------------------------------------------------

(not an Autodesk consultant)
0 Likes
Message 4 of 4

Mesut_Akcan
Collaborator
Collaborator

Please try the following code

Sub test()
Dim ss As AcadSelectionSet
Dim line As AcadLine, InterCord As Variant
Dim cir As AcadCircle, Mtx As AcadMText, fd As Boolean, go As Boolean
Set ss = ThisDrawing.SelectionSets.Add(Now)
ss.SelectOnScreen
    For i = 0 To ss.Count - 1
       If TypeOf ss.Item(i) Is AcadLine Then
              Set line = ss.Item(i)
              line.color = acMagenta
              line.Update
              For j = i + 1 To ss.Count - 1
                 Set line1 = ss.Item(j)
                 line1.color = acRed
                 line1.Update
                 InterCord = line.IntersectWith(line1, acExtendNone)
                 If UBound(InterCord) = 2 Then
                   Debug.Print InterCord(0), InterCord(1), InterCord(2)
                   Set cir = ThisDrawing.ModelSpace.AddCircle(InterCord, 0.2)
                   ThisDrawing.Regen (acActiveViewport)
                   fd = True
'                 Else
'                   Exit For
                 End If
              Next j
       End If
    Next i
End Sub

 

Mesut Akcan - Emekli Teknik Öğretmen
Blog Sayfam -- Youtube Kanalım -- LinkedIn
0 Likes