查看单个帖子
旧 2009-05-04, 07:33 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】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
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)