高级会员
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
|
【转帖】question about oddbhatch
question about oddbhatch
question about oddbhatch
i can obtain the hatch pattern definition for this hatch entity as it appears in the pat file with getpattern or obtain the specified pattern definition line for this hatch entity with getpatterndefinitionat
is it possibile set pattern into oddbhatch from pattern definition line?
i am looking for something like "setpatterndefinitionat".
pattern definition can be set using one of setpattern() or setrawpattern() functions.
it's impossible to change individual line in pattern.
sergey slezkin
ok thank's you a lot.
is it possible convert odhatchpattern as in dxf file
53 pattern line angle
43 pattern line base point, x component
44 pattern line base point, y component
45 pattern line offset, x component
46 pattern line offset, y component
79 number of dash length items
49 dash length (multiple entries)
into pat file?
dd contains code reading .pat files but no .pat writing code.
btw, it's rather trivial to write .pat file. it has very simple text format.
sergey slezkin
while we are on the pattern subject, may i ask the the following question :
the documenttion says that calling phatch->getpattern()
"...returns the hatch pattern definition for this hatch entity as it appears in the pat file...."
this does not look true:
in the ac .pat iso file, the angle definition is
0.0000,0,0,0.0000,6.9850,5.0800,-1.9050
90.0000,0,0,0.0000,6.9850,5.0800,-1.9050p
but getpattern() return this :
0.0000,1.5593,0.4197fff">,0.0000,6.9850,5.0800,-1.9050
90.0000,1.5593,0.4197fff">,0.0000,6.9850,5.0800,-1.9050
that is there is an originx and originy value. added to the definition.
it is not the orginx/y that is given int the hatch properties
how is this point calculated ?
thanks
hatch pattern stored in the hatch entity is scaled and rotated according to hatch entity properties.
getpattern() removes scale and rotation from pattern returned. but it does not remove origin. this is dd bug. thanks for noticing it.
but note that hatch origin point was introduced in autocad 2006.
previous autocads did not store the origin point in hatch entity. while creating hatch entity they used as origin current ucs origin so pattern in pre-ac2006 may be offset. in such case (if origin is non-zero) it's impossible to remove offset if the file is created in ac14-ac2005.
sergey slezkin
thank you serguey. i use ac2007 for my testing purposes.
try to do your best to fix this in the march release !
if i understand you well :
with pre ac2006 dwg file phatch->getpattern() will contain an offset
with post ac2005 dwg file phatch->getpattern() will return the pure pattern definition ( when you fix the dd bug )
please confirm !
this is important for us to know, because having the pure definition, we can add it to our pattern list in our software !
yes, but the key thing with versions is not autocad's version which saved the file but autocad's version in which the hatch entity was created.
for example:
a hatch entity is created in ac2005 and saved to file.
file is opened by ac2006 and resaved.
hatch offset will not be saved.
original file version also can't help. because a hatch entity can be created later by another ac version:
drawing is created by ac2006
file is opened by ac2005 and hatch is created
original drawing version and "last saved by" version are ac2006 but offset is not saved for hatch entity.
btw, dwg of ac2004-ac2006 have the same file format. hatch offset is saved as xdata by ac2006 and ac2007.
sergey slezkin
interesting !...
pdb->originalfileversion() returns what ? the version of ac who created the file
or the version of the ac who saved that file last ?
so, if pdb->originalfileversion() (hopefully) returns the version of ac who created the file originally, then i can dig into xdata for pre ac2006 hatches to retrieve the hatch offset and substract it to retrieve the pure hatch definition. right ?
while we are talking of original dwg, how can i konw if a dwg that has been read in a db comes from autocad ( trusted?) or from another software?
thanks
oups !!! i think i misread your answer...
i understand now that for pre ac2006 files, there is now way to retrieve the hatch offset ( and then i can't strip it from the pattern definition...
.... and therefore i cant get the pure pattern definition for pre ac2006 created files.
right ?
right. but about hatch entity, not about file.
if hatch is created in ac2006 it has offset xdata attached.
if hatch entity is created in ac2005 it has no offset xdata.
imagine: file is created in ac2006 and saved.
file is opened in ac2005 and hatch entity is created (no xdata)
file is opened in ac2006 and saved.
neither original file version nor last saved by will help.
sergey slezkin
|