<?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: C# .net how do I convert &amp;quot;object ID string&amp;quot; to objectID? in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/c-net-how-do-i-convert-quot-object-id-string-quot-to-objectid/m-p/13421674#M326</link>
    <description>&lt;P&gt;By saying "...&amp;nbsp;&lt;SPAN&gt;outputted it on a table in autocad...", you do mean a table in the drawing, don't you? Does the operation of outputting ObjectId string to table in the drawing and then reading back as ObjectId ONLY IN THE SAME AutoCAD session (that is, you do not save the ObjectID string, and then the drawing is closed, then it is opened again and the code tries to convert the string as a valid ObjectId)? If the data has to be dealt with crossing drawing openning session, you should use Handle instead of ObjectId, because handle is persisted with the drawing, while ObjectId is not, meaning the same entity may have different ObjectId in different AutoCAD/drawing session, but the Handle is the same.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 11 Apr 2025 18:35:57 GMT</pubDate>
    <dc:creator>norman.yuan</dc:creator>
    <dc:date>2025-04-11T18:35:57Z</dc:date>
    <item>
      <title>C# .net how do I convert "object ID string" to objectID?</title>
      <link>https://forums.autodesk.com/t5/net-forum/c-net-how-do-i-convert-quot-object-id-string-quot-to-objectid/m-p/13421404#M324</link>
      <description>&lt;P&gt;i used another command to grab an object's BlockID and outputted it on a table in autocad.&lt;/P&gt;&lt;P&gt;blocks[i].BlockId.ToString();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;now I want to be able to take that string and convert it back to objectID that I can use on another command. How would I do that? I already wrote the part that parses the "objectID string" out of the table but I don't know how to convert that string back to objectID&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried reading the documentation about objectID but I am not sure if any of those does what I wanted to do.&lt;/P&gt;&lt;P&gt;&lt;A href="https://help.autodesk.com/view/OARX/2025/ENU/?guid=OARX-ManagedRefGuide-__MEMBERTYPE_Properties_Autodesk_AutoCAD_DatabaseServices_ObjectId" target="_blank"&gt;AutoCAD 2025 Developer and ObjectARX Help | ObjectId Properties | Autodesk&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Apr 2025 15:25:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/c-net-how-do-i-convert-quot-object-id-string-quot-to-objectid/m-p/13421404#M324</guid>
      <dc:creator>jeff.wangD95HG</dc:creator>
      <dc:date>2025-04-11T15:25:37Z</dc:date>
    </item>
    <item>
      <title>Re: C# .net how do I convert "object ID string" to objectID?</title>
      <link>https://forums.autodesk.com/t5/net-forum/c-net-how-do-i-convert-quot-object-id-string-quot-to-objectid/m-p/13421480#M325</link>
      <description>&lt;P&gt;See if this works:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;string IdString = // assign to the string representation of the ObjectId

ObjectId id = new ObjectId(IntPtr.Parse(idString));&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 11 Apr 2025 16:28:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/c-net-how-do-i-convert-quot-object-id-string-quot-to-objectid/m-p/13421480#M325</guid>
      <dc:creator>ActivistInvestor</dc:creator>
      <dc:date>2025-04-11T16:28:24Z</dc:date>
    </item>
    <item>
      <title>Re: C# .net how do I convert "object ID string" to objectID?</title>
      <link>https://forums.autodesk.com/t5/net-forum/c-net-how-do-i-convert-quot-object-id-string-quot-to-objectid/m-p/13421674#M326</link>
      <description>&lt;P&gt;By saying "...&amp;nbsp;&lt;SPAN&gt;outputted it on a table in autocad...", you do mean a table in the drawing, don't you? Does the operation of outputting ObjectId string to table in the drawing and then reading back as ObjectId ONLY IN THE SAME AutoCAD session (that is, you do not save the ObjectID string, and then the drawing is closed, then it is opened again and the code tries to convert the string as a valid ObjectId)? If the data has to be dealt with crossing drawing openning session, you should use Handle instead of ObjectId, because handle is persisted with the drawing, while ObjectId is not, meaning the same entity may have different ObjectId in different AutoCAD/drawing session, but the Handle is the same.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Apr 2025 18:35:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/c-net-how-do-i-convert-quot-object-id-string-quot-to-objectid/m-p/13421674#M326</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2025-04-11T18:35:57Z</dc:date>
    </item>
    <item>
      <title>Re: C# .net how do I convert "object ID string" to objectID?</title>
      <link>https://forums.autodesk.com/t5/net-forum/c-net-how-do-i-convert-quot-object-id-string-quot-to-objectid/m-p/13421695#M327</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/543921"&gt;@norman.yuan&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;yea you are right. I read that up somewhere before and forgot about it. this is the current output I have generated&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jeffwangD95HG_0-1744397125789.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1488493iD601AE4F2354DD3E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jeffwangD95HG_0-1744397125789.png" alt="jeffwangD95HG_0-1744397125789.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;so what would handle look like? something like 8E48?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and the same question stands then. If I were to generate the handle into a string then how would I turn it back into a handle?&lt;/P&gt;</description>
      <pubDate>Fri, 11 Apr 2025 18:49:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/c-net-how-do-i-convert-quot-object-id-string-quot-to-objectid/m-p/13421695#M327</guid>
      <dc:creator>jeff.wangD95HG</dc:creator>
      <dc:date>2025-04-11T18:49:12Z</dc:date>
    </item>
    <item>
      <title>Re: C# .net how do I convert "object ID string" to objectID?</title>
      <link>https://forums.autodesk.com/t5/net-forum/c-net-how-do-i-convert-quot-object-id-string-quot-to-objectid/m-p/13421789#M328</link>
      <description>&lt;P&gt;Unless the ObjectId strings are embedded into a field expression (e.g., &amp;lt;AcObjProp&amp;gt;...), you can't use ObjectIds as a persistent reference to an objects. IOW, if your table is simply text that contains the string representation of an ObjectId, that does not work. ObjectIds are not persistent. You have to use Handles in that case. You can generate a string representation of a Handle using the Handle's ToString() method.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Given a string representing a handle in &lt;EM&gt;&lt;STRONG&gt;hex notation&lt;/STRONG&gt;&lt;/EM&gt;, this will produce an ObjectId:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;static ObjectId TryGetObjectId(this Database db, string handle)
{
   if(db is null)
      throw new ArgumentNullException(nameof(db));
   if(string.IsNullOrWhiteSpace(handle))
      return ObjectId.Null;
   try
   {
      return db.GetObjectId(false, new Handle(Convert.ToInt64(handle, 16)), 0);
   }
   catch(Autodesk.AutoCAD.Runtime.Exception ex) 
   {
      return ObjectId.Null;
   }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Apr 2025 20:39:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/c-net-how-do-i-convert-quot-object-id-string-quot-to-objectid/m-p/13421789#M328</guid>
      <dc:creator>ActivistInvestor</dc:creator>
      <dc:date>2025-04-11T20:39:53Z</dc:date>
    </item>
    <item>
      <title>Re: C# .net how do I convert "object ID string" to objectID?</title>
      <link>https://forums.autodesk.com/t5/net-forum/c-net-how-do-i-convert-quot-object-id-string-quot-to-objectid/m-p/13421791#M329</link>
      <description>&lt;P&gt;I was wondering about that too. Since I did some played around with some fields expressions referencing tables and found that it uses objectID and it remains persistent across sessions.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Apr 2025 20:41:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/c-net-how-do-i-convert-quot-object-id-string-quot-to-objectid/m-p/13421791#M329</guid>
      <dc:creator>jeff.wangD95HG</dc:creator>
      <dc:date>2025-04-11T20:41:45Z</dc:date>
    </item>
    <item>
      <title>Re: C# .net how do I convert "object ID string" to objectID?</title>
      <link>https://forums.autodesk.com/t5/net-forum/c-net-how-do-i-convert-quot-object-id-string-quot-to-objectid/m-p/13421926#M330</link>
      <description>&lt;P&gt;Yes, as I mentioned above, when storing Ids in field expressions, AutoCAD takes care of the bookkeeping (id translation and conversion to/from handles for saving), but that doesn't apply to simple text content that happens to contain a number, because AutoCAD doesn't recognize that as a reference to an Object in the drawing.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Apr 2025 22:51:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/c-net-how-do-i-convert-quot-object-id-string-quot-to-objectid/m-p/13421926#M330</guid>
      <dc:creator>ActivistInvestor</dc:creator>
      <dc:date>2025-04-11T22:51:55Z</dc:date>
    </item>
  </channel>
</rss>

