<?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 setCurrentLayoutId() crashes the second time around in ObjectARX Forum</title>
    <link>https://forums.autodesk.com/t5/objectarx-forum/setcurrentlayoutid-crashes-the-second-time-around/m-p/312373#M39362</link>
    <description>Does anyone have any ideas about the following?&lt;BR /&gt;
&lt;BR /&gt;
I have a custom object derived from AcDbPolyline.  In a member function, it&lt;BR /&gt;
initially creates its own layout, sets it current, and saves the ObjectId in&lt;BR /&gt;
a member variable.  When calling the same member function a second time, it&lt;BR /&gt;
does not create another layout, of course, but when I try to set the&lt;BR /&gt;
existing one current, it crashes:  eWasOpenForWrite.  Code/pseudo-code is&lt;BR /&gt;
below.  Note:  It doesn't crash if I never go back to modelspace (i.e.&lt;BR /&gt;
comment-out ...setTilemode(1)).&lt;BR /&gt;
&lt;BR /&gt;
Thanks.&lt;BR /&gt;
&lt;BR /&gt;
bool DCSDwgInfo::setup(bool edit)&lt;BR /&gt;
{&lt;BR /&gt;
 AcDbLayout *pLayout;&lt;BR /&gt;
 AcApLayoutManager *pLayoutMan;&lt;BR /&gt;
 Acad::ErrorStatus es;&lt;BR /&gt;
&lt;BR /&gt;
 pLayoutMan=(AcApLayoutManager *)&lt;BR /&gt;
acdbHostApplicationServices()-&amp;gt;layoutManager();&lt;BR /&gt;
 if ((pLayout=pLayoutMan-&amp;gt;findLayoutNamed("dcsLayout"))==NULL)&lt;BR /&gt;
  pLayoutMan-&amp;gt;createLayout("dcsLayout",mLayoutId,mLayoutBlockTblRecId);&lt;BR /&gt;
 else&lt;BR /&gt;
 {&lt;BR /&gt;
  mLayoutId=pLayout-&amp;gt;objectId();&lt;BR /&gt;
  es=pLayout-&amp;gt;close();&lt;BR /&gt;
 }&lt;BR /&gt;
*****It crashes here*******&lt;BR /&gt;
 pLayoutMan-&amp;gt;setCurrentLayoutId(mLayoutId);&lt;BR /&gt;
&lt;BR /&gt;
*****It won't crash if I comment out this line and never go back to&lt;BR /&gt;
modelspace**********&lt;BR /&gt;
acdbHostApplicationServices()-&amp;gt;workingDatabase()-&amp;gt;setTilemode(1);&lt;BR /&gt;
&lt;BR /&gt;
**edit vertex points here**&lt;BR /&gt;
&lt;BR /&gt;
 acdbHostApplicationServices()-&amp;gt;workingDatabase()-&amp;gt;setLtscale(mScaleFactor);&lt;BR /&gt;
 acdbHostApplicationServices()-&amp;gt;workingDatabase()-&amp;gt;setPsltscale(true);&lt;BR /&gt;
 return true;&lt;BR /&gt;
}</description>
    <pubDate>Thu, 12 Sep 2002 06:26:42 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2002-09-12T06:26:42Z</dc:date>
    <item>
      <title>setCurrentLayoutId() crashes the second time around</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/setcurrentlayoutid-crashes-the-second-time-around/m-p/312373#M39362</link>
      <description>Does anyone have any ideas about the following?&lt;BR /&gt;
&lt;BR /&gt;
I have a custom object derived from AcDbPolyline.  In a member function, it&lt;BR /&gt;
initially creates its own layout, sets it current, and saves the ObjectId in&lt;BR /&gt;
a member variable.  When calling the same member function a second time, it&lt;BR /&gt;
does not create another layout, of course, but when I try to set the&lt;BR /&gt;
existing one current, it crashes:  eWasOpenForWrite.  Code/pseudo-code is&lt;BR /&gt;
below.  Note:  It doesn't crash if I never go back to modelspace (i.e.&lt;BR /&gt;
comment-out ...setTilemode(1)).&lt;BR /&gt;
&lt;BR /&gt;
Thanks.&lt;BR /&gt;
&lt;BR /&gt;
bool DCSDwgInfo::setup(bool edit)&lt;BR /&gt;
{&lt;BR /&gt;
 AcDbLayout *pLayout;&lt;BR /&gt;
 AcApLayoutManager *pLayoutMan;&lt;BR /&gt;
 Acad::ErrorStatus es;&lt;BR /&gt;
&lt;BR /&gt;
 pLayoutMan=(AcApLayoutManager *)&lt;BR /&gt;
acdbHostApplicationServices()-&amp;gt;layoutManager();&lt;BR /&gt;
 if ((pLayout=pLayoutMan-&amp;gt;findLayoutNamed("dcsLayout"))==NULL)&lt;BR /&gt;
  pLayoutMan-&amp;gt;createLayout("dcsLayout",mLayoutId,mLayoutBlockTblRecId);&lt;BR /&gt;
 else&lt;BR /&gt;
 {&lt;BR /&gt;
  mLayoutId=pLayout-&amp;gt;objectId();&lt;BR /&gt;
  es=pLayout-&amp;gt;close();&lt;BR /&gt;
 }&lt;BR /&gt;
*****It crashes here*******&lt;BR /&gt;
 pLayoutMan-&amp;gt;setCurrentLayoutId(mLayoutId);&lt;BR /&gt;
&lt;BR /&gt;
*****It won't crash if I comment out this line and never go back to&lt;BR /&gt;
modelspace**********&lt;BR /&gt;
acdbHostApplicationServices()-&amp;gt;workingDatabase()-&amp;gt;setTilemode(1);&lt;BR /&gt;
&lt;BR /&gt;
**edit vertex points here**&lt;BR /&gt;
&lt;BR /&gt;
 acdbHostApplicationServices()-&amp;gt;workingDatabase()-&amp;gt;setLtscale(mScaleFactor);&lt;BR /&gt;
 acdbHostApplicationServices()-&amp;gt;workingDatabase()-&amp;gt;setPsltscale(true);&lt;BR /&gt;
 return true;&lt;BR /&gt;
}</description>
      <pubDate>Thu, 12 Sep 2002 06:26:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/setcurrentlayoutid-crashes-the-second-time-around/m-p/312373#M39362</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2002-09-12T06:26:42Z</dc:date>
    </item>
    <item>
      <title>Re: setCurrentLayoutId() crashes the second time around</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/setcurrentlayoutid-crashes-the-second-time-around/m-p/312374#M39363</link>
      <description>cadman,&lt;BR /&gt;
&lt;BR /&gt;
Try to put the assertWriteEnabled() call at the beginning of your&lt;BR /&gt;
DCSDwgInfo::setup() function.&lt;BR /&gt;
&lt;BR /&gt;
Also, to do this, your object must be opened for write, is it opened?&lt;BR /&gt;
&lt;BR /&gt;
Regards,&lt;BR /&gt;
Fernando.&lt;BR /&gt;
&lt;BR /&gt;
"cadman" &lt;CADMAN&gt; wrote in message&lt;BR /&gt;
news:86D8EC84EB1571A92F057A4B8B2951FC@in.WebX.maYIadrTaRb...&lt;BR /&gt;
&amp;gt; Does anyone have any ideas about the following?&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; I have a custom object derived from AcDbPolyline.  In a member function,&lt;BR /&gt;
it&lt;BR /&gt;
&amp;gt; initially creates its own layout, sets it current, and saves the ObjectId&lt;BR /&gt;
in&lt;BR /&gt;
&amp;gt; a member variable.  When calling the same member function a second time,&lt;BR /&gt;
it&lt;BR /&gt;
&amp;gt; does not create another layout, of course, but when I try to set the&lt;BR /&gt;
&amp;gt; existing one current, it crashes:  eWasOpenForWrite.  Code/pseudo-code is&lt;BR /&gt;
&amp;gt; below.  Note:  It doesn't crash if I never go back to modelspace (i.e.&lt;BR /&gt;
&amp;gt; comment-out ...setTilemode(1)).&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Thanks.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; bool DCSDwgInfo::setup(bool edit)&lt;BR /&gt;
&amp;gt; {&lt;BR /&gt;
&amp;gt;  AcDbLayout *pLayout;&lt;BR /&gt;
&amp;gt;  AcApLayoutManager *pLayoutMan;&lt;BR /&gt;
&amp;gt;  Acad::ErrorStatus es;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;  pLayoutMan=(AcApLayoutManager *)&lt;BR /&gt;
&amp;gt; acdbHostApplicationServices()-&amp;gt;layoutManager();&lt;BR /&gt;
&amp;gt;  if ((pLayout=pLayoutMan-&amp;gt;findLayoutNamed("dcsLayout"))==NULL)&lt;BR /&gt;
&amp;gt;   pLayoutMan-&amp;gt;createLayout("dcsLayout",mLayoutId,mLayoutBlockTblRecId);&lt;BR /&gt;
&amp;gt;  else&lt;BR /&gt;
&amp;gt;  {&lt;BR /&gt;
&amp;gt;   mLayoutId=pLayout-&amp;gt;objectId();&lt;BR /&gt;
&amp;gt;   es=pLayout-&amp;gt;close();&lt;BR /&gt;
&amp;gt;  }&lt;BR /&gt;
&amp;gt; *****It crashes here*******&lt;BR /&gt;
&amp;gt;  pLayoutMan-&amp;gt;setCurrentLayoutId(mLayoutId);&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; *****It won't crash if I comment out this line and never go back to&lt;BR /&gt;
&amp;gt; modelspace**********&lt;BR /&gt;
&amp;gt; acdbHostApplicationServices()-&amp;gt;workingDatabase()-&amp;gt;setTilemode(1);&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; **edit vertex points here**&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
acdbHostApplicationServices()-&amp;gt;workingDatabase()-&amp;gt;setLtscale(mScaleFactor);&lt;BR /&gt;
&amp;gt;  acdbHostApplicationServices()-&amp;gt;workingDatabase()-&amp;gt;setPsltscale(true);&lt;BR /&gt;
&amp;gt;  return true;&lt;BR /&gt;
&amp;gt; }&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;/CADMAN&gt;</description>
      <pubDate>Thu, 12 Sep 2002 06:57:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/setcurrentlayoutid-crashes-the-second-time-around/m-p/312374#M39363</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2002-09-12T06:57:55Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/setcurrentlayoutid-crashes-the-second-time-around/m-p/312375#M39364</link>
      <description>Fernando,&lt;BR /&gt;
&lt;BR /&gt;
Yes, I am doing both of these (actually, I put assertWriteEnabled() in after&lt;BR /&gt;
I posted the problem, and acdbOpenObject(...) is called by the calling&lt;BR /&gt;
function).  I am wondering if the AcDbLayout object is somehow been left&lt;BR /&gt;
open for writing?  Also, is there a way to tell *which* object&lt;BR /&gt;
eWasOpenForWrite?&lt;BR /&gt;
&lt;BR /&gt;
Thanks again.&lt;BR /&gt;
&lt;BR /&gt;
"Fernando Malard" &lt;FPMALARD&gt; wrote in message&lt;BR /&gt;
news:8F8240B010FF94CCE29F0319DC13574D@in.WebX.maYIadrTaRb...&lt;BR /&gt;
&amp;gt; cadman,&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Try to put the assertWriteEnabled() call at the beginning of your&lt;BR /&gt;
&amp;gt; DCSDwgInfo::setup() function.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Also, to do this, your object must be opened for write, is it opened?&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Regards,&lt;BR /&gt;
&amp;gt; Fernando.&lt;BR /&gt;
&amp;gt;&lt;/FPMALARD&gt;</description>
      <pubDate>Thu, 12 Sep 2002 12:44:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/setcurrentlayoutid-crashes-the-second-time-around/m-p/312375#M39364</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2002-09-12T12:44:09Z</dc:date>
    </item>
  </channel>
</rss>

