<?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 Create SelectionSet VB.NET (filtered with conditions) in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/create-selectionset-vb-net-filtered-with-conditions/m-p/2641532#M66643</link>
    <description>I need to create some filtered SelectionSets.&lt;BR /&gt;
&lt;BR /&gt;
I converted this example as best as I am able for the filtering. Any comments on the conversion welcome.&lt;BR /&gt;
 http://through-the-interface.typepad.com/through_the_interface/2008/07/conditional-sel.html&lt;BR /&gt;
&lt;BR /&gt;
Another example I found showed how to create a SelectionSet but it then converts it to an ObjectIdCollection for use.&lt;BR /&gt;
Is there a difference betwen a SelectionSet and an ObjectIdCollection? They appear to be the same thing.&lt;BR /&gt;
&lt;BR /&gt;
    Public Sub SelectEntitiesWithProperties()&lt;BR /&gt;
        Dim doc As Document = Application.DocumentManager.MdiActiveDocument&lt;BR /&gt;
        Dim ed As Editor = doc.Editor&lt;BR /&gt;
        Dim ent As Entity&lt;BR /&gt;
        Dim ss As Autodesk.AutoCAD.EditorInput.SelectionSet&lt;BR /&gt;
        Dim oIDs As ObjectIdCollection&lt;BR /&gt;
        Dim filter(10) As TypedValue&lt;BR /&gt;
        Try&lt;BR /&gt;
            filter(0) = New TypedValue(DxfCode.Operator, "&lt;OR&gt;
            filter(1) = New TypedValue(DxfCode.Operator, "&lt;AND&gt;
            filter(2) = New TypedValue(DxfCode.LayerName, "0")&lt;BR /&gt;
            filter(3) = New TypedValue(DxfCode.Start, "LINE")&lt;BR /&gt;
            filter(4) = New TypedValue(DxfCode.Operator, "and&amp;gt;")&lt;BR /&gt;
            filter(5) = New TypedValue(DxfCode.Operator, "&lt;AND&gt;
            filter(6) = New TypedValue(DxfCode.Start, "CIRCLE")&lt;BR /&gt;
            filter(7) = New TypedValue(DxfCode.Operator, "&amp;gt;=")&lt;BR /&gt;
            filter(8) = New TypedValue(DxfCode.Real, 10)&lt;BR /&gt;
            filter(9) = New TypedValue(DxfCode.Operator, "and&amp;gt;")&lt;BR /&gt;
            filter(10) = New TypedValue(DxfCode.Operator, "or&amp;gt;")&lt;BR /&gt;
            Dim sf As SelectionFilter = New SelectionFilter(filter)&lt;BR /&gt;
            Dim psr As PromptSelectionResult = ed.SelectAll(sf)&lt;BR /&gt;
            ss = psr.Value&lt;BR /&gt;
            If ss.Count &amp;gt; 0 Then&lt;BR /&gt;
                oids = New ObjectIdCollection(ss.GetObjectIds)&lt;BR /&gt;
                For Each oid In oids&lt;BR /&gt;
                    ent = oid.GetObject(OpenMode.ForRead)&lt;BR /&gt;
                    If TypeOf ent Is BlockReference Then&lt;BR /&gt;
                        'br = CType(ent, BlockReference)&lt;BR /&gt;
                        'Debug.Print(br.Name)&lt;BR /&gt;
                    End If&lt;BR /&gt;
                Next&lt;BR /&gt;
            End If&lt;BR /&gt;
        Catch ex As System.Exception&lt;BR /&gt;
            MsgBox(ex.ToString)&lt;BR /&gt;
        End Try&lt;BR /&gt;
    End Sub&lt;/AND&gt;&lt;/AND&gt;&lt;/OR&gt;</description>
    <pubDate>Mon, 01 Mar 2010 20:34:15 GMT</pubDate>
    <dc:creator>sgrya1</dc:creator>
    <dc:date>2010-03-01T20:34:15Z</dc:date>
    <item>
      <title>Create SelectionSet VB.NET (filtered with conditions)</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-selectionset-vb-net-filtered-with-conditions/m-p/2641532#M66643</link>
      <description>I need to create some filtered SelectionSets.&lt;BR /&gt;
&lt;BR /&gt;
I converted this example as best as I am able for the filtering. Any comments on the conversion welcome.&lt;BR /&gt;
 http://through-the-interface.typepad.com/through_the_interface/2008/07/conditional-sel.html&lt;BR /&gt;
&lt;BR /&gt;
Another example I found showed how to create a SelectionSet but it then converts it to an ObjectIdCollection for use.&lt;BR /&gt;
Is there a difference betwen a SelectionSet and an ObjectIdCollection? They appear to be the same thing.&lt;BR /&gt;
&lt;BR /&gt;
    Public Sub SelectEntitiesWithProperties()&lt;BR /&gt;
        Dim doc As Document = Application.DocumentManager.MdiActiveDocument&lt;BR /&gt;
        Dim ed As Editor = doc.Editor&lt;BR /&gt;
        Dim ent As Entity&lt;BR /&gt;
        Dim ss As Autodesk.AutoCAD.EditorInput.SelectionSet&lt;BR /&gt;
        Dim oIDs As ObjectIdCollection&lt;BR /&gt;
        Dim filter(10) As TypedValue&lt;BR /&gt;
        Try&lt;BR /&gt;
            filter(0) = New TypedValue(DxfCode.Operator, "&lt;OR&gt;
            filter(1) = New TypedValue(DxfCode.Operator, "&lt;AND&gt;
            filter(2) = New TypedValue(DxfCode.LayerName, "0")&lt;BR /&gt;
            filter(3) = New TypedValue(DxfCode.Start, "LINE")&lt;BR /&gt;
            filter(4) = New TypedValue(DxfCode.Operator, "and&amp;gt;")&lt;BR /&gt;
            filter(5) = New TypedValue(DxfCode.Operator, "&lt;AND&gt;
            filter(6) = New TypedValue(DxfCode.Start, "CIRCLE")&lt;BR /&gt;
            filter(7) = New TypedValue(DxfCode.Operator, "&amp;gt;=")&lt;BR /&gt;
            filter(8) = New TypedValue(DxfCode.Real, 10)&lt;BR /&gt;
            filter(9) = New TypedValue(DxfCode.Operator, "and&amp;gt;")&lt;BR /&gt;
            filter(10) = New TypedValue(DxfCode.Operator, "or&amp;gt;")&lt;BR /&gt;
            Dim sf As SelectionFilter = New SelectionFilter(filter)&lt;BR /&gt;
            Dim psr As PromptSelectionResult = ed.SelectAll(sf)&lt;BR /&gt;
            ss = psr.Value&lt;BR /&gt;
            If ss.Count &amp;gt; 0 Then&lt;BR /&gt;
                oids = New ObjectIdCollection(ss.GetObjectIds)&lt;BR /&gt;
                For Each oid In oids&lt;BR /&gt;
                    ent = oid.GetObject(OpenMode.ForRead)&lt;BR /&gt;
                    If TypeOf ent Is BlockReference Then&lt;BR /&gt;
                        'br = CType(ent, BlockReference)&lt;BR /&gt;
                        'Debug.Print(br.Name)&lt;BR /&gt;
                    End If&lt;BR /&gt;
                Next&lt;BR /&gt;
            End If&lt;BR /&gt;
        Catch ex As System.Exception&lt;BR /&gt;
            MsgBox(ex.ToString)&lt;BR /&gt;
        End Try&lt;BR /&gt;
    End Sub&lt;/AND&gt;&lt;/AND&gt;&lt;/OR&gt;</description>
      <pubDate>Mon, 01 Mar 2010 20:34:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-selectionset-vb-net-filtered-with-conditions/m-p/2641532#M66643</guid>
      <dc:creator>sgrya1</dc:creator>
      <dc:date>2010-03-01T20:34:15Z</dc:date>
    </item>
    <item>
      <title>Re: Create SelectionSet VB.NET (filtered with conditions)</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-selectionset-vb-net-filtered-with-conditions/m-p/2641533#M66644</link>
      <description>There is a difference between a Selection Set and an ObjectIdCollection.  If you do a For Each on a SelectionSet, the type of object you will be retrieving is SelectedObject, but there is limited information available from a SelectedObject, so most of the time you need to use the ObjectId to open the object to query or modify parameters.</description>
      <pubDate>Mon, 01 Mar 2010 21:33:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-selectionset-vb-net-filtered-with-conditions/m-p/2641533#M66644</guid>
      <dc:creator>chiefbraincloud</dc:creator>
      <dc:date>2010-03-01T21:33:59Z</dc:date>
    </item>
    <item>
      <title>Re: Create SelectionSet VB.NET (filtered with conditions)</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-selectionset-vb-net-filtered-with-conditions/m-p/2641534#M66645</link>
      <description>Thanks Chiefbraincloud! I'm going to have to try to get my head around that one.&lt;BR /&gt;
The same object needs to be put in a different context to allow it to be read from the database I guess.&lt;BR /&gt;
Not sure the reason for a Selection Set now, but  it doesn't appear as I can get to the ObjectIdCollection without using one.&lt;BR /&gt;
&lt;BR /&gt;
Must be able to do colective actions on a selectionset.&lt;BR /&gt;
&lt;BR /&gt;
Have to look into it...

Edited by: sgrya1 on Mar 1, 2010 11:40 PM</description>
      <pubDate>Mon, 01 Mar 2010 22:38:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-selectionset-vb-net-filtered-with-conditions/m-p/2641534#M66645</guid>
      <dc:creator>sgrya1</dc:creator>
      <dc:date>2010-03-01T22:38:06Z</dc:date>
    </item>
    <item>
      <title>Re: Create SelectionSet VB.NET (filtered with conditions)</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-selectionset-vb-net-filtered-with-conditions/m-p/2641535#M66646</link>
      <description>{quote}&lt;BR /&gt;
&lt;BR /&gt;
 but there is limited information available from a SelectedObject&lt;BR /&gt;
&lt;BR /&gt;
{quote}&lt;BR /&gt;
&lt;BR /&gt;
Nonsense.&lt;BR /&gt;
&lt;BR /&gt;
That's only the case if you don't understand how it&lt;BR /&gt;
works, and how to use it.&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
http://www.caddzone.com&lt;BR /&gt;
&lt;BR /&gt;
AcadXTabs: MDI Document Tabs for AutoCAD&lt;BR /&gt;
Supporting AutoCAD 2000 through 2010&lt;BR /&gt;
&lt;BR /&gt;
http://www.acadxtabs.com&lt;BR /&gt;
&lt;BR /&gt;
Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");</description>
      <pubDate>Tue, 02 Mar 2010 01:23:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-selectionset-vb-net-filtered-with-conditions/m-p/2641535#M66646</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-03-02T01:23:27Z</dc:date>
    </item>
  </channel>
</rss>

