查看单个帖子
旧 2009-05-04, 07:20 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】deleted layout problem

deleted layout problem
deleted layout problem
hi.
i have problems when trying to delete and add layouts. after dwg file is opened i delete layouts (and blocks associated with layout) generated with our application and then i try to add new layouts:
oddbobjectid layoutblockid;
layoutid = db->createlayout(layoutname, &layoutblockid);
oddblayoutptr layout = layoutid.openobject(oddb::kforwrite);
assert(!layout->iserased());
db->setcurrentlayout(layoutid);
createlayout method returns without error, i get new layout, iserased method returns false. but when call to setcurrentlayout fails with error 'object was deleted'.
what can be wrong here?
regards,
dainius bekeris
can you try the version of setcurrentlayout() which takes a string?
also is m_caddb the same as *db?
oddbobjectid layoutblockid;
layoutid = db->createlayout(layoutname, &layoutblockid);
db->setcurrentlayout(layoutname);
best regards
chudomir
database is the same, it's my typing error. setcurrentlayout() with string behaves in the same way.
maybe i shall put question other way. what is correct way to delete and create some layouts? now i am deleting layout and additionally block associated with layout (usually it is '*paper_space'). maybe 'object was deleted' is about deleted block?
hi dainius,
you should use the oddbdatabase::deletelayout() function - it erases both the associated layout and the assocated block table record.
also be careful not to delete the model space or the last paperspace layout...
hope this helps
best regards
chudomir
sorry if not clear - i meant that you should not erase the block by yourself.
best regards
chudomir
thanks, now it works.
regards,
dainius
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)