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

exported hatch patterns do't appear in acad
exported hatch patterns do't appear in acad
we export hatch patterns (beside other things) using dwgdirect. as we learned, the pattern gets stored in a <patname>.pat file instead of the hatch entity (unlike opendwg).
the only problem is that when autocad reads these files the hatch patterns are not shown.
in order to make them appear we have to explode the blocks containing the hatches, then select the hatches (one by one...) and manually adjust something to make the pattern appear (e.g. adjusting the pattern angle is efficient but nothing happens when the color or layer getts changed...)
i copy part of the code here:
hatch->setpattern (oddbhatch::kcustomdefined, (const char*) cname); // cname contains the name of the pattern
hatch->setpatternangle (pattern.angle);
if (!hatchpatterns.containskey (cname)) {
//creating pat file
<write the content of the pat file>
}
what did we miss or did wrong???
hatch patterns can be of 3 types: predefined (stored in acad.pat or acadiso.pat), customdefined (stored in separate .pat file with the same name as pattern and userdefined (only angle, spacing and "cross" flags are specified - no need in pattern definition).
in order to create a hatch which is displayed by autocad pattern should present in hatch entity too (scaled and rotated accordingly to hatch entity properties).
the difference between odt and dwgdirect is that pattern stored in hatch entity is calculated (scaled and rotated) by dwgdirect and in odt it is calculated manually. but to perform this dwgdirect needs access to pattern definition in the form as it is stored in .pat file.
you can use not only customdefined but predefined patterns too (no need in writing .pat file in this case).
to get definition of hatch patterns dwgdirect uses pattern manager interface (implementation can be applicaion specific).
see odwriteex sample illustrating hatch creating and using sample implementation of hatch pattern manager.
sergey slezkin
hi sergey,
thank you for the suggestions. but it needed some experimenting too...
the trick was to
1. write the pat file first
2. modify my findfile support because originally it used the base class oddbhostappservices::findfile for the pat files. and our code writes the pat file next to the dwg (and at that moment dwgdirect doesn't know where it will be - maybe it wouldn't use it even if it knew)
tibor
if you need .pat file together with .dwg it's ok. but if you need only .dwg as a result of your program you need not write .pat file.
odwriteex contains code illustrating how to make patern "known" to dwgdirect without writing .pat file.
sergey slezkin
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
回复


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

高级搜索
显示模式

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

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

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】color problem with hatch while vectorization yang686526 DirectDWG 0 2009-05-04 05:55 PM
【转帖】adding predefined type hatch yang686526 DirectDWG 0 2009-05-04 03:45 PM
【转帖】a hatch problem yang686526 DirectDWG 0 2009-05-04 03:07 PM
【转帖】[求助]win32程序打开单文档的acad程序 yang686526 ObjectARX(C++) 0 2009-04-16 02:32 PM
【转帖】[求助] menu加载 (奇怪的菜单反复)(问题已解决) yang686526 ObjectARX(C++) 0 2009-04-16 01:41 PM


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


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