<?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 Saving custom entity, proxy object problem in ObjectARX Forum</title>
    <link>https://forums.autodesk.com/t5/objectarx-forum/saving-custom-entity-proxy-object-problem/m-p/4791123#M12708</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I created a simple custom object deriving from AcDbEntity in a dbx, and I'm facing issues when I tried to save this entity in a previous dwg version. Here are the steps to reproduce the problem:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Launch AutoCAD 2013 (or 2014) and load the dbx&lt;/LI&gt;&lt;LI&gt;Create an instance of the custom entity&lt;/LI&gt;&lt;LI&gt;Save the dwg in version 2013&lt;/LI&gt;&lt;LI&gt;Restart AutoCAD 2013 (or 2014), but&amp;nbsp;&lt;STRONG&gt;don't&lt;/STRONG&gt; load the dbx&lt;/LI&gt;&lt;LI&gt;Open the dwg created in step 3 (the custom object appears as PROXY OBJECT, it's normal)&lt;/LI&gt;&lt;LI&gt;Save the dwg in &lt;STRONG&gt;version 2010&amp;nbsp;&lt;/STRONG&gt;(with&amp;nbsp;&lt;EM&gt;save as...&lt;/EM&gt;)&lt;/LI&gt;&lt;LI&gt;Launch AutoCAD 2010 (or 2011 or 2012) and load the dbx (compiled for the right version)&lt;/LI&gt;&lt;LI&gt;Open the dwg created in step 6&lt;/LI&gt;&lt;LI&gt;Custom object appears as PROXY OBJECT --&amp;gt; why ???&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;I read AutoCAD developer's guide (chapter &lt;EM&gt;Custom Objects&lt;/EM&gt; -&amp;gt; &lt;EM&gt;Deriving from AcDbObject&lt;/EM&gt; -&amp;gt; &lt;EM&gt;Object Version Support&lt;/EM&gt;) about birth and filer version, but I didn't understand what I need to do.&amp;nbsp;Does anyone have the same problem? Is this is a normal behavior of AutoCAD?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;</description>
    <pubDate>Mon, 03 Feb 2014 16:03:15 GMT</pubDate>
    <dc:creator>maisoui</dc:creator>
    <dc:date>2014-02-03T16:03:15Z</dc:date>
    <item>
      <title>Saving custom entity, proxy object problem</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/saving-custom-entity-proxy-object-problem/m-p/4791123#M12708</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I created a simple custom object deriving from AcDbEntity in a dbx, and I'm facing issues when I tried to save this entity in a previous dwg version. Here are the steps to reproduce the problem:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Launch AutoCAD 2013 (or 2014) and load the dbx&lt;/LI&gt;&lt;LI&gt;Create an instance of the custom entity&lt;/LI&gt;&lt;LI&gt;Save the dwg in version 2013&lt;/LI&gt;&lt;LI&gt;Restart AutoCAD 2013 (or 2014), but&amp;nbsp;&lt;STRONG&gt;don't&lt;/STRONG&gt; load the dbx&lt;/LI&gt;&lt;LI&gt;Open the dwg created in step 3 (the custom object appears as PROXY OBJECT, it's normal)&lt;/LI&gt;&lt;LI&gt;Save the dwg in &lt;STRONG&gt;version 2010&amp;nbsp;&lt;/STRONG&gt;(with&amp;nbsp;&lt;EM&gt;save as...&lt;/EM&gt;)&lt;/LI&gt;&lt;LI&gt;Launch AutoCAD 2010 (or 2011 or 2012) and load the dbx (compiled for the right version)&lt;/LI&gt;&lt;LI&gt;Open the dwg created in step 6&lt;/LI&gt;&lt;LI&gt;Custom object appears as PROXY OBJECT --&amp;gt; why ???&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;I read AutoCAD developer's guide (chapter &lt;EM&gt;Custom Objects&lt;/EM&gt; -&amp;gt; &lt;EM&gt;Deriving from AcDbObject&lt;/EM&gt; -&amp;gt; &lt;EM&gt;Object Version Support&lt;/EM&gt;) about birth and filer version, but I didn't understand what I need to do.&amp;nbsp;Does anyone have the same problem? Is this is a normal behavior of AutoCAD?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;</description>
      <pubDate>Mon, 03 Feb 2014 16:03:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/saving-custom-entity-proxy-object-problem/m-p/4791123#M12708</guid>
      <dc:creator>maisoui</dc:creator>
      <dc:date>2014-02-03T16:03:15Z</dc:date>
    </item>
    <item>
      <title>Re: Saving custom entity, proxy object problem</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/saving-custom-entity-proxy-object-problem/m-p/4791469#M12709</link>
      <description>&lt;P&gt;Place a breakpoint in your dwgInFields() function to determine whether it is getting called as expected. If it isn't, then you haven't registered your&amp;nbsp;AcRxClass correctly.&amp;nbsp;If it is, step through&amp;nbsp;it to&amp;nbsp;determine why it returns an error.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Feb 2014 17:52:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/saving-custom-entity-proxy-object-problem/m-p/4791469#M12709</guid>
      <dc:creator>owenwengerd</dc:creator>
      <dc:date>2014-02-03T17:52:32Z</dc:date>
    </item>
    <item>
      <title>Re: Saving custom entity, proxy object problem</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/saving-custom-entity-proxy-object-problem/m-p/4792677#M12710</link>
      <description>&lt;P&gt;Hi Owen,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem is that no breakpoint is hit in any &lt;EM&gt;dwgInFields()&amp;nbsp;&lt;/EM&gt;function. My dbx is correctly loaded (goes in &lt;EM&gt;On_kInitAppMsg&lt;/EM&gt; and&amp;nbsp;&lt;EM&gt;On_kLoadDwgMsg&lt;/EM&gt;).&lt;/P&gt;&lt;P&gt;I checked that I use the same &lt;EM&gt;DWG_VERSION&lt;/EM&gt; and &lt;EM&gt;MAINTENANCE_VERSION&lt;/EM&gt; in the &lt;EM&gt;ACRX_DXF_DEFINE_MEMBERS&amp;nbsp;&lt;/EM&gt;macro.&lt;/P&gt;&lt;P&gt;I tried to extract info from AcDbObject and here is some lines:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;AcDbObject&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Class Name :&amp;nbsp;&lt;EM&gt;AcDbZombieEntity&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Birth DWG Version :&amp;nbsp;&lt;EM&gt;19 = kDHL_1012 (Release 13)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;AcDbProxyEntity&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Original Class Name :&amp;nbsp;&lt;EM&gt;MyEntity&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Original Class Name : &lt;EM&gt;MYENTITY&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Application Description :&amp;nbsp;&lt;EM&gt;...&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Proxy Flags :&lt;EM&gt; 3071&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Everything is correct so why AutoCAD doen't call my dwgInField() functions?&lt;/P&gt;&lt;P&gt;Any idea?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Feb 2014 08:25:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/saving-custom-entity-proxy-object-problem/m-p/4792677#M12710</guid>
      <dc:creator>maisoui</dc:creator>
      <dc:date>2014-02-04T08:25:21Z</dc:date>
    </item>
    <item>
      <title>Re: Saving custom entity, proxy object problem</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/saving-custom-entity-proxy-object-problem/m-p/4793399#M12711</link>
      <description>&lt;P&gt;It sounds like you're doing everything correctly, but obviously something is not correct somewhere. Write some test code that&amp;nbsp;tries to&amp;nbsp;do what AutoCAD does when it encounteres your entity: look up the class name in the system dictionary, use the returned class to call AcRxClass::create() and verify that you get back what you expect.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Offhand I can't think of any reason why AutoCAD&amp;nbsp;would call any other member function&amp;nbsp;before&amp;nbsp;dwgInFields(), but if you have anything else overridden, you might try temporarily removing all except dwgInFields() to see if anything changes. Other than that, I'm out of ideas.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Feb 2014 16:02:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/saving-custom-entity-proxy-object-problem/m-p/4793399#M12711</guid>
      <dc:creator>owenwengerd</dc:creator>
      <dc:date>2014-02-04T16:02:04Z</dc:date>
    </item>
    <item>
      <title>Re: Saving custom entity, proxy object problem</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/saving-custom-entity-proxy-object-problem/m-p/4795315#M12712</link>
      <description>&lt;P&gt;I followed your piece of advice and I created a very small dbx with one object (deriving AcDbObject) with only dwgInField and dwgOutField. I builded this dbx for AutoCAD 2010-11-12 and AutoCAD 2013-14 and I followed the steps I described in my first post. Result is the same!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After that, I wrote this code to make a test (getting my custom object from the dictionary):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;...
AcDbObject * pObject = NULL;
if(pDictionary-&amp;gt;getAt(_T("MYOBJECT1"), pObject, AcDb::kForRead) == Acad::eOk)
{
	if(pObject-&amp;gt;isKindOf(AcDbProxyObject::desc()))
	{
		AcDbProxyObject * pProxyObject = static_cast&amp;lt;AcDbProxyObject *&amp;gt;(pObject);
		const ACHAR * originalClassName = pProxyObject-&amp;gt;originalClassName();
		const ACHAR * originalDxfName = pProxyObject-&amp;gt;originalDxfName();

		AcRxClass * pClass = AcRxClass::cast(acrxClassDictionary-&amp;gt;at(originalClassName));
		MyObject1 * pObject1 = static_cast&amp;lt;MyObject1 *&amp;gt;(pClass-&amp;gt;create()); // all is ok!
		delete pObject1;
	}

	pObject-&amp;gt;close();

	Acad::ErrorStatus es = acdbResurrectMeNow(pObject-&amp;gt;objectId()); // returns eCannotBeResurrected
}&lt;BR /&gt;...&lt;/PRE&gt;&lt;P&gt;&lt;EM&gt;Class name is correct because I was able to create an object with the correct type (my custom object class), but Proxy Object cannot be resurrected.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't understand the mechanism of AutoCAD. Maybe somebody of Autodesk can give us an explanation?&lt;/P&gt;&lt;P&gt;&lt;EM&gt;If anyone is interested, I can send my sample project.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;</description>
      <pubDate>Wed, 05 Feb 2014 10:09:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/saving-custom-entity-proxy-object-problem/m-p/4795315#M12712</guid>
      <dc:creator>maisoui</dc:creator>
      <dc:date>2014-02-05T10:09:31Z</dc:date>
    </item>
    <item>
      <title>Re: Saving custom entity, proxy object problem</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/saving-custom-entity-proxy-object-problem/m-p/4795729#M12713</link>
      <description>&lt;P&gt;I noticed that your test code casts the returned object from AcRxClass::create without performing any check. One of the goals of the exercise was to verify that the returned object is what you expect and not something else. At the very least you should ensure that&amp;nbsp;your custom object constructor is called, and that the returned pointer&amp;nbsp;is the same object that was constructed. You should&amp;nbsp;also use&amp;nbsp;AcRxClass::cast() instead of static_cast.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'd like to see your ACRX_DEFINE_MEMBERS macro. Please attach your sample&amp;nbsp;project; if I get a chance I'll investigate.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Feb 2014 14:08:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/saving-custom-entity-proxy-object-problem/m-p/4795729#M12713</guid>
      <dc:creator>owenwengerd</dc:creator>
      <dc:date>2014-02-05T14:08:54Z</dc:date>
    </item>
    <item>
      <title>Re: Saving custom entity, proxy object problem</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/saving-custom-entity-proxy-object-problem/m-p/4795819#M12714</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes sorry for this brutal cast, but I made needed checks in debug mode.&amp;nbsp;This code is not intended to be distributed.&amp;nbsp;&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;I joined my simple project to this post.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your help.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;</description>
      <pubDate>Wed, 05 Feb 2014 14:52:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/saving-custom-entity-proxy-object-problem/m-p/4795819#M12714</guid>
      <dc:creator>maisoui</dc:creator>
      <dc:date>2014-02-05T14:52:06Z</dc:date>
    </item>
    <item>
      <title>Re: Saving custom entity, proxy object problem</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/saving-custom-entity-proxy-object-problem/m-p/4796217#M12715</link>
      <description>&lt;P&gt;I took a quick look at your sample project. Sorry, it's too much work for me to separate it into two projects for two different ObjectARX SDK versions, so I didn't bother trying to test anything. Have you tested without the custom birth version? I thought you had eliminated that from the equation, but I see it's still in your code.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Feb 2014 17:19:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/saving-custom-entity-proxy-object-problem/m-p/4796217#M12715</guid>
      <dc:creator>owenwengerd</dc:creator>
      <dc:date>2014-02-05T17:19:55Z</dc:date>
    </item>
    <item>
      <title>Re: Saving custom entity, proxy object problem</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/saving-custom-entity-proxy-object-problem/m-p/4797643#M12716</link>
      <description>&lt;P&gt;Are you talking about using&amp;nbsp;&lt;EM&gt;kDHL_CURRENT&lt;/EM&gt; in my&amp;nbsp;&lt;EM&gt;ACRX_DEFINE_MEMBERS&lt;/EM&gt;? I tried a lot of&amp;nbsp;combinations with arguments of&amp;nbsp;ACRX_DEFINE_MEMBERS, but I always get the same result.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2014 07:10:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/saving-custom-entity-proxy-object-problem/m-p/4797643#M12716</guid>
      <dc:creator>maisoui</dc:creator>
      <dc:date>2014-02-06T07:10:03Z</dc:date>
    </item>
    <item>
      <title>Re: Saving custom entity, proxy object problem</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/saving-custom-entity-proxy-object-problem/m-p/4798743#M12717</link>
      <description>&lt;P&gt;Yes, and use the ACRX_DEFINE_MEMBERS macro from the SDK to eliminate any potential unintended error&amp;nbsp;introduced by&amp;nbsp;your custom version.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2014 15:55:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/saving-custom-entity-proxy-object-problem/m-p/4798743#M12717</guid>
      <dc:creator>owenwengerd</dc:creator>
      <dc:date>2014-02-06T15:55:57Z</dc:date>
    </item>
    <item>
      <title>Re: Saving custom entity, proxy object problem</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/saving-custom-entity-proxy-object-problem/m-p/4800443#M12718</link>
      <description>&lt;P&gt;It was a good idea, I tried with:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;ACRX_DXF_DEFINE_MEMBERS(MyObject1, AcDbObject, AcDb::kDHL_1024, AcDb::kMRelease6, AcDbProxyEntity::kAllAllowedBits, MYOBJECT1, "SimpleObject|Product Desc: Object Enabler ...")&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I have no more success...&lt;/P&gt;&lt;P&gt;Once again, thank you for your suggestions.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Feb 2014 07:56:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/saving-custom-entity-proxy-object-problem/m-p/4800443#M12718</guid>
      <dc:creator>maisoui</dc:creator>
      <dc:date>2014-02-07T07:56:49Z</dc:date>
    </item>
  </channel>
</rss>

