几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量  


返回   几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 » 仿射空间:CAX软件开发(三)二次开发与程序设计 » CAD二次开发 » AutoCAD二次开发 » DirectDWG
用户名
密码
注册 帮助 会员 日历 银行 搜索 今日新帖 标记论坛为已读


 
 
主题工具 搜索本主题 显示模式
旧 2009-05-05, 09:45 AM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】error pdb-settextstyle90 with shx fon

error pdb->settextstyle() with shx font
error pdb->settextstyle() with shx font
i create text styles as per dwgdirect dbfiller.cpp example.
some styles use ttf, some use shx.
however, pdb->settextstyle() gives assert if i try to set current text style as a style that uses shx font.
pdb->settextstyle() works if i try to set current text style as a style that uses ttf font.
in other words: setting shx style as current causes exception in dwgdirect (style validator fails with style not found in the style table).
please advise if this is a bug or if i am doing something wrong.
relevant code:
code:
oddbtextstyletablerecordptr pdesttextstyle; //= null;
oddbobjectid desttextstyleid = pdesttextstyles->getat(textdef->getname().getstring());
if(desttextstyleid)
{
pdesttextstyle = desttextstyleid.safeopenobject(oddb::kforwrite);
}
else
{
pdesttextstyle = oddbtextstyletablerecord::createobject();
// from dbfiller.cpp: "name must be set before a table object is added to a table. the
// isshapefile flag must also be set (if true) before adding the object
// to the database."
pdesttextstyle->setname(textdef->getname().getstring());
if (textdef->getfontname().right(4) == _t(".shx"))
{
pdesttextstyle->setisshapefile(true);
}
// add the object to the table.
desttextstyleid = pdesttextstyles->add(pdesttextstyle);
}
assert(!pdesttextstyle.isnull());
// set the remaining properties.
if (!pdesttextstyle.isnull())
{
pdesttextstyle->settextsize(pdoc->modelunitstoworldunits(modelspace_index, textdef->getheight()));
pdesttextstyle->setxscale(textdef->getwidthfactor());
pdesttextstyle->setpriorsize(pdoc->getcurrenttextheight());
pdesttextstyle->setobliquingangle(textdef->getescapement());
pdesttextstyle->setisbackwards(textdef->getbackwards());
pdesttextstyle->setisupsidedown(textdef->getupsidedown());
pdesttextstyle->setfilename(textdef->getfontname().getstring());
if (!pdesttextstyle->isshapefile())
pdesttextstyle->setfont(textdef->getfontname().getstring(), textdef->getbold(), textdef->getitalic(), 0, 0);
// set current text style
// jh 3/4/2008 - setting shx style as current causes exception in dwgdirect (style validator fails with style not foudn in the style table)!!!
if (textdef->gethandle() == pdoc->getcurrenttextstylehandle() && !pdesttextstyle->isshapefile())
pdb->settextstyle(desttextstyleid);
hello james,
i think you needn't set this "pdesttextstyle->setisshapefile(true);". this property is used for indicate that file in style contain shapes and this style not may be set as default. shape is not usual font file and symbols may be used for example in linetype.
best regards,
sergey z.
thanks sergey
i remove pdesttextstyle->setisshapefile(true) for shx styles that are not ltypeshp.shx, gdt.shx etc.
however i have another related problem. if i save/write text styles using the code above, i get these messages when i load the drawing in autocad 2002:
substituting [simplex.shx] for [romans.shx].
substituting [simplex.shx] for [symusic.shx].
and the text using these styles is drawn using simplex.shx font.
however if i look in autocad 2002 "text styles" dialog, the styles still say they are using romans.shx and symusic.shx.
any idea why autocad is not "recognising" the text styles as using shx font?
thanks
- james
hell james,
could you attach your drawing?
best regards,
sergey z.
here are attached drawings:
f34_126.dwg is the "original" input drawing.
f34_126a.dwg and f34_126a.dxf are the drawings i save/write using dwgdirect.
they should all be dwg 2000 format.
attached files (32.9 kb, 3 views)
(6.6 kb, 1 views)
(21.1 kb, 1 views)

hello james,
use pdesttextstyle->setname() for setting sxh font to text style and use pdesttextstyle->setfont() for setting ttf font to text style.
i think you remove pdesttextstyle->setisshapefile(true); but doen't change code below
if (!pdesttextstyle->isshapefile())
pdesttextstyle->setfont(textdef->getfontname().getstring(), textdef->getbold(), textdef->getitalic(), 0, 0);
quote:
originally posted by james higgs;
however if i look in autocad 2002 "text styles" dialog, the styles still say they are using romans.shx and symusic.shx.
see more carefully "font style:" popup list is accessible ( for shx font acad make it dissable).
best regards,
sergey z.
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
 


主题工具 搜索本主题
搜索本主题:

高级搜索
显示模式

发帖规则
不可以发表新主题
不可以回复主题
不可以上传附件
不可以编辑您的帖子

vB 代码开启
[IMG]代码开启
HTML代码关闭

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】bigfont.shx font file doesnot to get called with library u yang686526 DirectDWG 0 2009-05-04 04:42 PM
【转帖】applying shx textstyle yang686526 DirectDWG 0 2009-05-04 04:06 PM
【转帖】a strange shx font name yang686526 DirectDWG 0 2009-05-04 03:17 PM
【转帖】求助:将字体文件.shx反编译成.shp文件(已应助) yang686526 数据库ObjectDBX 0 2009-04-28 03:07 PM
求助:将字体文件.shx反编译成.shp文件(已应助) yang686526 ObjectARX(AutoLISP) 0 2009-04-27 10:23 AM


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


于2004年创办,几何尺寸与公差论坛"致力于产品几何量公差标准GD&T | GPS研究/CAD设计/CAM加工/CMM测量"。免责声明:论坛严禁发布色情反动言论及有关违反国家法律法规内容!情节严重者提供其IP,并配合相关部门进行严厉查处,若內容有涉及侵权,请立即联系我们QQ:44671734。注:此论坛须管理员验证方可发帖。
沪ICP备06057009号-2
更多