几何尺寸与公差论坛------致力于产品几何量公差标准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)
-   -   【转帖】exploding entities recursively crashes (http://www.dimcax.com/hust/showthread.php?t=16202)

yang686526 2009-05-05 10:18 AM

【转帖】exploding entities recursively crashes
 
exploding entities recursively crashes.
exploding entities recursively crashes.
when i use the following code in order to recursively explode all the entities in a file,
the program crashes when exploding some explodable entities into some block references not when exploding the block references (it seems to me as if it happens when the entities contain some kind of text, like aligned dimensions).
this is the code:
//************************************************** ************************
theapp.pdb = theapp.readfile
(strfilename);
oddbblocktableptr pblocks = theapp.pdb
->getblocktableid().safeopenobject();
oddbsymboltableiteratorptr pblkiter = pblocks
->newiterator();
for (pblkiter->start(); ! pblkiter->done();
pblkiter->step())
{
oddbblocktablerecordptr pblock = pblkiter
->getrecordid().safeopenobject();
if(theapp.pdb->getmodelspaceid() == pblkiter
->getrecordid())
{
oddbobjectiteratorptr pentiter = pblock
->newiterator();
oddbblockreferenceptr pblockreference;
for (; !pentiter->done(); pentiter->step())
{
oddbentityptr pentity = pentiter->entity();
recursivelyexplode(pentity);
}
}
}
//************************************************** ************************
void recursivelyexplode(oddbentity* pentity)
{
oddbvoidptrarray pvoidentity;
odresult odres;
odres = pentity->explode(pvoidentity);
if(odres != eok)
{
loadnonexplodableentity(pentity);
return;
}
oddbentityptr pentityaux;
int index=1;
int sizearray=0;
sizearray = pvoidentity.size();
while(index <= sizearray)
{
pentityaux = pvoidentity[index-1];
recursivelyexplode(pentityaux);
index++;
}
}
recursively exploding block references.
has this problem been resolved? i just had a problem recursively exploding block references.
void dumpblockref(oddbblockreferenceptr pblockref)
{
int numentities, i;
if (pblockref.isnull())
{
}
else
{
oddbvoidptrarray entityset;
pblockref->explode(entityset);
numentities = entityset.size();
for (i=0; i < numentities; i++)
{
oddbentityptr pent = entityset[i];
dumpallentities(pent);
}
}
void dumpallentities(oddbentityptr pent)
{
if (pent->iskindof(oddbblockreference::desc()))
{
oddbblockreferenceptr pblockref = oddbblockreference::cast(pent);
dumpblockref(pblockref);
}
}
last edited by rauli; 13th january 2004 at 12:09 pmfff">.


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