几何尺寸与公差论坛------致力于产品几何量公差标准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 Look Changes In Autocad

the hatch look changes in autocad
the hatch look changes in autocad
hi,
here i have a problem with hatch. now i am using dd 1.10 update 1.
here has a attachment file explode.dwg. opening this file in autocad, we can see there have two hatches in drawing. if we modify one of the hatch pattern scales to the original value( e.g. in the attachment file, this value is 0.5, we only write 0.5 again for this property fff"> ) in autocad, autocad updates this hatch and the look of it changes. in fact, the result is really what i want( it looks like the same as in my application). what does cause this difference?
regards
attached files

quote:
originally posted by enigma
what does cause this difference?
difference is because hatch pattern, that is inside hatch entity, is different with autocad honey pattern. how do you create this hatch (code)?
sincerely yours,
george udov
hi,
the following is my code to create a hatch:
odhatchpattern hatchptn;
oddbhatchptr phatch = oddbhatch::createobject( );
phatch->setlayer( layerid );
phatch->setcolorindex( entcolor );
phatch->setelevation( elevation );
phatch->setassociative( false );
phatch->setpixelsize( 0.0 );
//append loop
phatch->appendloop(oddbhatch::kpolyline,vertexpts, vertexbulges);
phatch->sethatchstyle( oddbhatch::knormal );
phatch->setpatternangle( patternangleradians );
phatch->setpatterndouble( false );
// pattern line angle
for( int i = 0; i< linecount; i++ )
{
odhatchpatternline hatchline; hatchline.m_dlineangle = lineangle;
// base point
double patternthrough[2];
.... // fill in patternthrough here
hatchline.m_basepoint.set( patternthrough[0],patternthrough[1] );
hatchline.m_patternoffset.set( patternoffset[0],patternoffset[1] );
// dash lengths
for (short j=0, sign=1;j<dashlengthitems; j++, sign *= -1)
{
double dashitem = ...; //fill in dashitem;
hatchline.m_dashes.append(dashitem);
}
hatchptn.append( hatchline );
}
if( oddb::kenglish == pdb->getmeasurement() )
pdb->appservices()->patternmanager()->appendpattern(oddbhatch::kcustomdefined, odstring(patternname ),hatchptn);
else if( oddb::kmetric == pdb->getmeasurement() )
pdb->appservices()->patternmanager()->appendpattern (oddbhatch::kcustomdefined, odstring(patternname ),hatchptn,oddb::kmetric);
else
assert( 0 );
phatch->setpattern( oddbhatch::kcustomdefined, patternname );
phatch->setpatternscale( scale );
pblock->appendoddbentity( phatch );
here i create a custom defined hatch.
autocad has predefined hatch with the same name "honey". when you change something in the hatch entity properties autocad recalculates the hatch. to perform the operation it needs pattern definition (in acad.pat for predefined hatches and <pat_name>.pat for custom hatches.
honey.pat is absent but pattern with the same name presents in acad.pat. autocad uses its prederfined honey to perform the operation. at the same moment hatch type changes from "custom" to "predefined". autocad's predefined honey definition is different from yours custom one.
it's not safe to use custom pattern with the same name as existing predefined one.
btw, if you want your hatch with custom pattern editable in autocad you need to supply corresponding .pat file.
sergey slezkin
hi,
thanks for your reply!
here has two attachment files: drawing1.dwg and drawing6.dwg. in these files, the hatch pattern name has been changed to honeyic, so it will not be replaced by the predefined one in autocad. opening the two files in autocad, we can see that the two hatches using honeyic pattern look different. they only have the different pattern scale. what does cause them look different?
regards
attached files (19.0 kb, 5 views)
(17.2 kb, 4 views)


they look different because they have different patterns. pattern line offsets are equal, while other pattern fields are different with scale 0.2.
sincerely yours,
george udov
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
回复


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

高级搜索
显示模式

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

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

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】he Hatch Line Is Too Sparse yang686526 DirectDWG 0 2009-05-07 04:58 PM
【转帖】hatching entities yang686526 DirectDWG 0 2009-05-05 12:01 PM
【转帖】a hatch problem yang686526 DirectDWG 0 2009-05-04 03:07 PM
【转帖】使用.net在在文档状态栏实现文档标签控件功能 - 精华帖集合 yang686526 ObjectARX(VB.NET/C#) 0 2009-04-29 05:17 PM
【转帖】[翻译] metaprogramming with autocad (二) - 精华帖集合 yang686526 ObjectARX(VB.NET/C#) 0 2009-04-29 05:02 PM


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


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