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

a hatch problem
a hatch problem
here i have a hatch probelm, it cannot export the hatch line correctly. the following is my code to export a hatch. in the following code i used the real value in debugging to replace the paremeters:
oddbhatchptr phatch = oddbhatch::createobject( );
odhatchpattern hatchptn;
pdb->appservices()->patternmanager()->appendpattern (oddbhatch::kuserdefined, patternname,hatchptn);
phatch->setpattern( oddbhatch::kuserdefined, patternname );
phatch->setassociative( false );
phatch->setelevation( 0 );
phatch->setpixelsize( 0.0 );
phatch->setpatterndouble( false );
.......
phatch->appendloop(oddbhatch::kpolyline,vertexpts, vertexbulges);
phatch->sethatchstyle( oddbhatch::knormal );
phatch->setpatternangle( 0.0 ); // in the attachment case, this angle is
// 0, so i use 0 directly here, it is to say
//that the pattern in this hatch isn't rotated, it is right?
phatch->setpatternspace( dspace );
phatch->setpatterndouble( false );
odhatchpatternline hatchline; //create the hatch line
hatchline.m_dlineangle = pi/4.0; //in the attachment case, this angle
//is pi/4, so here i use this value directly
hatchline.m_basepoint.set(0.0, 0.6);
hatchline.m_patternoffset.set(0.0, 3.0);
hatchptn.append( hatchline );
pblock->appendoddbentity( phatch );
in this case, i need the angle between the hatch line and the horizon is pi/4 . but open the attachment file in autocad, we can see the hatch line is horizontal. in these code i must do somethings error or miss doing something, but i can't find out them.
thanks for your help!
attached files
1. user defined pattern is completely described by angle, spacing and cross flag. it can represent only simple hatching.
pattern definition is used only for predefined and custom hatches.
2. you need to add pattern definition lines to pattern before appending pattern to pattern manager.
sergey slezkin
a hatch problem
quote:
originally posted by sergey slezkin
1. user defined pattern is completely described by angle, spacing and cross flag. it can represent only simple hatching.
pattern definition is used only for predefined and custom hatches.
2. you need to add pattern definition lines to pattern before appending pattern to pattern manager.
hi, sergey,
from your reply, i have modified code to add pattern definition lines to pattern before appending pattern to pattern manager. here i have several questions also need your help.
"pattern definition is used only for predefined and custom hatches.", do you mean that a user defined hatch doesn't need a hatch pattern?
in a hatch, there has two angle parameters: pattern angle(set by setpatternangle) fff"> and hatch line angle(stored in odhatchpatternline.m_dlineangle)fff">. i think that in the hatch entity(not in a hatch pattern), the angle between hatch line and the horizon should be equal to (pattern angle)+(hatch line angle)fff">, is it right?
i found that in my application: firstlyfff"> exporting a hatch with a named pattern e.g. "normal", thenfff"> modifying the hatch line angle in the pattern, and then fff"> exporting the hatch again, the data gotten are the latest data and assigned to the hatch pattern, but in autocad the angle between hatch line and the horizon is not changed. i used retrievepattern() to get the pattern to see the data, it showed that the pattern still contained the old data. but after fff"> modifying the pattern name, the new pattern angle fff"> will be used. i think the reason maybe is that the secod pattern can't overwrite the same named pattern e.g. "normal" which has existed in pattern manager, dd always uses the first pattern data to export the hatch. so here i have another several questions : what i think is right? if it's right, what can i do to avoid this case? is our responsibility to update the data contained in pattern if we modified the pattern data?
best regards
user defined hatch does not need pattern definition.
in hatch where is only one angle - overall pattern rotation. pattern definition may contain multiple lines with individual angle each. the resulting angle is equal to hatch line angle in pattern plus pattern rotation.
pattern names must be unique. if you replace pattern definition after a hatch entity with this pattern is already created in general the result is unpredictable. to be sure that new definition has effect you need to call phatch->setpattern() once more.
sergey slezkin
quote:
originally posted by sergey slezkin
user defined hatch does not need pattern definition.
in hatch where is only one angle - overall pattern rotation. pattern definition may contain multiple lines with individual angle each. the resulting angle is equal to hatch line angle in pattern plus pattern rotation.
pattern names must be unique. if you replace pattern definition after a hatch entity with this pattern is already created in general the result is unpredictable. to be sure that new definition has effect you need to call phatch->setpattern() once more.
how can we delete a hatch pattern having been existed in pattern manager. the is no function in pattern manager to do this.
it's impossible to delete pattern.
sergey slezkin
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
回复


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

高级搜索
显示模式

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

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

相似的主题
主题 主题发起者 论坛 回复 最后发表
用c#怎么填充hatch,高手给段代码吧!!谢谢 yang686526 ObjectARX(VB.NET/C#) 0 2009-04-21 05:09 PM
【转帖】hatch的面积? yang686526 ObjectARX(VB.NET/C#) 0 2009-04-20 11:21 AM
【转帖】vista and addin dll problem yang686526 SolidWorks二次开发 0 2009-04-13 03:19 PM
【转帖】pdm problem yang686526 SolidWorks二次开发 0 2009-04-13 01:20 PM


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


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