<?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: No 'SelectionSets' in VB.net in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/no-selectionsets-in-vb-net/m-p/3701130#M52488</link>
    <description>&lt;P&gt;Obviusly, I don't know the difference between VB and VBA. That;s the reason I came here and asked the question.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But my original quesry remains: How can I access the SelectionSets collection (or its equivalent) in VB.Net.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I create 2 selection sets ss1 and ss2, then how do I access one of these like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ThisDrawing.SelectionSets("SS1")&lt;/P&gt;</description>
    <pubDate>Thu, 15 Nov 2012 21:18:23 GMT</pubDate>
    <dc:creator>NirantarVidyarthee</dc:creator>
    <dc:date>2012-11-15T21:18:23Z</dc:date>
    <item>
      <title>No 'SelectionSets' in VB.net</title>
      <link>https://forums.autodesk.com/t5/net-forum/no-selectionsets-in-vb-net/m-p/3700918#M52485</link>
      <description>&lt;P&gt;From the AutoDESK help docs (&lt;A href="http://docs.autodesk.com/ACD/2013/ENU/index.html?url=files/GUID-D0BD4249-1122-4209-ABEA-6F19FA156F91.htm,topicNumber=d30e719293" target="_blank"&gt;http://docs.autodesk.com/ACD/2013/EN...ber=d30e719293&lt;/A&gt;)&lt;/P&gt;&lt;DIV class="content"&gt;&lt;DIV&gt;&lt;BLOCKQUOTE&gt;&lt;BR /&gt;"AutoCAD.Application.ActiveDocument.SelectionSets. Add method&lt;BR /&gt;Not needed/provided" in VB.Net&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thus 'Autodesk.AutoCAD.ApplicationServices.Application. DocumentManager.MdiActiveDocument.SelectionSets' will not work.&lt;BR /&gt;&lt;BR /&gt;So, I can't store multiple selection sets in VB.Net?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Why is it not provided? Or is there some other way to do that?&lt;/BLOCKQUOTE&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 15 Nov 2012 19:11:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/no-selectionsets-in-vb-net/m-p/3700918#M52485</guid>
      <dc:creator>NirantarVidyarthee</dc:creator>
      <dc:date>2012-11-15T19:11:25Z</dc:date>
    </item>
    <item>
      <title>Re: No 'SelectionSets' in VB.net</title>
      <link>https://forums.autodesk.com/t5/net-forum/no-selectionsets-in-vb-net/m-p/3701030#M52486</link>
      <description>&lt;P&gt;It seems you do not know the difference of programming language (VB.NET/C#...) and AutoCAD APIs (COM API/.NET API).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;AutoCAD.Application.ActiveDocument.SelectionSets. Add() still exists in COM API and can be used when needed. With AutoCAD .NET programming (VB.NET/C#), AutoCAD .NET API usually provides enough functionlities, but you can easily mix COM API calls in it (in many cases it is not necesary, as you quoted!).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, what do you do that you have to use "AutoCAD.Application.ActiveDocument.SelectionSets. Add()", instead of various selecting methods provided in .NET API?&lt;/P&gt;</description>
      <pubDate>Thu, 15 Nov 2012 20:10:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/no-selectionsets-in-vb-net/m-p/3701030#M52486</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2012-11-15T20:10:58Z</dc:date>
    </item>
    <item>
      <title>Re: No 'SelectionSets' in VB.net</title>
      <link>https://forums.autodesk.com/t5/net-forum/no-selectionsets-in-vb-net/m-p/3701098#M52487</link>
      <description>&lt;P&gt;&lt;FONT color="#000000" size="1" face="arial,helvetica,sans-serif"&gt;SelectionSet object is member of&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000" size="1" face="arial,helvetica,sans-serif"&gt;Autodesk.AutoCAD.EditorInput namespace&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Nov 2012 21:00:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/no-selectionsets-in-vb-net/m-p/3701098#M52487</guid>
      <dc:creator>Hallex</dc:creator>
      <dc:date>2012-11-15T21:00:52Z</dc:date>
    </item>
    <item>
      <title>Re: No 'SelectionSets' in VB.net</title>
      <link>https://forums.autodesk.com/t5/net-forum/no-selectionsets-in-vb-net/m-p/3701130#M52488</link>
      <description>&lt;P&gt;Obviusly, I don't know the difference between VB and VBA. That;s the reason I came here and asked the question.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But my original quesry remains: How can I access the SelectionSets collection (or its equivalent) in VB.Net.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I create 2 selection sets ss1 and ss2, then how do I access one of these like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ThisDrawing.SelectionSets("SS1")&lt;/P&gt;</description>
      <pubDate>Thu, 15 Nov 2012 21:18:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/no-selectionsets-in-vb-net/m-p/3701130#M52488</guid>
      <dc:creator>NirantarVidyarthee</dc:creator>
      <dc:date>2012-11-15T21:18:23Z</dc:date>
    </item>
    <item>
      <title>Re: No 'SelectionSets' in VB.net</title>
      <link>https://forums.autodesk.com/t5/net-forum/no-selectionsets-in-vb-net/m-p/3701456#M52489</link>
      <description>&lt;P&gt;Show your Sub code to see what you started wth,&lt;/P&gt;&lt;P&gt;guess you want to use Interop library?&lt;/P&gt;</description>
      <pubDate>Fri, 16 Nov 2012 07:30:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/no-selectionsets-in-vb-net/m-p/3701456#M52489</guid>
      <dc:creator>Hallex</dc:creator>
      <dc:date>2012-11-16T07:30:49Z</dc:date>
    </item>
    <item>
      <title>"Re: No 'SelectionSets' in VB.net</title>
      <link>https://forums.autodesk.com/t5/net-forum/no-selectionsets-in-vb-net/m-p/3701630#M52490</link>
      <description>&lt;P&gt;"If I create 2 selection sets ss1 and ss2, then how do I access one of these like:&lt;/P&gt;&lt;P&gt;ThisDrawing.SelectionSets("SS1")&lt;/P&gt;</description>
      <pubDate>Fri, 16 Nov 2012 12:00:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/no-selectionsets-in-vb-net/m-p/3701630#M52490</guid>
      <dc:creator>NirantarVidyarthee</dc:creator>
      <dc:date>2012-11-16T12:00:13Z</dc:date>
    </item>
    <item>
      <title>Re: "Re: No 'SelectionSets' in VB.net</title>
      <link>https://forums.autodesk.com/t5/net-forum/no-selectionsets-in-vb-net/m-p/3701788#M52491</link>
      <description>&lt;P&gt;I didn't see your code, well, then try my attempt&lt;/P&gt;&lt;PRE&gt;    &amp;lt;CommandMethod("testAcadSelections")&amp;gt; _
    Public Shared Sub testSelections()
        '' borrowed from Luis Esquivel
        Dim AcadComApp As AcadApplication = Nothing
        Dim progId As String = "AutoCAD.Application.18" ''   &amp;lt;-- AutoCAD 2010

        Try
            ' Get a current instance of AutoCAD
            AcadComApp = TryCast(GetObject(, progId), AcadApplication)

        Catch ex As System.Exception
            Try
                ' Create a new instance of AutoCAD
                AcadComApp = TryCast(CreateObject(progId), AcadApplication)

            Catch exx As Exception
                MsgBox(exx.Message)
                Exit Sub
            End Try
        End Try

        Try
            ' Get the active document
            Dim AcadComDoc As AcadDocument = TryCast(AcadComApp.ActiveDocument, AcadDocument)
            ' Get AcadSelectionSets collection
            Dim AcadSets As AcadSelectionSets = TryCast(AcadComDoc.SelectionSets, AcadSelectionSets)
            ' Declare AcadSelectionSet
            Dim AcadSsetObj As AcadSelectionSet = Nothing
            ' Get a StringBuilder object
            Dim sb As StringBuilder = New StringBuilder
            ' Add some selections to document
            For i As Integer = 0 To 24
                Dim setName As String = "Selection" &amp;amp; (i + 1).ToString()
                AcadSsetObj = AcadSets.Add(setName)
                sb.AppendLine(AcadSsetObj.Name)
            Next

            MsgBox("Number of selections created: " &amp;amp; AcadSets.Count.ToString() &amp;amp; vbLf &amp;amp; sb.ToString())
            Dim layoutName As String = AcadComDoc.GetVariable("ctab").ToString()
            ' Get the very first selection
            AcadSsetObj = AcadSets.Item(0)
            ' Create filter to select attributed blocks on current layout
            Dim filterType(2) As Short
            filterType(0) = 0
            filterType(1) = 66
            filterType(2) = 410

            Dim filterData(2) As Object
            filterData(0) = "insert"
            filterData(1) = 1
            filterData(2) = layoutName
            ' Perform the Select method
            AcadSsetObj.Select(AcSelect.acSelectionSetAll, , , filterType, filterData)
            ' Display result
            MsgBox("First selection:" &amp;amp; vbLf &amp;amp; "Number of block selected: " &amp;amp; AcadSsetObj.Count.ToString())
        Catch aex As System.Exception
            MsgBox(aex.Message &amp;amp; vbLf &amp;amp; aex.StackTrace)
        Finally
            ' AcadComApp.Quit()
            AcadComApp = Nothing
        End Try
    End Sub&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;See for more&lt;/P&gt;&lt;P&gt;&lt;A href="http://through-the-interface.typepad.com/through_the_interface/2010/02/handling-com-calls-rejected-by-autocad-from-an-external-net-application.html" target="_blank"&gt;http://through-the-interface.typepad.com/through_the_interface/2010/02/handling-com-calls-rejected-by-autocad-from-an-external-net-application.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Nov 2012 13:41:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/no-selectionsets-in-vb-net/m-p/3701788#M52491</guid>
      <dc:creator>Hallex</dc:creator>
      <dc:date>2012-11-16T13:41:39Z</dc:date>
    </item>
    <item>
      <title>No 'SelectionSets' in VB.net</title>
      <link>https://forums.autodesk.com/t5/net-forum/no-selectionsets-in-vb-net/m-p/3702846#M52492</link>
      <description>&lt;P&gt;Thankyou but my question is not about how we can use COM API for getting SelectionSets collection. My question is why .NET API does not provide this and is there any other way in .NET API, other than probably creating my own collection.&lt;/P&gt;</description>
      <pubDate>Sat, 17 Nov 2012 06:43:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/no-selectionsets-in-vb-net/m-p/3702846#M52492</guid>
      <dc:creator>NirantarVidyarthee</dc:creator>
      <dc:date>2012-11-17T06:43:25Z</dc:date>
    </item>
    <item>
      <title>Re: No 'SelectionSets' in VB.net</title>
      <link>https://forums.autodesk.com/t5/net-forum/no-selectionsets-in-vb-net/m-p/3702852#M52493</link>
      <description>&lt;P&gt;My answer is in post#3 if you don't understand it&lt;/P&gt;&lt;P&gt;Type:&lt;/P&gt;&lt;P&gt;Autodesk.AutoCAD.EditorInput&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;in editor console,&lt;/P&gt;&lt;P&gt;then highlight it and select from right clicking mouse: Go to Definition,&lt;/P&gt;&lt;P&gt;then scroll down to&amp;nbsp;see Selection within object Browser&lt;/P&gt;&lt;P&gt;You can see so there is no SelectionSets collection in there&lt;/P&gt;&lt;P&gt;just only SelectionSet object only, and also read the docs for more&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 17 Nov 2012 07:19:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/no-selectionsets-in-vb-net/m-p/3702852#M52493</guid>
      <dc:creator>Hallex</dc:creator>
      <dc:date>2012-11-17T07:19:33Z</dc:date>
    </item>
    <item>
      <title>Re: No 'SelectionSets' in VB.net</title>
      <link>https://forums.autodesk.com/t5/net-forum/no-selectionsets-in-vb-net/m-p/3702856#M52494</link>
      <description>&lt;P&gt;" You can see so there is no SelectionSets collection in there&lt;/P&gt;&lt;P&gt;just only SelectionSet object only, and also read the docs for more."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I know this.And I stated this in my first post.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am asking why? What could be the logical reason behind not having the collection? And is using COM API the only alternative?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 17 Nov 2012 07:42:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/no-selectionsets-in-vb-net/m-p/3702856#M52494</guid>
      <dc:creator>NirantarVidyarthee</dc:creator>
      <dc:date>2012-11-17T07:42:43Z</dc:date>
    </item>
    <item>
      <title>Re: No 'SelectionSets' in VB.net</title>
      <link>https://forums.autodesk.com/t5/net-forum/no-selectionsets-in-vb-net/m-p/3702858#M52495</link>
      <description>&lt;P&gt;Simply use List (Of Selectionset) but you did not extend&lt;/P&gt;&lt;P&gt;the number of SelectionSet more than 255&lt;/P&gt;</description>
      <pubDate>Sat, 17 Nov 2012 08:26:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/no-selectionsets-in-vb-net/m-p/3702858#M52495</guid>
      <dc:creator>Hallex</dc:creator>
      <dc:date>2012-11-17T08:26:13Z</dc:date>
    </item>
    <item>
      <title>Re: No 'SelectionSets' in VB.net</title>
      <link>https://forums.autodesk.com/t5/net-forum/no-selectionsets-in-vb-net/m-p/3703702#M52496</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/589516"&gt;@NirantarVidyarthee&lt;/a&gt; wrote:&lt;BR /&gt;&lt;P&gt;Thankyou but my question is not about how we can use COM API for getting SelectionSets collection. My question is why .NET API does not provide this and is there any other way in .NET API, other than probably creating my own collection.&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;There is no need for a collection of SelectionSet in the .NET. &amp;nbsp;API.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SelectionSets are things you get friom calling editor methods to select objects, and after you get them and do what you need with the objects they contain, you discard them.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unlike ActiveX SelectionSets, managed SelectionSets are not re-usable. There is no Clear() method to empty them and there is no way to re-use them. Unlike ActiveX selection sets, managed selection sets do not have methods to select objects.The Editor class has those methods, and they return a new managed SelectionSet each time you call them, so there's really no point or purpose to having a collection of managed SelectionSets.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The ActiveX and managed APIs are not remotely similar, and I think that's the underlying problem here. You can't approach programming with the .NET API as if it were just a managed equivalent of the ActiveX API, because it is not. It is very different and more difficult to use, but more powerful at the same time.&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;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Nov 2012 08:08:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/no-selectionsets-in-vb-net/m-p/3703702#M52496</guid>
      <dc:creator>DiningPhilosopher</dc:creator>
      <dc:date>2012-11-19T08:08:11Z</dc:date>
    </item>
  </channel>
</rss>

