<?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: Selection set filter &amp; vbnet in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/selection-set-filter-vbnet/m-p/2383580#M72674</link>
    <description>I had the same problem when I moved my VBA project to .NET, and it was not easy to find the answer, but I just looked and found some old code in which I have declared the filters gpCode as Short and dataValue as Object.  I know that is not what the signatures say in the object browser, but it worked for me.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The other post here shows you how to do it in the managed environment.  What you are doing is ActiveX or COM.</description>
    <pubDate>Wed, 19 Nov 2008 18:42:05 GMT</pubDate>
    <dc:creator>chiefbraincloud</dc:creator>
    <dc:date>2008-11-19T18:42:05Z</dc:date>
    <item>
      <title>Selection set filter &amp; vbnet</title>
      <link>https://forums.autodesk.com/t5/net-forum/selection-set-filter-vbnet/m-p/2383578#M72672</link>
      <description>HI,&lt;BR /&gt;
i have a problem with "selection filter" and vbnet.&lt;BR /&gt;
I occurred an error in this code.&lt;BR /&gt;
        ssetObj = activeDoc.SelectionSets.Add("SSET10")&lt;BR /&gt;
        mode = AutoCAD.AcSelect.acSelectionSetAll&lt;BR /&gt;
        Dim gpCode(0) As Integer&lt;BR /&gt;
        Dim dataValue(0) As Object&lt;BR /&gt;
        gpCode(0) = 8 'layer&lt;BR /&gt;
        dataValue(0) = "Raster" 'layer name&lt;BR /&gt;
        Dim groupCode As Object, dataCode As Object&lt;BR /&gt;
        groupCode = gpCode&lt;BR /&gt;
        dataCode = dataValue&lt;BR /&gt;
        ssetObj.Select(mode, , , groupCode, dataCode)   &amp;lt;-----------------error....&lt;BR /&gt;
&lt;BR /&gt;
i think it's a problem with declaration (like "datacode as object")&lt;BR /&gt;
in VBA use "Variant" but in vbnet isn't possible...&lt;BR /&gt;
can anyone help me?&lt;BR /&gt;
thanks&lt;BR /&gt;
Marco</description>
      <pubDate>Wed, 19 Nov 2008 08:51:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/selection-set-filter-vbnet/m-p/2383578#M72672</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-11-19T08:51:14Z</dc:date>
    </item>
    <item>
      <title>Re: Selection set filter &amp; vbnet</title>
      <link>https://forums.autodesk.com/t5/net-forum/selection-set-filter-vbnet/m-p/2383579#M72673</link>
      <description>in vb.net from ObjectARX 2009\samples\dotNet\SelectionSet&lt;BR /&gt;
  Public Class AcEdSSGetCommand&lt;BR /&gt;
&lt;BR /&gt;
        Shared SelentityCount As Integer = 0&lt;BR /&gt;
        Shared UseThisSelectionResult As PromptSelectionResult&lt;BR /&gt;
        Shared UseThisSelectionOption As PromptSelectionOptions = Nothing&lt;BR /&gt;
&lt;BR /&gt;
        'This command does a simple selection and ignores all &lt;BR /&gt;
        'entities other than red circles&lt;BR /&gt;
        &lt;COMMANDMETHOD&gt; _&lt;BR /&gt;
        Public Sub ssGetFilter()&lt;BR /&gt;
            'Setup&lt;BR /&gt;
            Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor&lt;BR /&gt;
&lt;BR /&gt;
            'Declare our filter entries this way.&lt;BR /&gt;
            'We build them the same way in ObjectARX.&lt;BR /&gt;
            'DxfCode.Start (equal to 0) - This is for 'Entity Name'&lt;BR /&gt;
            'DxfCode.Color is for ACI color - 1 = Red&lt;BR /&gt;
            Dim values() As TypedValue = { _&lt;BR /&gt;
                New TypedValue(DxfCode.Start, "CIRCLE"), _&lt;BR /&gt;
                New TypedValue(DxfCode.Color, 1) _&lt;BR /&gt;
                }&lt;BR /&gt;
            Dim sfilter As New SelectionFilter(values) ' Create the filter using our values...&lt;BR /&gt;
&lt;BR /&gt;
            'Set the selection options&lt;BR /&gt;
            Dim SelOpts As New PromptSelectionOptions()&lt;BR /&gt;
            SelOpts.MessageForAdding = "Select Red Circles:"&lt;BR /&gt;
            SelOpts.AllowDuplicates = True&lt;BR /&gt;
            'Make the selection:&lt;BR /&gt;
            Dim res As PromptSelectionResult = ed.GetSelection(SelOpts, sfilter)&lt;BR /&gt;
&lt;BR /&gt;
            If Not res.Status = PromptStatus.OK Then Return&lt;BR /&gt;
&lt;BR /&gt;
            Dim SS As Autodesk.AutoCAD.EditorInput.SelectionSet = res.Value&lt;BR /&gt;
            Dim idarray As ObjectId() = SS.GetObjectIds()&lt;BR /&gt;
            Dim db As Database = Application.DocumentManager.MdiActiveDocument.Database&lt;BR /&gt;
            Dim tm As Autodesk.AutoCAD.DatabaseServices.TransactionManager = db.TransactionManager&lt;BR /&gt;
            'start a transaction&lt;BR /&gt;
            Dim myT As Transaction = tm.StartTransaction()&lt;BR /&gt;
            Try&lt;BR /&gt;
                Dim id As ObjectId&lt;BR /&gt;
                For Each id In idarray&lt;BR /&gt;
                    Dim entity As Entity = tm.GetObject(id, OpenMode.ForRead, True)&lt;BR /&gt;
                    ed.WriteMessage((ControlChars.Lf + "You selected: " + entity.GetType().FullName))&lt;BR /&gt;
                Next id&lt;BR /&gt;
            Finally&lt;BR /&gt;
                myT.Dispose()&lt;BR /&gt;
            End Try&lt;BR /&gt;
        End Sub

Edited by: Danny.isr on Nov 19, 2008 9:26 AM&lt;/COMMANDMETHOD&gt;</description>
      <pubDate>Wed, 19 Nov 2008 09:25:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/selection-set-filter-vbnet/m-p/2383579#M72673</guid>
      <dc:creator>Danny.isr</dc:creator>
      <dc:date>2008-11-19T09:25:57Z</dc:date>
    </item>
    <item>
      <title>Re: Selection set filter &amp; vbnet</title>
      <link>https://forums.autodesk.com/t5/net-forum/selection-set-filter-vbnet/m-p/2383580#M72674</link>
      <description>I had the same problem when I moved my VBA project to .NET, and it was not easy to find the answer, but I just looked and found some old code in which I have declared the filters gpCode as Short and dataValue as Object.  I know that is not what the signatures say in the object browser, but it worked for me.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The other post here shows you how to do it in the managed environment.  What you are doing is ActiveX or COM.</description>
      <pubDate>Wed, 19 Nov 2008 18:42:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/selection-set-filter-vbnet/m-p/2383580#M72674</guid>
      <dc:creator>chiefbraincloud</dc:creator>
      <dc:date>2008-11-19T18:42:05Z</dc:date>
    </item>
    <item>
      <title>Re: Selection set filter &amp; vbnet</title>
      <link>https://forums.autodesk.com/t5/net-forum/selection-set-filter-vbnet/m-p/2383581#M72675</link>
      <description>incredible!! it work!! thank you very much to everybody...&lt;BR /&gt;
Marco</description>
      <pubDate>Wed, 19 Nov 2008 21:00:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/selection-set-filter-vbnet/m-p/2383581#M72675</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-11-19T21:00:04Z</dc:date>
    </item>
    <item>
      <title>Re: Selection set filter &amp; vbnet</title>
      <link>https://forums.autodesk.com/t5/net-forum/selection-set-filter-vbnet/m-p/2383582#M72676</link>
      <description>The first thing people moving from VBA to VB.NET need to know is that data types are different. Hence if you know the equivalent data types you avoid simple problems like this one.</description>
      <pubDate>Wed, 19 Nov 2008 21:51:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/selection-set-filter-vbnet/m-p/2383582#M72676</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-11-19T21:51:58Z</dc:date>
    </item>
    <item>
      <title>Re: Selection set filter &amp; vbnet</title>
      <link>https://forums.autodesk.com/t5/net-forum/selection-set-filter-vbnet/m-p/2383583#M72677</link>
      <description>&lt;P&gt;&lt;BR /&gt;While I can't argue that there are some differences it types, I would have avoided the whole problem altogether if the Object browser didn't show this as the signature for the filter on AcadSelectionSet.Select: (copied and pasted directly from the Object Browser)&lt;BR /&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;BR /&gt;Optional ByVal &lt;EM&gt;FilterType&lt;/EM&gt; As &lt;STRONG&gt;&lt;U&gt;Object&lt;/U&gt;&lt;/STRONG&gt; = Nothing&lt;STRONG&gt;, &lt;/STRONG&gt;Optional ByVal &lt;EM&gt;FilterData&lt;/EM&gt; As &lt;STRONG&gt;&lt;U&gt;Object&lt;/U&gt;&lt;/STRONG&gt; = Nothing&lt;BR /&gt;&lt;BR /&gt;If you use Object, it doesn't work, and while it's a short leap from {color:#0000ff}Integer{color} in VBA to {color:#0000ff}Short{color} in .NET, the leap from Object to Short is a little more obscure.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Nov 2008 22:06:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/selection-set-filter-vbnet/m-p/2383583#M72677</guid>
      <dc:creator>chiefbraincloud</dc:creator>
      <dc:date>2008-11-19T22:06:12Z</dc:date>
    </item>
    <item>
      <title>Re: Selection set filter &amp; vbnet</title>
      <link>https://forums.autodesk.com/t5/net-forum/selection-set-filter-vbnet/m-p/2383584#M72678</link>
      <description>Sorry I didn't mean you to take offence just offering help for those making the move.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I will reiterate for people moving from VBA to a .NET language with the ActiveX API they can simply avoid these problems if they know what type they used with VBA and use the .NET equivalent type.</description>
      <pubDate>Wed, 19 Nov 2008 22:16:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/selection-set-filter-vbnet/m-p/2383584#M72678</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-11-19T22:16:28Z</dc:date>
    </item>
    <item>
      <title>Re: Selection set filter &amp; vbnet</title>
      <link>https://forums.autodesk.com/t5/net-forum/selection-set-filter-vbnet/m-p/12839229#M72679</link>
      <description>&lt;P&gt;&lt;A href="https://adndevblog.typepad.com/autocad/2012/07/creating-a-selection-set-using-com-interop.html" target="_blank"&gt;https://adndevblog.typepad.com/autocad/2012/07/creating-a-selection-set-using-com-interop.html&lt;/A&gt; Dim FilterType(0)&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Dim FilterType(0) As Int16 ' IMPORTANT: The type must be Int16,

                           ' otherwise you'll get an exception!

Dim FilterData(0) As Object&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 14 Jun 2024 06:25:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/selection-set-filter-vbnet/m-p/12839229#M72679</guid>
      <dc:creator>Stakin</dc:creator>
      <dc:date>2024-06-14T06:25:09Z</dc:date>
    </item>
    <item>
      <title>Re: Selection set filter &amp; vbnet</title>
      <link>https://forums.autodesk.com/t5/net-forum/selection-set-filter-vbnet/m-p/12840994#M72680</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;EM&gt;I'm migrating my VBA code to VB.NET and getting an exception . . .&amp;nbsp;&lt;/EM&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;example of&amp;nbsp;self inflicted injury.&lt;/P&gt;&lt;P&gt;I threw up into my mouth.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;what a waste of good brain cells !!&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jun 2024 22:21:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/selection-set-filter-vbnet/m-p/12840994#M72680</guid>
      <dc:creator>kerry_w_brown</dc:creator>
      <dc:date>2024-06-14T22:21:02Z</dc:date>
    </item>
  </channel>
</rss>

