几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量

几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 (http://www.dimcax.com/hust/index.php)
-   DirectDWG (http://www.dimcax.com/hust/forumdisplay.php?f=89)
-   -   【转帖】dimension explode example (http://www.dimcax.com/hust/showthread.php?t=15706)

yang686526 2009-05-04 07:33 PM

【转帖】dimension explode example
 
dimension explode example
dimension explode example
hi
i basicly uses dwgdirect to convert dwg files to dxf-files. i have no expierience in using the database system. now i need to explode entities of type dimension to the basic elements line, arc and text (or mtext), which will be easier to read.
has anyone an example i can use: how to walk through all entities, find dimension, explode dimension, save the exploded entities to the database, so that i can save it with the dxf file including the exploded dimension's.
laurs
the code below loops through all entities in all blocks which are not anonimous and not xref and explodes all dimensions.
code:
oddbblocktableptr pblocktable = pdb->getblocktableid().safeopenobject();
oddbsymboltableiteratorptr pblockiter = pblocktable->newiterator();
while (!pblockiter->done())
{
oddbblocktablerecordptr pblocktablerecord = pblockiter->getrecord(oddb::kforwrite);
if ( !pblocktablerecord->isanonimous()
&& !pblocktablerecord->isfromexternalreference())
{
oddbobjectiteratorptr pentiter = pblocktablerecord->newiterator();
while (!pentiter->done())
{
oddbentityptr pent = pentiter->entity();
pentiter->step();
if (pent->iskindof(oddbdimension::desc()))
{
pent->upgradeopen(); // it was open for read
if (pent->explodetoblock(pblocktablerecord) == eok)
{
pent->erase();
}
}
}
}
pblockiter->step();
}
sergey slezkin
hi sergey
thanks, it is running (after isanonimous() was changed to isanonymous())
i know have a fundament to do other changes.
best regards
laurs
hi sergey
thanks, it is running (after isanonimous() was changed to isanonymous())
i now have a fundament to do other changes.
best regards
laurs


所有的时间均为北京时间。 现在的时间是 11:30 AM.