几何尺寸与公差论坛------致力于产品几何量公差标准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)
-   -   【转帖】hatch patterns (http://www.dimcax.com/hust/showthread.php?t=16486)

yang686526 2009-05-05 11:55 AM

【转帖】hatch patterns
 
hatch patterns
hatch patterns
hello,
i have a few questions regarding hatch patterns in new dwgdirect library.
1.
can kuserdefined patterns be added with method appendpattern(...)?
i made similar example as in file dbfiller.cpp for creating custom hatches (stars), with one main difference. i created kuserdefined hatch pattern intead of kcustomdefined.
pattern was not the same any more. only lines (no stars) were in the pattern.
2.
if i add two different patterns with the same name (appendpattern()), will second definition overwrite the first one?
regards, tomaz
hello,
i have one additional question to this subject:
if i create one kcustomdefined hatch pattern and use it with a hatch (like stars in your example).
autocad does not allow to change any property of this hatch pattern. i suppose, that this happens, while it does not have the pattern definition? is it possible to save also pattern definitions into dxf/dwg file, or is this a limitation of autocad (dxf/dwg)?
regards, tomaz
kuserdefined patterns need no definition. such patterns are simple hatching or cross hatching. they are completely defined by angle, spacing and 'cross' flag.
autocad assums that:
1. predefined patterns are stored in acad.pat or acadiso.pat depending on drawing's measurement (metric or english).
2. custom pattern is stored in separate file <pattern_name>.pat
these files must be available for autocad via its support paths.
actually hatch pattern is stored inside each hatch entity (in scaled and rotated form). but autocad requires access to pattern definition in "pure" form (not scaled and rotated).
sergey slezkin
thanks sergey.
this clarifies my problems with hatches.
regards, tomaz
hello sergey,
i have another question regarding hatches.
is there any simple way, to save the custom pattern into file with dd library?
for example, if i create a custom pattern (like in dd examples - stars), is it possible to save this pattern into output file from dd library?
best regards, tomaz
currently dd can't write .pat files.
sergey slezkin
hi sergey,
i have some patterns in a dwg file. i use odhatchpatternmanager to get the pattern definition:
result = patternmanager->retrievepattern(patterntype,patternname,oddb::met ric,pattern);
it returns an error code: kkeynotfound.
when i use the dd example and create the stars pattern then retrieve it, the pattern is found.
can you tell me what's wrong?
is there any way of listing all pattern definitions in a file?
thank you.
pattern definitions are not stored in dwg file in a table or a dictionary like dimstyles or multiline styles. autocad stores patterns in .pat files. each hatch entity store transformed pattern inside it (scaled and rotated). dd does not collect patterns from hatch entities into some table (and autocad too).
where are 2 ways to make a pattern known to pattern manager: load from .pat file or create programmatically like in odwriteex sample.
sergey slezkin
thank you sergey,
but how can i load patterns from a .pat file to the pattern manager? i couldn't see it in any example or function call.
regards,
oddbwriteex contains example of creating hatches with different patterns (dbfiller.cpp - dbfiller::addhatches())
if a pattern is set to hatch entity by name dd will fill all necessary data itself.
if for some purpose you need access to pattern data from .pat file you can use interface declared in hatchpatternmanager.h
predefined patterns are supposed to be stored in acad.pat or acadiso.pat depending on measurement. custom pattern - in .pat file with the same as pattern name.
to get *.pat files dd calls oddbhostappservices::findfile().
sergey slezkin


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