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

the hatch line is too sparse
the hatch line is too sparse
here i have a problem about hatch: the hatch line in autocad 2004 is more sparse than in my application.
here have two attachment files: hatch.bmp shows the look of this hatch in my application. the drawing2.dwg is the file exported from my application. now i use dd 1.10 update 1. opening this file in autocad, we can see that the hacth line in autocad is more sparse than in my application.
there also has a dimension in the drawing to show the distance between parallel hatch lines. we can see the distance( value is 1.0339) between two parallel hatch lines is not equal to the hatch pattern spacing value( it is 5mm in my application, now unit is mm).
what does cause this difference?
the following is my code:
// create hatch
oddbhatchptr phatch = oddbhatch::createobject( );
phatch->setcolorindex( entcolor );
phatch->setassociative( false );
phatch->setpixelsize( 0.0 );
phatch->sethatchstyle( oddbhatch::knormal );
phatch->setpatternangle( 0.0 );
phatch->setpatternspace( 5.0 ); //now unit is mm
phatch->setpatterndouble( false );
if( oddb::kenglish == pdb->getmeasurement() )
pdb->appservices()->patternmanager()->appendpattern(oddbhatch::kcustomdefined, patternname,hatchptn);
else if( oddb::kmetric == pdb->getmeasurement() )
pdb->appservices()->patternmanager()->appendpattern(oddbhatch::kcustomdefined, patternname,hatchptn,oddb::kmetric);
else
assert( 0 );
odhatchpattern hatchptn;
......... //fill hatch pattern
phatch->setpattern( oddbhatch::kcustomdefined, "normal");
pblock->appendoddbentity( phatch );
attached images
i loaded your file into ac2004 and into odamfcapp and i see exactly the same result which is different from bmp you posted.
the distance between hatch lines is the same as dimension shows (1.0399)
why not 5? because pattern spacing is used only for userdefined hatch. for user defined hatch no pattern is required. it's completely described by angle, spacing and cross flag.
if hatch is custom defined autocad needs .pat file with the same name as hatch pattern to be able to modify the hatch. if such .pat file is absent, hatch is not editable in autocad. so i would recommend to always use user defined hatch if it's possible (if pattern is simple).
pattern spacing is used only for user defined hatches. pattern scale - only for custom defined and predefined. actually spacing and scale are stored in the same variable (dxf code 41 - pattern scale or spacing)
so in your case the spacing used is the value defined in your pattern definition multiplied by 5.
sergey slezkin
the hatch line is too sparse
quote:
originally posted by sergey slezkin
i loaded your file into ac2004 and into odamfcapp and i see exactly the same result which is different from bmp you posted.
the distance between hatch lines is the same as dimension shows (1.0399)
why not 5? because pattern spacing is used only for userdefined hatch. for user defined hatch no pattern is required. it's completely described by angle, spacing and cross flag.
if hatch is custom defined autocad needs .pat file with the same name as hatch pattern to be able to modify the hatch. if such .pat file is absent, hatch is not editable in autocad. so i would recommend to always use user defined hatch if it's possible (if pattern is simple).
pattern spacing is used only for user defined hatches. pattern scale - only for custom defined and predefined. actually spacing and scale are stored in the same variable (dxf code 41 - pattern scale or spacing)
so in your case the spacing used is the value defined in your pattern definition multiplied by 5.
hi,
thanks for your reply!
here i still have a question about hatch line. e.g, the distance between parellel hatch lines is 1.0399 shown as in my last post , and the hatch pattern scale is 5 in hatch pattern , then 1.0399/5 = 0.20798, where is the value from? if it(0.20798) is generated by dd, would you like to tell me which numbers(e.g. in hatch pattern or somewhere else) are used to calculate this value?
also, if a hatch need two cross hatch lines, but the cross angle is not equal to pi/2, for this hatch need we create a hatch pattern(in other words, this hatch should be custom defined(i cannot use predefined pattern) ?)? if not need, would you like to tell me how to create this hatch?
best regards
1.0399/5=0.20798 - this value is defined in your hatch pattern description.
code:
class toolkit_export odhatchpatternline
{
public:
double m_dlineangle;
odgepoint2d m_basepoint;
odgevector2d m_patternoffset;
odgedoublearray m_dashes;
odhatchpatternline() : m_dlineangle(0.0) { }
};
typedef odarray<odhatchpatternline> odhatchpattern;
the distance between lines is projection of m_patternoffset vector on perpendicular to the hatch line (it depends on the offset vector and line angle).
if the angle between hatch cross lines is not equal to pi/2, you need to use pattern definition (custom defined if no one of autocad's predefined hatches matches your requirements)
sergey slezkin
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
回复


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

高级搜索
显示模式

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

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

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】hatching entities yang686526 DirectDWG 0 2009-05-05 12:01 PM
【转帖】a hatch problem yang686526 DirectDWG 0 2009-05-04 03:07 PM
[求助]请教高手,这段程序能否简化一下呢? yang686526 ObjectARX(AutoLISP) 0 2009-04-26 02:45 PM


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


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