<?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 Select object from objectidcollection in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/select-object-from-objectidcollection/m-p/9034096#M21232</link>
    <description>&lt;P&gt;Hi. I have two selection set. I remove one selectionset from another by using ObjectIdCollection but I don't know how I can for example remove selected object in ObjectIdCollection. I try something like this:&lt;/P&gt;&lt;PRE&gt;For Each selected As SelectedObject In acObjIdColl If Not IsDBNull(selected) Then 
Dim ObjErase As Entity = acTrans.GetObject(selected.ObjectId, OpenMode.ForWrite) 
If Not IsDBNull(ObjErase) Then 
ObjErase.Erase() 
End If 
End If 
Next&lt;/PRE&gt;&lt;P&gt;But it isn't work.&lt;/P&gt;</description>
    <pubDate>Thu, 19 Sep 2019 05:44:30 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2019-09-19T05:44:30Z</dc:date>
    <item>
      <title>Select object from objectidcollection</title>
      <link>https://forums.autodesk.com/t5/net-forum/select-object-from-objectidcollection/m-p/9034096#M21232</link>
      <description>&lt;P&gt;Hi. I have two selection set. I remove one selectionset from another by using ObjectIdCollection but I don't know how I can for example remove selected object in ObjectIdCollection. I try something like this:&lt;/P&gt;&lt;PRE&gt;For Each selected As SelectedObject In acObjIdColl If Not IsDBNull(selected) Then 
Dim ObjErase As Entity = acTrans.GetObject(selected.ObjectId, OpenMode.ForWrite) 
If Not IsDBNull(ObjErase) Then 
ObjErase.Erase() 
End If 
End If 
Next&lt;/PRE&gt;&lt;P&gt;But it isn't work.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Sep 2019 05:44:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/select-object-from-objectidcollection/m-p/9034096#M21232</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-09-19T05:44:30Z</dc:date>
    </item>
    <item>
      <title>Re: Select object from objectidcollection</title>
      <link>https://forums.autodesk.com/t5/net-forum/select-object-from-objectidcollection/m-p/9044091#M21233</link>
      <description>&lt;P&gt;Are you trying to remove the object from the selection set or from the database?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are trying to remove the object from the selection set, but not the drawing you will want to use the &lt;FONT face="courier new,courier"&gt;Remove&lt;/FONT&gt; or &lt;FONT face="courier new,courier"&gt;RemoveAt&lt;/FONT&gt; methods of the &lt;FONT face="courier new,courier"&gt;ObjectIdCollection&lt;/FONT&gt;. You can learn more about selecting sets and removing objects from there here:&amp;nbsp;&lt;A href="https://help.autodesk.com/view/OARX/2020/ENU/?guid=GUID-C1573808-66CF-4E40-8E7A-C52DFBCA352E" target="_blank" rel="noopener"&gt;https://help.autodesk.com/view/OARX/2020/ENU/?guid=GUID-C1573808-66CF-4E40-8E7A-C52DFBCA352E&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are trying to remove an object from the database, you need to use the &lt;FONT face="courier new,courier"&gt;Erase&lt;/FONT&gt; method as you have in your code but you must also make sure you do a &lt;FONT face="courier new,courier"&gt;Commit&lt;/FONT&gt; with the Transaction Manager after your &lt;FONT face="courier new,courier"&gt;For&lt;/FONT&gt; loop.&amp;nbsp; The changes won't take place unless a commit occurs, and if you don't before the Transaction Manager goes out of scope all changes made will be rolled back as an abort occurs (&lt;A href="https://help.autodesk.com/view/OARX/2020/ENU/?guid=GUID-C3DE4301-EAC3-4745-A434-9F28EE87AB73" target="_blank" rel="noopener"&gt;Commit and Rollback Changes&lt;/A&gt;).&amp;nbsp; You can learn more about how to erase an object here:&amp;nbsp;&lt;A href="https://help.autodesk.com/view/OARX/2020/ENU/?guid=GUID-A9283274-3E5B-4739-975B-03A30536EE64" target="_blank" rel="noopener"&gt;https://help.autodesk.com/view/OARX/2020/ENU/?guid=GUID-A9283274-3E5B-4739-975B-03A30536EE64&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Sep 2019 14:56:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/select-object-from-objectidcollection/m-p/9044091#M21233</guid>
      <dc:creator>ambrosl</dc:creator>
      <dc:date>2019-09-24T14:56:40Z</dc:date>
    </item>
  </channel>
</rss>

