几何尺寸与公差论坛------致力于产品几何量公差标准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-06, 11:51 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】problems with creating hatch in dd1.12

problems with creating hatch in dd1.12
problems with creating hatch in dd1.12
hi,
the following code crashes in dd1.12 at setpattern,
it did not in 1.11 u1.
oddbhatchptr phatch = oddbhatch::createobject();
phatch->setassociative(true);
phatch->setpattern(oddbhatch::kpredefined , "angle");
if 'pblock->appendoddbentity(phatch);' is done before setpattern it will work ok. my guess is the phatch in above code not being in a database is causing this crash ?
// joakim elofsson
[edit:] using dd for vc2002ml
last edited by joakim elofsson; 13th october 2004 at 06:50 amfff">.

quote:
originally posted by joakim elofsson
hi,
the following code crashes in dd1.12 at setpattern,
it did not in 1.11 u1.
oddbhatchptr phatch = oddbhatch::createobject();
phatch->setassociative(true);
phatch->setpattern(oddbhatch::kpredefined , "angle");
if 'pblock->appendoddbentity(phatch);' is done before setpattern it will work ok. my guess is the phatch in above code not being in a database is causing this crash ?
// joakim elofsson
[edit:] using dd for vc2002ml
hi there,
the error occured may be because you dont have the .pat files..
the appendpattern will internally call the oddbhostappservices::findfile() to find the .pat file. if you using measurement as english/metric then it will search for acad.pat/acadiso.pat file
-----------------------
regards,
rajesh parameswaran

quote:
originally posted by joakim elofsson
my guess is the phatch in above code not being in a database is causing this crash ?
joakim, you're absolutely right.
to prevent this crash you can also call one of the following hatch members:
oddbentity::setdatabasedefaults(oddbdatabase* pdb = null);
oddbentity::copyfrom(const odrxobject* p);
sincerely yours,
george udov
i'm new to dd and found this happening in the odwriteex example. did i miss something trying to setup everything correctly, or should i fix the example sourcecode as suggested?
using visual studio..
thanks
jesper

jesper, most probably your problem is dd cannot find file acad.pat (or acadiso.pat). dd calls oddbhostappservices::findfile() to get full path to acad.pat. you can override findfile() in your oddbhostappservices inheritor.
sincerely yours,
george udov

george, thanks for fast reply. i took over findfile() as suggested, and it does actually search for a path to acad.pat. trouble is, i don't have the file - where to find it?
i have autocad lt 2004 installed, but the trytofindacad() method in the odwriteex example seem to fail finding it?
it seems like it's also trying to find paths to verdana.ttf, which i do have - guess it's installed with windows xp. did anywrite write a default oddbhostappservices class for windows (visual studio, or how am i best helped on this) ?
where can i read more on "getting started", the dwgdirect.chm is not all that helpful.. ?
thanks for listening
using a code trying to locate autocad installed on computer to get .pat file is dangerous in real application. it may work on developer's computer and will not work on your customer's computer. are you going to write in your release notes that your product requires autocad installed? redistributing "native" .pat files may cause copyright problems.
my suggestion is to create autocad's predefined patterns you need programmatically (see odwriteex sample). surely loading patterns from your own .pat files distributed with your application is safe from all points of view.
sergey slezkin
quote:
originally posted by sergey slezkin
are you going to write in your release notes that your product requires autocad installed?
no, i was just wonder what's going on in the odwriteex axample. now i realize that using hatches, acad may need a pat file..?
if you create a custom pattern and save a dwg file with hatch using it autocad will display the file correctly but if corresponding .pat file is absent the hatch will be not editable. predefined patterns will work ok because they are available to autocad from its own .pat file.
sergey slezkin
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
 


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

高级搜索
显示模式

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

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

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】one color gradient hatch yang686526 DirectDWG 0 2009-05-06 09:22 PM
【转帖】minimum requirements for creating dxf file with hatch yang686526 DirectDWG 0 2009-05-06 05:49 PM
【转帖】hatching entities yang686526 DirectDWG 0 2009-05-05 12:01 PM
【转帖】color problem with hatch while vectorization yang686526 DirectDWG 0 2009-05-04 05:55 PM
【转帖】a hatch problem yang686526 DirectDWG 0 2009-05-04 03:07 PM


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


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