几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量

几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 (http://www.dimcax.com/hust/index.php)
-   DirectDWG (http://www.dimcax.com/hust/forumdisplay.php?f=89)
-   -   【转帖】he Hatch Line Is Too Sparse (http://www.dimcax.com/hust/showthread.php?t=18763)

yang686526 2009-05-07 04:58 PM

【转帖】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


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