<?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: INSERT fails on custom entity derived from AcDbBlockReference in ObjectARX Forum</title>
    <link>https://forums.autodesk.com/t5/objectarx-forum/insert-fails-on-custom-entity-derived-from-acdbblockreference/m-p/1616901#M23846</link>
    <description>It turns out that in 2006, the INSERT mechanism does not import the block reference into the working drawing until the custom entity is made database resident. Replacing acdbHostApplicationServices()-&amp;gt;workingDatabase() with AcDbObject::database() solved the problem.&lt;BR /&gt;
&lt;BR /&gt;
Thanks for the help.</description>
    <pubDate>Thu, 20 Apr 2006 04:17:33 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2006-04-20T04:17:33Z</dc:date>
    <item>
      <title>INSERT fails on custom entity derived from AcDbBlockReference</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/insert-fails-on-custom-entity-derived-from-acdbblockreference/m-p/1616895#M23840</link>
      <description>I have a custom entity derived from AcDbBlockReference. I have created a drawing containing one or more of these custom entites and I want to insert that drawing into another drawing. Of course, since the block to which the custom entity is reference is required in the second drawing also, I have ensured that all the relevant blocks are available. &lt;BR /&gt;
&lt;BR /&gt;
However, if I run the INSERT command and select the first drawing, it is consistently throwing up an "eWrongDatabase" error for each custom entity in the drawing. This error appears in the following code:&lt;BR /&gt;
&lt;BR /&gt;
Acad::ErrorStatus CMyCustomEntity::setRefBlock(const char* pszRefBlock)&lt;BR /&gt;
{&lt;BR /&gt;
  // Ensure that we are open for writing&lt;BR /&gt;
  assertWriteEnabled();&lt;BR /&gt;
&lt;BR /&gt;
  // Get the block id of the given name&lt;BR /&gt;
  Acad::ErrorStatus es;&lt;BR /&gt;
  AcDbBlockTable *pBT;&lt;BR /&gt;
  es = acdbHostApplicationServices()-&amp;gt;workingDatabase()-&amp;gt;getBlockTable(pBT, AcDb::kForRead);&lt;BR /&gt;
&lt;BR /&gt;
  // Get the referenced block&lt;BR /&gt;
  AcDbObjectId objRefId;&lt;BR /&gt;
  es = pBT-&amp;gt;getAt(m_pszRefBlock, objRefId);&lt;BR /&gt;
&lt;BR /&gt;
  // If it was not found, this is a serious error&lt;BR /&gt;
  if (es != Acad::eOk) &lt;BR /&gt;
  { &lt;BR /&gt;
    // Close the block table&lt;BR /&gt;
    pBT-&amp;gt;close(); &lt;BR /&gt;
    &lt;BR /&gt;
    // Erase this equipment from the drawing&lt;BR /&gt;
    erase();&lt;BR /&gt;
&lt;BR /&gt;
    // Return the error status for further processing&lt;BR /&gt;
    return es; &lt;BR /&gt;
  }&lt;BR /&gt;
&lt;BR /&gt;
  // Close the block table&lt;BR /&gt;
  pBT-&amp;gt;close();&lt;BR /&gt;
  &lt;BR /&gt;
  // Set the reference to the block ID&lt;BR /&gt;
  if ((es = setBlockTableRecord(objRefId)) != Acad::eOk)&lt;BR /&gt;
  {&lt;BR /&gt;
    // ---------------  This is the error that is appearing  ---------------------&lt;BR /&gt;
    acutPrintf("\nError %d setting block reference to '%s'.\n", es, m_pszRefBlock);&lt;BR /&gt;
    erase();&lt;BR /&gt;
    return es;&lt;BR /&gt;
  }&lt;BR /&gt;
&lt;BR /&gt;
  // More code here&lt;BR /&gt;
  ...&lt;BR /&gt;
  ...&lt;BR /&gt;
  ...&lt;BR /&gt;
}&lt;BR /&gt;
&lt;BR /&gt;
I have tried the objRefId.convertToRedirectedId() before calling setBlockTableRecord() but the error still persists. I should note here that this functionality was working perfectly in AutoCAD 2000/2002, but it is failing in AutoCAD 2006.</description>
      <pubDate>Wed, 19 Apr 2006 04:54:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/insert-fails-on-custom-entity-derived-from-acdbblockreference/m-p/1616895#M23840</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-04-19T04:54:37Z</dc:date>
    </item>
    <item>
      <title>Re: INSERT fails on custom entity derived from AcDbBlockReference</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/insert-fails-on-custom-entity-derived-from-acdbblockreference/m-p/1616896#M23841</link>
      <description>The "m_pszRefBlock" should read as "pszRefBlock". Excuse the error.</description>
      <pubDate>Wed, 19 Apr 2006 05:02:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/insert-fails-on-custom-entity-derived-from-acdbblockreference/m-p/1616896#M23841</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-04-19T05:02:44Z</dc:date>
    </item>
    <item>
      <title>Re: INSERT fails on custom entity derived from AcDbBlockReference</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/insert-fails-on-custom-entity-derived-from-acdbblockreference/m-p/1616897#M23842</link>
      <description>Is your entity database resident at the time you call &lt;BR /&gt;
setBlockTableRecord()?  If it is database resident, does it reside in the &lt;BR /&gt;
working database?  My guess is that 2000/2002 accepted setting a BTR for a &lt;BR /&gt;
non-DBR object, but newer versions consider that an error. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
-- &lt;BR /&gt;
Owen Wengerd&lt;BR /&gt;
President, ManuSoft ==&amp;gt; http://www.manusoft.com&lt;BR /&gt;
VP Americas, CADLock, Inc. ==&amp;gt; http://www.cadlock.com</description>
      <pubDate>Wed, 19 Apr 2006 05:11:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/insert-fails-on-custom-entity-derived-from-acdbblockreference/m-p/1616897#M23842</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-04-19T05:11:43Z</dc:date>
    </item>
    <item>
      <title>Re: INSERT fails on custom entity derived from AcDbBlockReference</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/insert-fails-on-custom-entity-derived-from-acdbblockreference/m-p/1616898#M23843</link>
      <description>No, the entity is not explicitly made DBR by me. The INSERT command is supposed to do that right? The "setRefBlock" function is actually called from the custom entity's "dwgInFields" function so I guess the INSERT command is cloning the custom entity present in the first drawing, as it is supposed to.</description>
      <pubDate>Wed, 19 Apr 2006 05:19:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/insert-fails-on-custom-entity-derived-from-acdbblockreference/m-p/1616898#M23843</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-04-19T05:19:34Z</dc:date>
    </item>
    <item>
      <title>Re: INSERT fails on custom entity derived from AcDbBlockReference</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/insert-fails-on-custom-entity-derived-from-acdbblockreference/m-p/1616899#M23844</link>
      <description>Could this be the problem? The custom entity sets is reference block as follows:&lt;BR /&gt;
&lt;BR /&gt;
acdbHostApplicationServices()-&amp;gt;workingDatabase()-&amp;gt;getBlockTable(pBT, AcDb::kForRead);&lt;BR /&gt;
pBT-&amp;gt;getAt(pszRefBlock, objRefId);&lt;BR /&gt;
setBlockTableRecord(objRefId);&lt;BR /&gt;
&lt;BR /&gt;
This works fine for entities created within the same drawing, but fails when I INSERT another drawing containing them. If I should do something else, what should it be? How will I know that this entity is being created by the INSERT command and not by myself? And how to get the database pointer of the source database during INSERT?</description>
      <pubDate>Wed, 19 Apr 2006 06:48:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/insert-fails-on-custom-entity-derived-from-acdbblockreference/m-p/1616899#M23844</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-04-19T06:48:02Z</dc:date>
    </item>
    <item>
      <title>Re: INSERT fails on custom entity derived from AcDbBlockReference</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/insert-fails-on-custom-entity-derived-from-acdbblockreference/m-p/1616900#M23845</link>
      <description>&amp;gt; If I should do something else, what should it be?&lt;BR /&gt;
&lt;BR /&gt;
  You should let the cloning mechanism handle this by calling &lt;BR /&gt;
AcDbBlockReference::dwgOutFields() from your object's dwgOutFields(), and &lt;BR /&gt;
AcDbBlockReference::dwgInFields() from your dwgInFields().  Nothing else &lt;BR /&gt;
should be necessary. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
-- &lt;BR /&gt;
Owen Wengerd&lt;BR /&gt;
President, ManuSoft ==&amp;gt; http://www.manusoft.com&lt;BR /&gt;
VP Americas, CADLock, Inc. ==&amp;gt; http://www.cadlock.com</description>
      <pubDate>Wed, 19 Apr 2006 16:49:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/insert-fails-on-custom-entity-derived-from-acdbblockreference/m-p/1616900#M23845</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-04-19T16:49:08Z</dc:date>
    </item>
    <item>
      <title>Re: INSERT fails on custom entity derived from AcDbBlockReference</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/insert-fails-on-custom-entity-derived-from-acdbblockreference/m-p/1616901#M23846</link>
      <description>It turns out that in 2006, the INSERT mechanism does not import the block reference into the working drawing until the custom entity is made database resident. Replacing acdbHostApplicationServices()-&amp;gt;workingDatabase() with AcDbObject::database() solved the problem.&lt;BR /&gt;
&lt;BR /&gt;
Thanks for the help.</description>
      <pubDate>Thu, 20 Apr 2006 04:17:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/insert-fails-on-custom-entity-derived-from-acdbblockreference/m-p/1616901#M23846</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-04-20T04:17:33Z</dc:date>
    </item>
    <item>
      <title>Re: INSERT fails on custom entity derived from AcDbBlockReference</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/insert-fails-on-custom-entity-derived-from-acdbblockreference/m-p/1616902#M23847</link>
      <description>Anyone who knows how I can read geometry information from a AcDbBlockReference?</description>
      <pubDate>Thu, 24 May 2007 09:54:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/insert-fails-on-custom-entity-derived-from-acdbblockreference/m-p/1616902#M23847</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-05-24T09:54:28Z</dc:date>
    </item>
  </channel>
</rss>

