高级会员
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
|
【转帖】explode x-ref
explode x-ref
explode x-ref
bonjour,
with acad and a drawing which have x-ref, i can "select all", "explode" and "save as" to have a new .dwg with all objects and without x-ref.
i can also add them in the manager of the x-ref.
how can i include that in odcopyex for example?
thanks
eric p.
last edited by eric pousse; 31st july 2007 at 06:45 amfff">.
so, i have tried that :
code:
oddbblocktableptr ptable = pdb->getblocktableid().safeopenobject();
oddbsymboltableiteratorptr pblkiter = ptable->newiterator();
for (pblkiter->start(); ! pblkiter->done(); pblkiter->step())
{
oddbblocktablerecordptr pblock = pblkiter->getrecordid().safeopenobject();
if (pblock->xrefstatus()!=oddb::kxrfnotanxref)
{
oddbxrefman::setoverlaid(pblock, true);
odresult merr = oddbxrefman::load(pblock);
}
}
but when i save the file, there is no change. the new dwg file is smaller, so xref are not included into it.
thanks
eric p.
hi eric,
try this:
code:
#include "dbblocktable.h"
#include "xrefman.h"
void bindxrefs(oddbdatabase* pdb)
{
odresult res;
res = oddbxrefman::loadall(pdb);
oda_assert(res);
oddbblocktableptr ptbl = pdb->getblocktableid().openobject();
oddbsymboltableiteratorptr it = ptbl->newiterator();
for(; !it->done(); it->step())
{
oddbblocktablerecordptr pblock =
it->getrecordid().openobject(oddb::kforwrite);
if(pblock->isfromexternalreference() && pblock->isresolved())
{
res = oddbxrefman::bind(pblock, true);
oda_assert(res);
}
}
}
best regards!
thank you dmitry that works... but not for all xref.
i have a principal file with 4 xref files and with this procedure only 3 xref objects are included in the principal file ???
eric p.
hi eric,
i have no idea, until i have an example.
so, i post the files.
syrv0fd000a.dwg is the principal file.
thank you.
eric p.
attached files (310.8 kb, 6 views)
hi eric,
i don't see any problem.
all xrefs you sent had loaded.
but one "sl ex pl 01 go 0 fd 100 b.dwg" is missing.
best regards!
perhaps they are all loaded but if i use your procedure "bindxrefs" and after i save the file in dxf, in the new dxf file, only 3 xrefs are included not the 4th which is not the missing xref.
thanks
eric
here is dxf that i saved after binding. it looks exactly as original and contains only unresolved external reference to "sl ex pl 01 go 0 fd 100 b.dwg".
all other (available) xref dwgs became a part of it.
attached files (147.3 kb, 2 views)
yes, it's true so that works for you, but for me, on mac os x, no.
here is the dxf file that i have after binding, with one xref not included.
your dxf file (ascii version) has a size of 1.5 mb.
mine only 1.2.
thank you.
eric
attached files (136.6 kb, 0 views)
so, i have compiled the same program on windows and, like you, i have a dxf file of 1.5 mb, with all objects of all xref files included (except the missing one).
but the size of your file is 1589757 b and mine on windows 1577768.
invisible layers are not the same.
so, there is probably a bug on mac.
i will try on linux.
eric
on linux, i have a dxf file of 1588473 b.
invisible layers are good.
so, there is a little bug on windows and a big on mac...
eric.
|