Message 1 of 3
setCurrentLayoutId() crashes the second time around
Not applicable
09-11-2002
11:26 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Does anyone have any ideas about the following?
I have a custom object derived from AcDbPolyline. In a member function, it
initially creates its own layout, sets it current, and saves the ObjectId in
a member variable. When calling the same member function a second time, it
does not create another layout, of course, but when I try to set the
existing one current, it crashes: eWasOpenForWrite. Code/pseudo-code is
below. Note: It doesn't crash if I never go back to modelspace (i.e.
comment-out ...setTilemode(1)).
Thanks.
bool DCSDwgInfo::setup(bool edit)
{
AcDbLayout *pLayout;
AcApLayoutManager *pLayoutMan;
Acad::ErrorStatus es;
pLayoutMan=(AcApLayoutManager *)
acdbHostApplicationServices()->layoutManager();
if ((pLayout=pLayoutMan->findLayoutNamed("dcsLayout"))==NULL)
pLayoutMan->createLayout("dcsLayout",mLayoutId,mLayoutBlockTblRecId);
else
{
mLayoutId=pLayout->objectId();
es=pLayout->close();
}
*****It crashes here*******
pLayoutMan->setCurrentLayoutId(mLayoutId);
*****It won't crash if I comment out this line and never go back to
modelspace**********
acdbHostApplicationServices()->workingDatabase()->setTilemode(1);
**edit vertex points here**
acdbHostApplicationServices()->workingDatabase()->setLtscale(mScaleFactor);
acdbHostApplicationServices()->workingDatabase()->setPsltscale(true);
return true;
}
I have a custom object derived from AcDbPolyline. In a member function, it
initially creates its own layout, sets it current, and saves the ObjectId in
a member variable. When calling the same member function a second time, it
does not create another layout, of course, but when I try to set the
existing one current, it crashes: eWasOpenForWrite. Code/pseudo-code is
below. Note: It doesn't crash if I never go back to modelspace (i.e.
comment-out ...setTilemode(1)).
Thanks.
bool DCSDwgInfo::setup(bool edit)
{
AcDbLayout *pLayout;
AcApLayoutManager *pLayoutMan;
Acad::ErrorStatus es;
pLayoutMan=(AcApLayoutManager *)
acdbHostApplicationServices()->layoutManager();
if ((pLayout=pLayoutMan->findLayoutNamed("dcsLayout"))==NULL)
pLayoutMan->createLayout("dcsLayout",mLayoutId,mLayoutBlockTblRecId);
else
{
mLayoutId=pLayout->objectId();
es=pLayout->close();
}
*****It crashes here*******
pLayoutMan->setCurrentLayoutId(mLayoutId);
*****It won't crash if I comment out this line and never go back to
modelspace**********
acdbHostApplicationServices()->workingDatabase()->setTilemode(1);
**edit vertex points here**
acdbHostApplicationServices()->workingDatabase()->setLtscale(mScaleFactor);
acdbHostApplicationServices()->workingDatabase()->setPsltscale(true);
return true;
}