高级会员
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
|
【转帖】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.
|