几何尺寸与公差论坛------致力于产品几何量公差标准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)
-   ObjectARX(C++) (http://www.dimcax.com/hust/forumdisplay.php?f=34)
-   -   【转帖】试图更改cad文件中数字标注内容时出错(附源码) (http://www.dimcax.com/hust/showthread.php?t=8060)

yang686526 2009-04-18 07:26 PM

【转帖】试图更改cad文件中数字标注内容时出错(附源码)
 
试图更改cad文件中数字标注内容时出错(附源码)
试图更改cad文件中数字标注内容时出错(附源码)
试图更改cad文件中数字标注内容时出错,源码如下:
//打开数据库
acdbblocktable *pblocktable;
acdbhostapplicationservices()->workingdatabase()->getblocktable(pblocktable,acdb::kforwrite);
acdbblocktablerecord *pblocktablerecord;
pblocktable->getat(acdb_model_space,pblocktablerecord,acdb::kforwrite);
pblocktable->close();
afxmessagebox("open model space");
//创建块表记录遍历器,用遍历器遍历实体,并修改标注值。
acdbrotateddimension *pdimention;
char* texttemp;
achar* astr;
astr="111";
acdbblocktablerecorditerator *pblockiterator;
pblocktablerecord->newiterator(pblockiterator);
for(pblockiterator->start();!pblockiterator->done();pblockiterator->step())
{
acdbentity *pentity;
pblockiterator->getentity(pentity,acdb::kforwrite);
const char *pcname=pentity->isa()->name();
if(strcmp(pcname,"acdbrotateddimension")==0)
{
pdimention=acdbrotateddimension::cast(pentity);
texttemp=pdimention->dimensiontext();
if(strcmp(texttemp,"e")==0)
{
afxmessagebox("found linedim");
pdimention->setdimensiontext(astr);
}
}
}
delete pblockiterator;
pblocktablerecord->close();
是不是cad文件在打开时,不能用arx修改实体。
期盼高手指点!!!
搞定了,实体没有关闭的缘故


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