![]() |
【转帖】cloning a database
cloning a database
cloning a database hi, how can i clone a database with dd 2.05.02 ? in dd 2.03.00, we were using this code: code: oddbdatabaseptr newdatabaseptr; newdatabaseptr = mcurrentoddbdatabase->wblock();but in dd 2.05.02 wblock doesn't works ( the only workaround is using wblockcloneobjects. see examples\excustobjs\drxdebugcmds.cpp, _wblockclone_func, 2517 you should clone all block table records. vladimir thanks for your advices vladimir, but i can't reproduce the same behavior between wblockcloneobjects and wblock. you say: quote: you should clone all block table records this is the code that clone layout blocktablerecord: code: oddbdatabaseptr _wblock(oddbdatabase *poddbdatabase) { oddbobjectidarray outobjids; oddbsymboltableptr oddbsymboltableptr = poddbdatabase->getblocktableid().safeopenobject(); oddbsymboltableiteratorptr oddbsymboltableiteratorptr = oddbsymboltableptr->newiterator(); for (oddbsymboltableiteratorptr->start(); !oddbsymboltableiteratorptr->done(); oddbsymboltableiteratorptr->step()) { oddbsymboltablerecordptr oddbsymboltablerecordptr = oddbsymboltableiteratorptr->getrecordid().safeopenobject(); if (oddbsymboltablerecordptr->isa() == oddbblocktablerecord::desc()) { oddbblocktablerecordptr oddbblocktablerecordptr = oddbsymboltablerecordptr; if (oddbblocktablerecordptr->islayout() == true) { outobjids.append(oddbblocktablerecordptr->objectid()); } } } oddbdatabaseptr oddbdatabaseptrret = appservices()->createdatabase(true, poddbdatabase->getmeasurement()); oddbidmappingptr pmap = oddbidmapping::createobject(); pmap->setdestdb(oddbdatabaseptrret); try { poddbdatabase->wblockcloneobjects(outobjids, oddbdatabaseptrret->getblocktableid(), *pmap, oddb::kdrcreplace); } catch(const oderror& oderror) { cstring str = oderror.description(); oddbdatabaseptrret = null; } catch(...) { oddbdatabaseptrret = null; } return oddbdatabaseptrret; }but in the destination database, i can't find modelspace entities of the source database. ca you help me ? or fix the wblock bug ? regards. indeed, cloning block table record does not clone objects. you should clone them separately. vladimir strange, because if i clone a paper space layout, all his entities are also cloned. in attachment, the result of cloning a database with oddbdatabase::wblock (dd_2.03.00.jpg) and my _wblock function (dd_2.05.02.jpg). result.dwg is the cloned database of odamfc1. it is not the same result... and you can see that paper space layout have entities. attached images (155.3 kb, 5 views) (140.4 kb, 4 views) |
所有的时间均为北京时间。 现在的时间是 11:51 AM. |