<?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: dwgOutFields does not get called in ObjectARX Forum</title>
    <link>https://forums.autodesk.com/t5/objectarx-forum/dwgoutfields-does-not-get-called/m-p/312692#M39231</link>
    <description>Alexander Griesser &lt;TUXX&gt; wrote:&lt;BR /&gt;
&lt;BR /&gt;
Hi Alexander,&lt;BR /&gt;
&lt;BR /&gt;
[...]&lt;BR /&gt;
&amp;gt;||   int Dimension()       { return m_nDimension;  };&lt;BR /&gt;
&amp;gt;||   void Dimension(int _) { m_nDimension = _;     }; try this:&lt;BR /&gt;
&lt;BR /&gt;
int Dimension()       { assertReadEnabled(); return m_nDimension;  };&lt;BR /&gt;
void Dimension(int _) { if (_ != m_nDimension) { assertWriteEnabled();&lt;BR /&gt;
m_nDimension = _;}     };&lt;BR /&gt;
&lt;BR /&gt;
HTH&lt;BR /&gt;
Arnold&lt;/TUXX&gt;</description>
    <pubDate>Mon, 23 Sep 2002 02:45:17 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2002-09-23T02:45:17Z</dc:date>
    <item>
      <title>dwgOutFields does not get called</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/dwgoutfields-does-not-get-called/m-p/312691#M39230</link>
      <description>Hi!&lt;BR /&gt;
&lt;BR /&gt;
I have encountered a strange situation:&lt;BR /&gt;
&lt;BR /&gt;
First the short version:&lt;BR /&gt;
------------------------&lt;BR /&gt;
When I create a dictionary for a DWG-file, the dwgOutFields method gets&lt;BR /&gt;
called when trying to close this document and the dictionary gets saved&lt;BR /&gt;
correctly. When I then reopen the DWG-file, dwgInFields gets called (so&lt;BR /&gt;
far, so good) and I modify some values of the Dictionary. When I then&lt;BR /&gt;
try to close the document, dwgOutFields does _NOT_ get called and the&lt;BR /&gt;
new values won't be stored.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Now the longer description:&lt;BR /&gt;
---------------------------&lt;BR /&gt;
I want to save the following class to my DWG file:&lt;BR /&gt;
&lt;BR /&gt;
|| class AX3000_DWGData : public AcDbObject&lt;BR /&gt;
|| {&lt;BR /&gt;
|| private:&lt;BR /&gt;
||   int m_nDimension;&lt;BR /&gt;
|| &lt;BR /&gt;
|| public:&lt;BR /&gt;
||   ACRX_DECLARE_MEMBERS(AX3000_DWGData);&lt;BR /&gt;
||   AX3000_DWGData(): m_nDimension(0) {};&lt;BR /&gt;
||   AX3000_DWGData(const int&amp;amp; val): m_nDimension(val) {};&lt;BR /&gt;
||   &lt;BR /&gt;
||   int Dimension()       { return m_nDimension;  };&lt;BR /&gt;
||   void Dimension(int _) { m_nDimension = _;     };&lt;BR /&gt;
||   &lt;BR /&gt;
||   virtual Acad::ErrorStatus dwgInFields(AcDbDwgFiler*);&lt;BR /&gt;
||   virtual Acad::ErrorStatus dwgOutFields(AcDbDwgFiler*) const;&lt;BR /&gt;
||   virtual Acad::ErrorStatus dxfInFields(AcDbDxfFiler*);&lt;BR /&gt;
||   virtual Acad::ErrorStatus dxfOutFields(AcDbDxfFiler*) const;&lt;BR /&gt;
|| };&lt;BR /&gt;
&lt;BR /&gt;
I used the sample dwgInFields and dwgOutFields functions, which&lt;BR /&gt;
look like this:&lt;BR /&gt;
&lt;BR /&gt;
|| Acad::ErrorStatus AX3000_DWGData::dwgInFields(AcDbDwgFiler* pFiler)&lt;BR /&gt;
|| {&lt;BR /&gt;
||     assertWriteEnabled();&lt;BR /&gt;
|| &lt;BR /&gt;
||     AcDbObject::dwgInFields(pFiler);&lt;BR /&gt;
||     if (pFiler-&amp;gt;filerType() == AcDb::kWblockCloneFiler) {&lt;BR /&gt;
||         AcDbHardPointerId id;&lt;BR /&gt;
||         pFiler-&amp;gt;readItem(&amp;amp;id);&lt;BR /&gt;
||     }&lt;BR /&gt;
||     pFiler-&amp;gt;readItem(&amp;amp;m_nDimension);&lt;BR /&gt;
||     return pFiler-&amp;gt;filerStatus();&lt;BR /&gt;
|| }&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
|| Acad::ErrorStatus AX3000_DWGData::dwgOutFields(AcDbDwgFiler* pFiler) const&lt;BR /&gt;
|| {&lt;BR /&gt;
||     assertReadEnabled();&lt;BR /&gt;
|| &lt;BR /&gt;
||     AcDbObject::dwgOutFields(pFiler);&lt;BR /&gt;
||     if (pFiler-&amp;gt;filerType() == AcDb::kWblockCloneFiler)&lt;BR /&gt;
||         pFiler-&amp;gt;writeHardPointerId((AcDbHardPointerId)ownerId());&lt;BR /&gt;
||     pFiler-&amp;gt;writeItem(m_nDimension);&lt;BR /&gt;
||     return pFiler-&amp;gt;filerStatus();&lt;BR /&gt;
|| }&lt;BR /&gt;
&lt;BR /&gt;
I use the overloaded "Dimension()" of AX3000_DWGData to store and read&lt;BR /&gt;
the property "m_nDimension" from AX3000_DWGData, which works fine -&lt;BR /&gt;
during runtime.&lt;BR /&gt;
&lt;BR /&gt;
Everytime I retreive the dictionary handle from anywhere in my&lt;BR /&gt;
ARX-Application, I get the correct value of m_nDimension.&lt;BR /&gt;
If one part of my application increases m_nDimension, another part of my&lt;BR /&gt;
Application retreives the correct value for it (Note: I always reget the&lt;BR /&gt;
dictionary from the NamedObjectsDictionary just to be sure).&lt;BR /&gt;
&lt;BR /&gt;
When I load a DWG-file with a dictionary in it, AutoCAD calls the above&lt;BR /&gt;
listed dwgInFields Method and correctly reads in the value for the&lt;BR /&gt;
property "m_nDimension", but when I then change m_nDimension with my&lt;BR /&gt;
application and want to close AutoCad, no saving is done. Even If I&lt;BR /&gt;
manually hit the "SAVE"-Button in AutoCAD, it does not call my&lt;BR /&gt;
dwgOutFields method, so the value for m_nDimension is not updated in the&lt;BR /&gt;
database.&lt;BR /&gt;
&lt;BR /&gt;
Do I have to set a "dirty"-bit or something else for this dictionary to&lt;BR /&gt;
be written out to the DWG-file?&lt;BR /&gt;
&lt;BR /&gt;
Maybe some addiontal useful information:&lt;BR /&gt;
When I open a new drawing in AutoCAD, which does not contain my&lt;BR /&gt;
dictionary, I add this dictionary to the dwg-file with the following&lt;BR /&gt;
function:&lt;BR /&gt;
&lt;BR /&gt;
|| bool CreateDictionary()&lt;BR /&gt;
|| {&lt;BR /&gt;
||   AcDbDictionary *pNamedobj;&lt;BR /&gt;
||   AcDbObjectId objId1;&lt;BR /&gt;
||   AcDbDictionary *pDict;&lt;BR /&gt;
||   AcDbDatabase *pCurDwg = acdbHostApplicationServices()-&amp;gt;workingDatabase();&lt;BR /&gt;
||   pCurDwg -&amp;gt;getNamedObjectsDictionary(pNamedobj, AcDb::kForWrite);&lt;BR /&gt;
|| &lt;BR /&gt;
||   if(pNamedobj-&amp;gt;getAt("AX3000_DATA", (AcDbObject*&amp;amp;) pDict, AcDb::kForWrite) == Acad::eKeyNotFound)&lt;BR /&gt;
||   {&lt;BR /&gt;
||     pDict = new AcDbDictionary;&lt;BR /&gt;
||     AcDbObjectId DictId;&lt;BR /&gt;
||     if(pNamedobj -&amp;gt;setAt("AX3000_DATA", pDict, DictId) != eOk)&lt;BR /&gt;
||     {&lt;BR /&gt;
||       pNamedobj -&amp;gt;close();&lt;BR /&gt;
||       return false;&lt;BR /&gt;
||     }&lt;BR /&gt;
||   }&lt;BR /&gt;
||   pNamedobj-&amp;gt;close();&lt;BR /&gt;
||   if (pDict)&lt;BR /&gt;
||   {&lt;BR /&gt;
||     if(pDict -&amp;gt;has("AX3000_DWGData"))&lt;BR /&gt;
||     {&lt;BR /&gt;
||       pDict -&amp;gt;close();&lt;BR /&gt;
||       return true;&lt;BR /&gt;
||     }&lt;BR /&gt;
|| &lt;BR /&gt;
||     /* Add one instance of the AX3000_DWGData class to the dictionary */&lt;BR /&gt;
||     AX3000_DWGData *pObj1 = new AX3000_DWGData(1);&lt;BR /&gt;
||     AcDbObjectId rId1;&lt;BR /&gt;
||     ErrorStatus es;&lt;BR /&gt;
||     if((es = pDict-&amp;gt;setAt("AX3000_DWGData", pObj1, rId1)) != eOk)&lt;BR /&gt;
||     {&lt;BR /&gt;
||       acutPrintf("\n%s\n", acadErrorStatusText(es));&lt;BR /&gt;
||       pObj1 -&amp;gt;close();&lt;BR /&gt;
||       pDict -&amp;gt;close();&lt;BR /&gt;
||       return false;;&lt;BR /&gt;
||     }&lt;BR /&gt;
||     pObj1 -&amp;gt;close();&lt;BR /&gt;
||     pDict-&amp;gt;close();&lt;BR /&gt;
||   }&lt;BR /&gt;
||   else&lt;BR /&gt;
||     return false;&lt;BR /&gt;
||   return true;&lt;BR /&gt;
|| }&lt;BR /&gt;
&lt;BR /&gt;
When I then try to close AutoCAD, my dwgOutFields method gets called and&lt;BR /&gt;
the dictionary is correctly stored inside the dwg-file.&lt;BR /&gt;
&lt;BR /&gt;
Thanks in Advance,&lt;BR /&gt;
-- &lt;BR /&gt;
|   .-.  |   CCNA Alexander Griesser &lt;TUXX&gt;    | .''`. |&lt;BR /&gt;
|   /v\   \     Software Developer,  EDV Software Service     / : :' : |&lt;BR /&gt;
| /(   )\  |           Bahnhofstr. 8, 9500 Villach           |  `. `'  |&lt;BR /&gt;
|  ^^ ^^   `-------------------------------------------------'    `-   |&lt;/TUXX&gt;</description>
      <pubDate>Mon, 23 Sep 2002 01:48:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/dwgoutfields-does-not-get-called/m-p/312691#M39230</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2002-09-23T01:48:45Z</dc:date>
    </item>
    <item>
      <title>Re: dwgOutFields does not get called</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/dwgoutfields-does-not-get-called/m-p/312692#M39231</link>
      <description>Alexander Griesser &lt;TUXX&gt; wrote:&lt;BR /&gt;
&lt;BR /&gt;
Hi Alexander,&lt;BR /&gt;
&lt;BR /&gt;
[...]&lt;BR /&gt;
&amp;gt;||   int Dimension()       { return m_nDimension;  };&lt;BR /&gt;
&amp;gt;||   void Dimension(int _) { m_nDimension = _;     }; try this:&lt;BR /&gt;
&lt;BR /&gt;
int Dimension()       { assertReadEnabled(); return m_nDimension;  };&lt;BR /&gt;
void Dimension(int _) { if (_ != m_nDimension) { assertWriteEnabled();&lt;BR /&gt;
m_nDimension = _;}     };&lt;BR /&gt;
&lt;BR /&gt;
HTH&lt;BR /&gt;
Arnold&lt;/TUXX&gt;</description>
      <pubDate>Mon, 23 Sep 2002 02:45:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/dwgoutfields-does-not-get-called/m-p/312692#M39231</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2002-09-23T02:45:17Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/dwgoutfields-does-not-get-called/m-p/312693#M39232</link>
      <description>* Arnold Eibel &lt;EIBEL&gt;:&lt;BR /&gt;
&amp;gt; &amp;gt;||   int Dimension()       { return m_nDimension;  };&lt;BR /&gt;
&amp;gt; &amp;gt;||   void Dimension(int _) { m_nDimension = _;     }; try this:&lt;BR /&gt;
&amp;gt;  &lt;BR /&gt;
&amp;gt;  int Dimension()       { assertReadEnabled(); return m_nDimension;  };&lt;BR /&gt;
&amp;gt;  void Dimension(int _) { if (_ != m_nDimension) { assertWriteEnabled();&lt;BR /&gt;
&amp;gt;  m_nDimension = _;}     };&lt;BR /&gt;
&lt;BR /&gt;
Ah, thanks, that does the trick.&lt;BR /&gt;
Now, dwgOutFields gets called and when I step over it in the debugger, I&lt;BR /&gt;
also can see the right value for m_nDimension before the call of&lt;BR /&gt;
"pFiler -&amp;gt;writeItem(m_nDimension);". This call to writeItem then&lt;BR /&gt;
returns "eOk" and everything seems fine, but when I then reload the&lt;BR /&gt;
drawing again, "dwgInFields" always reads the default value for the&lt;BR /&gt;
dictionary's property "m_nDimension", which I set when creating the&lt;BR /&gt;
dictionary.&lt;BR /&gt;
&lt;BR /&gt;
Any hints?&lt;BR /&gt;
&lt;BR /&gt;
Again, thanks in Advance,&lt;BR /&gt;
-- &lt;BR /&gt;
|   .-.  |   CCNA Alexander Griesser &lt;TUXX&gt;    | .''`. |&lt;BR /&gt;
|   /v\   \     Software Developer,  EDV Software Service     / : :' : |&lt;BR /&gt;
| /(   )\  |           Bahnhofstr. 8, 9500 Villach           |  `. `'  |&lt;BR /&gt;
|  ^^ ^^   `-------------------------------------------------'    `-   |&lt;/TUXX&gt;&lt;/EIBEL&gt;</description>
      <pubDate>Mon, 23 Sep 2002 04:06:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/dwgoutfields-does-not-get-called/m-p/312693#M39232</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2002-09-23T04:06:18Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/dwgoutfields-does-not-get-called/m-p/312694#M39233</link>
      <description>Alexander Griesser &lt;TUXX&gt; wrote:&lt;BR /&gt;
&lt;BR /&gt;
Hi,&lt;BR /&gt;
&lt;BR /&gt;
&amp;gt; * Arnold Eibel &lt;EIBEL&gt;:&lt;BR /&gt;
&amp;gt;&amp;gt;&amp;gt;||   int Dimension()       { return m_nDimension;  };&lt;BR /&gt;
&amp;gt;&amp;gt;&amp;gt;||   void Dimension(int _) { m_nDimension = _;     }; try this:&lt;BR /&gt;
&amp;gt;&amp;gt;&lt;BR /&gt;
&amp;gt;&amp;gt; int Dimension()       { assertReadEnabled(); return&lt;BR /&gt;
&amp;gt;&amp;gt;  m_nDimension;  }; void Dimension(int _) { if (_ != m_nDimension)&lt;BR /&gt;
&amp;gt;&amp;gt;  { assertWriteEnabled(); m_nDimension = _;}     };&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Ah, thanks, that does the trick.&lt;BR /&gt;
&amp;gt; Now, dwgOutFields gets called and when I step over it in the&lt;BR /&gt;
&amp;gt; debugger, I also can see the right value for m_nDimension before&lt;BR /&gt;
&amp;gt; the call of "pFiler -&amp;gt;writeItem(m_nDimension);". This call to&lt;BR /&gt;
&amp;gt; writeItem then returns "eOk" and everything seems fine, but when I&lt;BR /&gt;
&amp;gt; then reload the drawing again, "dwgInFields" always reads the&lt;BR /&gt;
&amp;gt; default value for the dictionary's property "m_nDimension", which&lt;BR /&gt;
&amp;gt; I set when creating the dictionary.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Any hints?&lt;BR /&gt;
&lt;BR /&gt;
Because there is no function writeItem(int), writeItem(m_nDimension)&lt;BR /&gt;
will call writeBool(). Try&lt;BR /&gt;
this:&lt;BR /&gt;
&lt;BR /&gt;
dwgOutFields:&lt;BR /&gt;
&lt;BR /&gt;
...&lt;BR /&gt;
filer-&amp;gt;writeInt32(m_nDimension);&lt;BR /&gt;
...&lt;BR /&gt;
&lt;BR /&gt;
dwgInFields:&lt;BR /&gt;
&lt;BR /&gt;
...&lt;BR /&gt;
Adesk::Int32 i(0);&lt;BR /&gt;
filer-&amp;gt;readInt32(&amp;amp;i);&lt;BR /&gt;
m_nDimension = i;&lt;BR /&gt;
...&lt;BR /&gt;
&lt;BR /&gt;
Grüße aus dem (herbstlichen) Odenwald&lt;BR /&gt;
Arnold&lt;/EIBEL&gt;&lt;/TUXX&gt;</description>
      <pubDate>Mon, 23 Sep 2002 05:10:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/dwgoutfields-does-not-get-called/m-p/312694#M39233</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2002-09-23T05:10:27Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/dwgoutfields-does-not-get-called/m-p/312695#M39234</link>
      <description>* Arnold Eibel &lt;EIBEL&gt;:&lt;BR /&gt;
&amp;gt; &amp;gt; * Arnold Eibel &lt;EIBEL&gt;:&lt;BR /&gt;
&amp;gt; &amp;gt;&amp;gt;&amp;gt;||   int Dimension()       { return m_nDimension;  };&lt;BR /&gt;
&amp;gt; &amp;gt;&amp;gt;&amp;gt;||   void Dimension(int _) { m_nDimension = _;     }; try this:&lt;BR /&gt;
&amp;gt; &amp;gt;&amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt;&amp;gt; int Dimension()       { assertReadEnabled(); return&lt;BR /&gt;
&amp;gt; &amp;gt;&amp;gt;  m_nDimension;  }; void Dimension(int _) { if (_ != m_nDimension)&lt;BR /&gt;
&amp;gt; &amp;gt;&amp;gt;  { assertWriteEnabled(); m_nDimension = _;}     };&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt; Ah, thanks, that does the trick.&lt;BR /&gt;
&amp;gt; &amp;gt; Now, dwgOutFields gets called and when I step over it in the&lt;BR /&gt;
&amp;gt; &amp;gt; debugger, I also can see the right value for m_nDimension before&lt;BR /&gt;
&amp;gt; &amp;gt; the call of "pFiler -&amp;gt;writeItem(m_nDimension);". This call to&lt;BR /&gt;
&amp;gt; &amp;gt; writeItem then returns "eOk" and everything seems fine, but when I&lt;BR /&gt;
&amp;gt; &amp;gt; then reload the drawing again, "dwgInFields" always reads the&lt;BR /&gt;
&amp;gt; &amp;gt; default value for the dictionary's property "m_nDimension", which&lt;BR /&gt;
&amp;gt; &amp;gt; I set when creating the dictionary.&lt;BR /&gt;
&amp;gt;  &lt;BR /&gt;
&amp;gt;  Because there is no function writeItem(int), writeItem(m_nDimension)&lt;BR /&gt;
&amp;gt;  will call writeBool().&lt;BR /&gt;
&lt;BR /&gt;
In my documentation of the ObjectARX Interface, there is such a&lt;BR /&gt;
function:&lt;BR /&gt;
&lt;BR /&gt;
|| inline Acad::ErrorStatus&lt;BR /&gt;
|| writeItem(&lt;BR /&gt;
||   int val);&lt;BR /&gt;
||&lt;BR /&gt;
|| val      int to be written out &lt;BR /&gt;
|| &lt;BR /&gt;
|| This inline method calls the class's writeInt method (see&lt;BR /&gt;
|| AcDbDwgFiler::writeInt for more information).&lt;BR /&gt;
&lt;BR /&gt;
And therefore, I assumed, that that this would do just fine. But when I &lt;BR /&gt;
tried to directly call WriteInt, I got an error, that the function does&lt;BR /&gt;
not exist, which states, that you're right.&lt;BR /&gt;
&lt;BR /&gt;
Now I use WriteInt32 and everything works fine, thanks for your help!&lt;BR /&gt;
Mislead by Documentation &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt;&lt;BR /&gt;
&lt;BR /&gt;
ciao,&lt;BR /&gt;
-- &lt;BR /&gt;
|   .-.  |   CCNA Alexander Griesser &lt;TUXX&gt;    | .''`. |&lt;BR /&gt;
|   /v\   \     Software Developer,  EDV Software Service     / : :' : |&lt;BR /&gt;
| /(   )\  |           Bahnhofstr. 8, 9500 Villach           |  `. `'  |&lt;BR /&gt;
|  ^^ ^^   `-------------------------------------------------'    `-   |&lt;/TUXX&gt;&lt;/EIBEL&gt;&lt;/EIBEL&gt;</description>
      <pubDate>Mon, 23 Sep 2002 22:06:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/dwgoutfields-does-not-get-called/m-p/312695#M39234</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2002-09-23T22:06:29Z</dc:date>
    </item>
  </channel>
</rss>

