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

yang686526 2009-05-06 10:57 PM

【转帖】problem reading textstyle
 
problem reading textstyle
problem reading textstyle
hi, i use following code to read textstyle of the attached file:
oddbdimstyletablerecordptr ptroddimstyle; //1line
......
oddbhardpointerid txtstyleid = ptroddimstyle->dimtxsty(); //2line
oddbtextstyletablerecordptr ptrtextstyle = txtstyleid.openobject();//3line
......
when running to 3line(above), the program throws a exception "not that kind of class". why? whether there are some problem in my code or the file has wrong information?
btw, acad can open this file.
attached files
in the file attached dimension style standard has incorrect text style reference which points not to text style but to dimstyletable.
so the pointer (to dimstyletable) can't be cast to text style pointer.
you can use:
code:
oddbobjectid txtstyleid = ptroddimstyle->dimtxsty();
oddbobjectptr ptrobj = txtstyleid.openobject();
oddbtextstyletablerecordptr ptrtextstyle = oddbtextstyletablerecord::cast(ptrobj);
if (ptrtextstyle.isnull())
....
btw, dwgdirect's recover finds and fixes this problem.
sergey slezkin
thanks, sergey.
it works now.


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