<?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: highlight a selection set in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/highlight-a-selection-set/m-p/2936806#M61713</link>
    <description>&lt;P&gt;The OP uses COM API, so the items in the selection set is already entity (AcadEntity, not Autodesk.AutoCAD.DatabaseServices.Entity). He cannot use your code sample.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To the OP.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Are you doing in stand-alone exe that automates AutoCAD?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since you use COM API, you can do the same as you do in VBA:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;AcadSelectionSet.Highlight True[False]&lt;/P&gt;</description>
    <pubDate>Wed, 02 Mar 2011 21:04:58 GMT</pubDate>
    <dc:creator>norman.yuan</dc:creator>
    <dc:date>2011-03-02T21:04:58Z</dc:date>
    <item>
      <title>highlight a selection set</title>
      <link>https://forums.autodesk.com/t5/net-forum/highlight-a-selection-set/m-p/2934096#M61709</link>
      <description>&lt;P&gt;in vba i can highlight a selectionSet with&lt;/P&gt;&lt;P&gt;sset.Highlight(true)&lt;/P&gt;&lt;P&gt;how can i do this with vb.net? with the same command i get no error or warning, but nothing is highlighted in autocad...&lt;/P&gt;</description>
      <pubDate>Tue, 01 Mar 2011 14:57:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/highlight-a-selection-set/m-p/2934096#M61709</guid>
      <dc:creator>stefan.hofer</dc:creator>
      <dc:date>2011-03-01T14:57:00Z</dc:date>
    </item>
    <item>
      <title>Re: highlight a selection set</title>
      <link>https://forums.autodesk.com/t5/net-forum/highlight-a-selection-set/m-p/2934148#M61710</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Using db As Database = HostApplicationServices.WorkingDatabase()
            Using tr As Transaction = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Database.TransactionManager.StartTransaction()
                Dim myDWG As Document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument
                Using lock As DocumentLock = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.LockDocument
                    Dim ed As Editor = myDWG.Editor
                    Dim getSelectionResult As PromptSelectionResult = ed.GetSelection()
                    If getSelectionResult.Status = PromptStatus.OK Then
                        For i = 0 To getSelectionResult.Value.Count - 1
                            Dim myEnt As Entity = TryCast(tr.GetObject(getSelectionResult.Value(i).ObjectId, OpenMode.ForRead), Entity)
                            myEnt.Highlight() ' or unhighlight
                        Next
                    End If
                End Using
            End Using
        End Using&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Mar 2011 15:15:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/highlight-a-selection-set/m-p/2934148#M61710</guid>
      <dc:creator>arcticad</dc:creator>
      <dc:date>2011-03-01T15:15:41Z</dc:date>
    </item>
    <item>
      <title>Re: highlight a selection set</title>
      <link>https://forums.autodesk.com/t5/net-forum/highlight-a-selection-set/m-p/2936182#M61711</link>
      <description>&lt;P&gt;Thank you for this example , but i'll not pick items.&lt;/P&gt;&lt;P&gt;I have already a selection set.&lt;/P&gt;&lt;P&gt;The code works, i can try to find a solution myself - pearhaps...&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://forums.autodesk.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;my sset:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;        Dim EditArt As String

        For i = 0 To ListBox1.Items.Count - 1
            If ListBox1.SelectedItem(i) Then
                EditArt = ListBox1.SelectedItem.ToString()
            End If
        Next i


        Dim acApp As Object, acDoc As Object
        Dim fType(1), fData(1), sset As Object
        acApp = GetObject(, "autocad.application")
        acDoc = acApp.ActiveDocument

        On Error Resume Next
        sset = acDoc.SelectionSets.Add("h1")

        fType(0) = 0 : fData(0) = "INSERT"
        fType(1) = 2 'DXF-GroupCode
        fData(1) = EditArt 'Name
        'Select Blocks
        sset.Select(acSelectionSetAll, , , fType, fData)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Mar 2011 16:23:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/highlight-a-selection-set/m-p/2936182#M61711</guid>
      <dc:creator>stefan.hofer</dc:creator>
      <dc:date>2011-03-02T16:23:35Z</dc:date>
    </item>
    <item>
      <title>Re: highlight a selection set</title>
      <link>https://forums.autodesk.com/t5/net-forum/highlight-a-selection-set/m-p/2936710#M61712</link>
      <description>&lt;P&gt;hint: Take each item in your selection set and convert it to an entity.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Mar 2011 20:17:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/highlight-a-selection-set/m-p/2936710#M61712</guid>
      <dc:creator>arcticad</dc:creator>
      <dc:date>2011-03-02T20:17:29Z</dc:date>
    </item>
    <item>
      <title>Re: highlight a selection set</title>
      <link>https://forums.autodesk.com/t5/net-forum/highlight-a-selection-set/m-p/2936806#M61713</link>
      <description>&lt;P&gt;The OP uses COM API, so the items in the selection set is already entity (AcadEntity, not Autodesk.AutoCAD.DatabaseServices.Entity). He cannot use your code sample.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To the OP.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Are you doing in stand-alone exe that automates AutoCAD?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since you use COM API, you can do the same as you do in VBA:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;AcadSelectionSet.Highlight True[False]&lt;/P&gt;</description>
      <pubDate>Wed, 02 Mar 2011 21:04:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/highlight-a-selection-set/m-p/2936806#M61713</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2011-03-02T21:04:58Z</dc:date>
    </item>
    <item>
      <title>Re: highlight a selection set</title>
      <link>https://forums.autodesk.com/t5/net-forum/highlight-a-selection-set/m-p/2937322#M61714</link>
      <description>&lt;UL&gt;&lt;LI&gt;I'm using a palette in autocad, not a exe.&lt;/LI&gt;&lt;LI&gt;in my selectionset are autocad blocks (all blocks with the same name)&lt;/LI&gt;&lt;LI&gt;And i try to Highlight all blocks with the same name (Blockname selected in a ListBox)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;sset.Highlight(True) dont work.&lt;/P&gt;&lt;P&gt;vba example attached. (screenshot)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Mar 2011 07:47:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/highlight-a-selection-set/m-p/2937322#M61714</guid>
      <dc:creator>stefan.hofer</dc:creator>
      <dc:date>2011-03-03T07:47:34Z</dc:date>
    </item>
    <item>
      <title>Re: highlight a selection set</title>
      <link>https://forums.autodesk.com/t5/net-forum/highlight-a-selection-set/m-p/2937948#M61716</link>
      <description>&lt;P&gt;Call sset.Application.Update() after sset.Highlight(True)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-drg&lt;/P&gt;</description>
      <pubDate>Thu, 03 Mar 2011 15:29:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/highlight-a-selection-set/m-p/2937948#M61716</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-03-03T15:29:30Z</dc:date>
    </item>
    <item>
      <title>Re: highlight a selection set</title>
      <link>https://forums.autodesk.com/t5/net-forum/highlight-a-selection-set/m-p/2938046#M61717</link>
      <description>&lt;P&gt;Dan's reply would get it to work (but I did not try), although the call to AcadApplication.Update in VBA is not needed. This, I guess, is because of your code calling the COM API from the .NET API, the extra layer of communication.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Surely, one can use COM API in the managed API, when necessary. But why you do you have to use COM API for the operation that managed API can do it perfectly in the first place?&lt;/P&gt;</description>
      <pubDate>Thu, 03 Mar 2011 16:06:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/highlight-a-selection-set/m-p/2938046#M61717</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2011-03-03T16:06:52Z</dc:date>
    </item>
    <item>
      <title>Re: highlight a selection set</title>
      <link>https://forums.autodesk.com/t5/net-forum/highlight-a-selection-set/m-p/2939042#M61718</link>
      <description>&lt;P&gt;The behavior the OP asks about is strange; I hadn't even tried it in .Net until now. &amp;nbsp;I _don't_ need the AcadApplication.Update() in .Net, whether in app context or doc context.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The only circumstance in which I needed it was when running out-of-process. &amp;nbsp;I was originally testing with python; I needed it out-of-process under all circumstances. &amp;nbsp;Never in-process, with python embedded via arx.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So...I can't replicate the behavior at all. &amp;nbsp;If what's been posted so far doesn't help, s.hover, please post more code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-drg&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>Fri, 04 Mar 2011 03:38:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/highlight-a-selection-set/m-p/2939042#M61718</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-03-04T03:38:29Z</dc:date>
    </item>
    <item>
      <title>Re: highlight a selection set</title>
      <link>https://forums.autodesk.com/t5/net-forum/highlight-a-selection-set/m-p/2939182#M61720</link>
      <description>&lt;P&gt;whooo i found the wrong code, the problem was not the highlight.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;sset.Select(&lt;STRONG&gt;AcSelect&lt;/STRONG&gt;.acSelectionSetAll, , , fType, fData)&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;AcSelect&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ty for your time.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this sub works:&lt;/P&gt;&lt;PRE&gt;    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Dim acApp As Object, acDoc As Object
        Dim fType(1) As Short
        Dim fData(1) As Object
        Dim sset As AcadSelectionSet
        acApp = GetObject(, "autocad.application")
        acDoc = acApp.ActiveDocument

        Dim EditArt As String
        EditArt = ListBox1.SelectedItem.ToString()

        'On Error Resume Next
        sset = acDoc.SelectionSets.Add("h1")

        'Block-Filter setzen
        fType(0) = 0 : fData(0) = "INSERT"
        fType(1) = 2 'DXF-GroupCode
        fData(1) = EditArt 'Name
        'Select Blocks
        sset.Select(AcSelect.acSelectionSetAll, , , fType, fData)

        'Highlight my SelectionSet
        sset.Highlight(True)

        acDoc.SelectionSets.Item("h1").Delete()
        Label4.Text = EditArt
        acDoc.SendCommand("_.PSPACE" &amp;amp; vbCr)
    End Sub&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Mar 2011 07:30:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/highlight-a-selection-set/m-p/2939182#M61720</guid>
      <dc:creator>stefan.hofer</dc:creator>
      <dc:date>2011-03-04T07:30:19Z</dc:date>
    </item>
    <item>
      <title>Re: highlight a selection set</title>
      <link>https://forums.autodesk.com/t5/net-forum/highlight-a-selection-set/m-p/10020946#M61721</link>
      <description>&lt;P&gt;Hi @Anonymous ,&lt;/P&gt;&lt;P&gt;Call Application.Update&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;worked like a charm for me. Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mucip:)&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2021 22:13:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/highlight-a-selection-set/m-p/10020946#M61721</guid>
      <dc:creator>mucip</dc:creator>
      <dc:date>2021-01-21T22:13:40Z</dc:date>
    </item>
  </channel>
</rss>

