<?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 Re: Using the objects in SelectionSet in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/using-the-objects-in-selectionset/m-p/9505913#M4653</link>
    <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7947020"&gt;@sunchuanpu&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi, I'm not a professional programmer of VBA, all what I know I learned myself looking and participating to forums like this.&lt;/P&gt;&lt;P&gt;I'll try to explain how selectionset works with some code, and side explanation.&lt;/P&gt;&lt;P&gt;First of all you have to keep in mind how the selection set is searching the objects, it's based upon the same code used when you export a dwg in dxf format, there are two arrays which are determining the type of object or sometime logical function, or directly a string.&lt;/P&gt;&lt;P&gt;Here a link to help web page where you can find the code&amp;nbsp;&lt;A href="http://help.autodesk.com/view/" target="_blank" rel="noopener"&gt;http://help.autodesk.com/view/&lt;/A&gt;OARX/2018/ENU/?guid=GUID-2553CF98-44F6-4828-82DD-FE3BC7448113&lt;/P&gt;&lt;P&gt;Here an example of code:&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;Sub selectLine()
   Dim sset As AcadSelectionSet
   Set sset = ThisDrawing.SelectionSets.Add("TestSet2")
   Dim filterType As Variant
   Dim filterData As Variant
   Dim p1(0 To 2) As Double
   Dim p2(0 To 2) As Double
  
   Dim grpCode(0) As Integer
   grpCode(0) = 2
   filterType = grpCode
   Dim grpValue(0) As Variant
   grpValue(0) = "Line"
   filterData = grpValue
   sset.Select acSelectionSetAll, p1, p2, filterType, filterData
   Debug.Print "Entities: " &amp;amp; str(sset.count)
   
For Each ObjectLine in sset
    If type of ObjectLine is AcadLine then
       Debug.print ObjectLine.Endpoint(0), ObjectLine.Endpoint(1)
    End if
Next
sset.Delete
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;All Objects found by Selection Set will be stored in sset variable, and inside Item(x) you can find each object with own properties. Use debug to see all properties, count, and so on.&lt;/P&gt;&lt;P&gt;Above I have inserted P1, and P2 that could be used if a selection window shall be used, on the opposite you can use ", ," instead P1 and P2.&lt;/P&gt;&lt;P&gt;Above code shall be tested, I can't, because actually I'm working with another machine without Autocad installed.&lt;/P&gt;&lt;P&gt;I'll check within today, however it should work fine.&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;</description>
    <pubDate>Mon, 11 May 2020 06:43:37 GMT</pubDate>
    <dc:creator>grobnik</dc:creator>
    <dc:date>2020-05-11T06:43:37Z</dc:date>
    <item>
      <title>Using the objects in SelectionSet</title>
      <link>https://forums.autodesk.com/t5/vba-forum/using-the-objects-in-selectionset/m-p/9505733#M4652</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I apologize if this is a noob question. I have been looking for this on the internet for a while but what I found was all about creating, adding items, etc., none of them gave any examples over my problem, so I decided to ask here.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I have a SelectionSet containing Objects, how do I use those Objects? For instance, if I have a SelectionSet which already contains multiple lines, is it possible to use things like "line.Endpoint" to get information of specific line, or pass a specific line as "AcadLine" into a Function?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much.&lt;/P&gt;</description>
      <pubDate>Mon, 11 May 2020 03:11:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/using-the-objects-in-selectionset/m-p/9505733#M4652</guid>
      <dc:creator>sunchuanpu</dc:creator>
      <dc:date>2020-05-11T03:11:58Z</dc:date>
    </item>
    <item>
      <title>Re: Using the objects in SelectionSet</title>
      <link>https://forums.autodesk.com/t5/vba-forum/using-the-objects-in-selectionset/m-p/9505913#M4653</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7947020"&gt;@sunchuanpu&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi, I'm not a professional programmer of VBA, all what I know I learned myself looking and participating to forums like this.&lt;/P&gt;&lt;P&gt;I'll try to explain how selectionset works with some code, and side explanation.&lt;/P&gt;&lt;P&gt;First of all you have to keep in mind how the selection set is searching the objects, it's based upon the same code used when you export a dwg in dxf format, there are two arrays which are determining the type of object or sometime logical function, or directly a string.&lt;/P&gt;&lt;P&gt;Here a link to help web page where you can find the code&amp;nbsp;&lt;A href="http://help.autodesk.com/view/" target="_blank" rel="noopener"&gt;http://help.autodesk.com/view/&lt;/A&gt;OARX/2018/ENU/?guid=GUID-2553CF98-44F6-4828-82DD-FE3BC7448113&lt;/P&gt;&lt;P&gt;Here an example of code:&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;Sub selectLine()
   Dim sset As AcadSelectionSet
   Set sset = ThisDrawing.SelectionSets.Add("TestSet2")
   Dim filterType As Variant
   Dim filterData As Variant
   Dim p1(0 To 2) As Double
   Dim p2(0 To 2) As Double
  
   Dim grpCode(0) As Integer
   grpCode(0) = 2
   filterType = grpCode
   Dim grpValue(0) As Variant
   grpValue(0) = "Line"
   filterData = grpValue
   sset.Select acSelectionSetAll, p1, p2, filterType, filterData
   Debug.Print "Entities: " &amp;amp; str(sset.count)
   
For Each ObjectLine in sset
    If type of ObjectLine is AcadLine then
       Debug.print ObjectLine.Endpoint(0), ObjectLine.Endpoint(1)
    End if
Next
sset.Delete
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;All Objects found by Selection Set will be stored in sset variable, and inside Item(x) you can find each object with own properties. Use debug to see all properties, count, and so on.&lt;/P&gt;&lt;P&gt;Above I have inserted P1, and P2 that could be used if a selection window shall be used, on the opposite you can use ", ," instead P1 and P2.&lt;/P&gt;&lt;P&gt;Above code shall be tested, I can't, because actually I'm working with another machine without Autocad installed.&lt;/P&gt;&lt;P&gt;I'll check within today, however it should work fine.&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Mon, 11 May 2020 06:43:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/using-the-objects-in-selectionset/m-p/9505913#M4653</guid>
      <dc:creator>grobnik</dc:creator>
      <dc:date>2020-05-11T06:43:37Z</dc:date>
    </item>
    <item>
      <title>Re: Using the objects in SelectionSet</title>
      <link>https://forums.autodesk.com/t5/vba-forum/using-the-objects-in-selectionset/m-p/9506003#M4654</link>
      <description>&lt;P&gt;Thank you so much for your code and explanation! I didn't actually test your code, but by looking at it, now I understand how to use the SelectionSet.&lt;/P&gt;</description>
      <pubDate>Mon, 11 May 2020 07:42:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/using-the-objects-in-selectionset/m-p/9506003#M4654</guid>
      <dc:creator>sunchuanpu</dc:creator>
      <dc:date>2020-05-11T07:42:12Z</dc:date>
    </item>
    <item>
      <title>Re: Using the objects in SelectionSet</title>
      <link>https://forums.autodesk.com/t5/vba-forum/using-the-objects-in-selectionset/m-p/9506055#M4655</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7947020"&gt;@sunchuanpu&lt;/a&gt;&amp;nbsp;Thank you,&lt;/P&gt;&lt;P&gt;just a note about the two arrays&amp;nbsp;&lt;SPAN style="font-family: inherit;"&gt;filter variables:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;into above code I have indicated just 1 row in the arrays, but you can insert logical function like "AND", "OR",&amp;nbsp; or for example block names "Block1,Block2", increasing both the array size, each group code shall be followed by a group value. The only issue concern the error, because, based upon my experience, if you made a mistake selecting the proper group code and/or value the selection set return you no errors but only count 0 (zero). So I suggest to check every time the selection set count that shall be " &lt;FONT color="#FF0000"&gt;SelectionSet Name&lt;/FONT&gt;.count &amp;gt;0 ".&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;</description>
      <pubDate>Mon, 11 May 2020 08:22:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/using-the-objects-in-selectionset/m-p/9506055#M4655</guid>
      <dc:creator>grobnik</dc:creator>
      <dc:date>2020-05-11T08:22:52Z</dc:date>
    </item>
  </channel>
</rss>

