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

yang686526 2009-05-05 09:47 AM

【转帖】error when reading text data
 
error when reading text data
error when reading text data
hi
i am trying to read the text data values from a block. i have been looking at the oddbtext object and can see a method named textstring(). but i got the assertion error. please help me to solve the issue.
the function for reading text data
void dumpblocks(oddbdatabase *pdb)
{
oddbblocktableptr ptable = pdb->getblocktableid().safeopenobject();
oddbsymboltableiteratorptr pblkiter = ptable->newiterator();
for (pblkiter->start(); ! pblkiter->done(); pblkiter->step())
{
oddbblocktablerecordptr pblock = pblkiter->getrecordid().safeopenobject();
oddbobjectiteratorptr pentiter = pblock->newiterator();
for (; !pentiter->done(); pentiter->step())
{
dumpentity(pentiter->objectid());
}}
void dumpentity(oddbobjectid id)
{
oddbentityptr pent = id.safeopenobject();
oddbtextptr ptext = pent;
ptext->textstring();
}
is any other object / method is available for reading text data....
please provide any example...
code:
void dumpentity(oddbobjectid id)
{
oddbentityptr pent = id.safeopenobject(); // here you may get exception if entity is erased
oddbtextptr ptext = pent; // here you may get exception if entity is not oddbtext
ptext->textstring();
}this is more safe
code:
void dumpentity(oddbobjectid id)
{
oddbentityptr pent = id.openobject();
oddbtextptr ptext = oddbtext::cast(pent);
if (!ptext.isnull())
{
ptext->textstring();
}
}
sergey slezkin


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