![]() |
【转帖】save Dwg File Error1
save dwg file error!
save dwg file error! when i edit the dbattribedifenition in the block,save the dwg file ,jump the error:was open for write object (1809),why? please help me! the code is : code: bool cdwgviewerview::writeaduitinfo(cstring aduititem,cstring aduitinfo) { // open the block table bool isfind=false; oddbblocktableptr pblocks = getdocument()->m_pdb->getblocktableid().safeopenobject(); // get an iterator for the block table oddbsymboltableiteratorptr pblkiter = pblocks->newiterator(); // for each block in the block table for (pblkiter->start(); ! pblkiter->done(); pblkiter->step()) { // open the block oddbblocktablerecordptr pblock = pblkiter->getrecordid().safeopenobject(); // pblock->getname().c_str(); // get an entity iterator oddbobjectiteratorptr pentiter = pblock->newiterator(); // for each entity in the block for (; !pentiter->done(); pentiter->step()) { oddbattributedefinitionptr pent = oddbattributedefinition::cast(pentiter->objectid().openobject(oddb::kforwrite)); if (!pent.isnull()) { if (pent->tag()==odstring(aduititem)) { pent->settextstring(odstring(aduitinfo)); isfind=true; // break; } if (pent->tag()==odstring(aduititem+"日期")) { ctime t = ctime::getcurrenttime(); pent->settextstring(odstring(t.format("%y 年 %d 月 %b"))); isfind=true; // break; } } // dumpentity(pentiter->objectid(), os); getdocument()->onsavedocument(openingfile); } } return isfind; from developer's guide (faq) oddbdatabase::writefile() is throwing an ewasopenforwrite exception when i try to save out a dwg/dxf drawing. this error generally occurs when an object in the database was modified, and was not closed by the user (for example, if the client code retains a smart pointer to the modified object). closing the object (releasing the smart pointer) prior to calling oddbdatabase::writefile(), should fix the problem. sergey slezkin |
所有的时间均为北京时间。 现在的时间是 05:40 AM. |