<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Intersection coordinates exported to Excel using vba in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/intersection-coordinates-exported-to-excel-using-vba/m-p/10624634#M3067</link>
    <description>&lt;P&gt;Dears,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have some background with VBA for Excel, but almost zero with VBA for AutoCAD.&lt;/P&gt;&lt;P&gt;Is it possible using VBA for Excel to extract a list of intersection points of a opened CAD file?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="intersection.jpg" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/965612i659C7EE80CFCC93A/image-size/large?v=v2&amp;amp;px=999" role="button" title="intersection.jpg" alt="intersection.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 15 Sep 2021 15:43:14 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2021-09-15T15:43:14Z</dc:date>
    <item>
      <title>Intersection coordinates exported to Excel using vba</title>
      <link>https://forums.autodesk.com/t5/vba-forum/intersection-coordinates-exported-to-excel-using-vba/m-p/10624634#M3067</link>
      <description>&lt;P&gt;Dears,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have some background with VBA for Excel, but almost zero with VBA for AutoCAD.&lt;/P&gt;&lt;P&gt;Is it possible using VBA for Excel to extract a list of intersection points of a opened CAD file?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="intersection.jpg" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/965612i659C7EE80CFCC93A/image-size/large?v=v2&amp;amp;px=999" role="button" title="intersection.jpg" alt="intersection.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Sep 2021 15:43:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/intersection-coordinates-exported-to-excel-using-vba/m-p/10624634#M3067</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-09-15T15:43:14Z</dc:date>
    </item>
    <item>
      <title>Re: Intersection coordinates exported to Excel using vba</title>
      <link>https://forums.autodesk.com/t5/vba-forum/intersection-coordinates-exported-to-excel-using-vba/m-p/10624915#M3068</link>
      <description>Hi,&lt;BR /&gt;If I understood well you want to develope a macro inside Autocad for&lt;BR /&gt;exporting intersection points, to Excel?&lt;BR /&gt;But from what I know in order to check if two objects are intersecting you&lt;BR /&gt;have to select the first, then the second one, both selection could be&lt;BR /&gt;made by VBA, and apply a function always by VBA with thecsame procedure,&lt;BR /&gt;which check if the two objects are intersecting, if yes the function return&lt;BR /&gt;an array with 3 points coordinates, if not function will return a different&lt;BR /&gt;value.&lt;BR /&gt;I don't know how it's possibile apply to all objects in the drawing in the&lt;BR /&gt;same time.&lt;BR /&gt;</description>
      <pubDate>Wed, 15 Sep 2021 17:02:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/intersection-coordinates-exported-to-excel-using-vba/m-p/10624915#M3068</guid>
      <dc:creator>grobnik</dc:creator>
      <dc:date>2021-09-15T17:02:23Z</dc:date>
    </item>
    <item>
      <title>Re: Intersection coordinates exported to Excel using vba</title>
      <link>https://forums.autodesk.com/t5/vba-forum/intersection-coordinates-exported-to-excel-using-vba/m-p/10625037#M3069</link>
      <description>&lt;P&gt;Here below an example without the Excel Export side, but only msgbox with intersection points&lt;/P&gt;&lt;P&gt;If you select as first object the rectangle and as second object the intersecting line you will get 2 coordinates points inside the array&amp;nbsp;intPoints variable (total 6 value X,Y,Z first intersection point, and X,Y,Z second intersection point).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Sub test_of_intersection()
Dim Object_First As AcadObject
Dim Object_Second As AcadObject
Dim BasePnt1 As Variant
Dim BasePnt2 As Variant
ThisDrawing.Utility.GetEntity Object_First, BasePnt1, "Select First object"
ThisDrawing.Utility.GetEntity Object_Second, BasePnt2, "Select Second object"
' Find the intersection points between the line and the rectangle
    Dim intPoints As Variant
    intPoints = Object_First.IntersectWith(Object_Second, acExtendNone)

    ' Print all the intersection points
    Dim I As Integer, j As Integer, k As Integer
    Dim str As String
    If VarType(intPoints) &amp;lt;&amp;gt; vbEmpty Then
        For I = LBound(intPoints) To UBound(intPoints)
            str = "Intersection Point[" &amp;amp; k &amp;amp; "] is: " &amp;amp; intPoints(j) &amp;amp; " , " &amp;amp; intPoints(j + 1) &amp;amp; " , " &amp;amp; intPoints(j + 2)
            MsgBox str, , "IntersectWith Example"
            str = ""
            I = I + 2
            j = j + 3
            k = k + 1
        Next
    End If
End Sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Later I'll show you a code for exporting into Excel&lt;/P&gt;</description>
      <pubDate>Wed, 15 Sep 2021 17:54:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/intersection-coordinates-exported-to-excel-using-vba/m-p/10625037#M3069</guid>
      <dc:creator>grobnik</dc:creator>
      <dc:date>2021-09-15T17:54:20Z</dc:date>
    </item>
    <item>
      <title>Re: Intersection coordinates exported to Excel using vba</title>
      <link>https://forums.autodesk.com/t5/vba-forum/intersection-coordinates-exported-to-excel-using-vba/m-p/10625078#M3070</link>
      <description>&lt;P&gt;Thank you for yout&amp;nbsp; attention, I got to find an answer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Option Explicit&lt;BR /&gt;Sub findIntersect()&lt;BR /&gt;Dim acadApp As AcadApplication&lt;BR /&gt;Dim acadDoc As AcadDocument&lt;BR /&gt;Dim acObject As AcadObject&lt;BR /&gt;Dim lineObj1, lineObj2 As AcadLine&lt;BR /&gt;Dim intPoints As Variant&lt;BR /&gt;Dim objss, ssetObj As AcadSelectionSet&lt;BR /&gt;Dim n, i, x, Lline As Integer&lt;BR /&gt;Dim intersection As Variant&lt;BR /&gt;Dim location(0 To 2) As Double&lt;BR /&gt;&lt;BR /&gt;'get access to autocad application&lt;BR /&gt;Set acadApp = GetObject(, "AutoCAD.Application")&lt;BR /&gt;Set acadDoc = acadApp.ActiveDocument&lt;BR /&gt;&lt;BR /&gt;On Error Resume Next&lt;BR /&gt;'try to create a new selectionset&lt;BR /&gt;'if it exists, delete it and recreate a new one&lt;BR /&gt;Set objss = acadDoc.SelectionSets("sset")&lt;BR /&gt;If Err Then Set objss = acadDoc.SelectionSets.Add("sset")&lt;BR /&gt;'if it exists, erase it's content&lt;BR /&gt;objss.Clear&lt;BR /&gt;&lt;BR /&gt;Set objss = acadDoc.SelectionSets.Add("sset")&lt;BR /&gt;objss.Select acSelectionSetAll&lt;BR /&gt;x = objss.Count&lt;BR /&gt;Lline = 3&lt;BR /&gt;For i = 0 To x - 1&lt;BR /&gt;Set lineObj1 = objss.Item(i)&lt;BR /&gt;For n = i + 1 To x - 1&lt;BR /&gt;Set lineObj2 = objss.Item(n)&lt;BR /&gt;intersection = lineObj1.IntersectWith(lineObj2, acExtendNone)&lt;BR /&gt;location(0) = intersection(0): location(1) = intersection(1): location(2) = 0&lt;BR /&gt;If UBound(intersection) = 2 Then&lt;BR /&gt;Range("Xcoord").Cells(Lline, 1) = intersection(0)&lt;BR /&gt;Range("Ycoord").Cells(Lline, 1) = intersection(1)&lt;BR /&gt;Lline = Lline + 1&lt;BR /&gt;End If&lt;BR /&gt;Next&lt;BR /&gt;Next&lt;BR /&gt;End Sub&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Imagem1.jpg" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/965693iDE60240451C8BFC2/image-size/large?v=v2&amp;amp;px=999" role="button" title="Imagem1.jpg" alt="Imagem1.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Sep 2021 18:10:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/intersection-coordinates-exported-to-excel-using-vba/m-p/10625078#M3070</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-09-15T18:10:34Z</dc:date>
    </item>
    <item>
      <title>Re: Intersection coordinates exported to Excel using vba</title>
      <link>https://forums.autodesk.com/t5/vba-forum/intersection-coordinates-exported-to-excel-using-vba/m-p/12972300#M3071</link>
      <description>did you ever show the code for exporting into excel?</description>
      <pubDate>Wed, 21 Aug 2024 13:24:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/intersection-coordinates-exported-to-excel-using-vba/m-p/12972300#M3071</guid>
      <dc:creator>info9ATN7</dc:creator>
      <dc:date>2024-08-21T13:24:30Z</dc:date>
    </item>
    <item>
      <title>Re: Intersection coordinates exported to Excel using vba</title>
      <link>https://forums.autodesk.com/t5/vba-forum/intersection-coordinates-exported-to-excel-using-vba/m-p/12972303#M3072</link>
      <description>oops&lt;BR /&gt;</description>
      <pubDate>Wed, 21 Aug 2024 13:25:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/intersection-coordinates-exported-to-excel-using-vba/m-p/12972303#M3072</guid>
      <dc:creator>info9ATN7</dc:creator>
      <dc:date>2024-08-21T13:25:41Z</dc:date>
    </item>
    <item>
      <title>Re: Intersection coordinates exported to Excel using vba</title>
      <link>https://forums.autodesk.com/t5/vba-forum/intersection-coordinates-exported-to-excel-using-vba/m-p/12974887#M3073</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/12331182"&gt;@info9ATN7&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi, if you look at code posted by&amp;nbsp;&lt;SPAN&gt;Anonymous on last "&lt;SPAN class=""&gt;09-15-2021&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN class=""&gt;08:10 PM", such code shall be &lt;U&gt;&lt;STRONG&gt;written into Excel VBA Module&lt;/STRONG&gt;&lt;/U&gt;, in addition two names like "Xcoord" and "Ycoord" both at least by 3 rows and 1 column shall be&amp;nbsp;defined, inside Excel workbook.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="grobnik_0-1724332578364.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1400932i76069003EFD79E4E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="grobnik_0-1724332578364.png" alt="grobnik_0-1724332578364.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;On Autocad side (see below image as test) two oblique lines, intersecting a vertical one, like picture below just to test the intersection.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="grobnik_1-1724332705962.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1400937i1616A9A29FB22FFD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="grobnik_1-1724332705962.png" alt="grobnik_1-1724332705962.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Finally you will achieve your goal of get the intersection coordinates, after running the Excel procedure.&lt;/P&gt;&lt;P&gt;As suggestion replace this part of code, sometimes Excel require the Workbook, and sheet where cells shall be filled with results value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;ActiveWorkbook.Sheets("Foglio1").Range("Xcoord").Cells(Lline, 1) = intersection(0)
ActiveWorkbook.Sheets("Foglio1").Range("Ycoord").Cells(Lline, 1) = intersection(1)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;instead&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Range("Xcoord").Cells(Lline, 1) = intersection(0)
Range("Ycoord").Cells(Lline, 1) = intersection(1)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm sorry for Italian Excel Version with sheet name "Foglio1", but of course it's referenced to the Name of Sheet where the intersection coordinates shall be indicated.&lt;/P&gt;&lt;P&gt;Bye&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Aug 2024 17:17:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/intersection-coordinates-exported-to-excel-using-vba/m-p/12974887#M3073</guid>
      <dc:creator>grobnik</dc:creator>
      <dc:date>2024-08-22T17:17:38Z</dc:date>
    </item>
  </channel>
</rss>

