查看单个帖子
旧 2009-05-06, 10:44 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】problem hatch patten

problem hatch patten
problem hatch patten
hi,
i write an application with v.1.12.04
i got dxf_code_value for hatch from odamfcapp.exe.
i have attached four files(two original dwg_files, two my drawing jpg)
i used to following code, but it shown strangely.
/////////////
odhatchpattern myangle;
odhatchpatternline line;
line.m_dlineangle = 0.0;
line.m_patternoffset = odgevector2d(0, 69.850000);
line.m_dashes.push_back(50.800000);
line.m_dashes.push_back(-19.050000);
myangle.push_back(line);
line.m_dlineangle = 1.570796;
line.m_patternoffset = odgevector2d(-69.850000, 0);
myangle.push_back(line);
opdb->appservices()->patternmanager()->appendpattern(oddbhatch::kcustomdefined,"my_angle ", myangle);
podhatch->setassociative(true);
podhatch->setpattern(oddbhatch::kcustomdefined, "my_angle");
podhatch->setpatternscale(1);
podhatch->setpatternangle(0); // near 30 degrees
podhatch->sethatchstyle(oddbhatch::knormal);
/////////////////////////////
odhatchpattern stars;
odhatchpatternline line;
line.m_dlineangle = 0.0;
line.m_patternoffset = odgevector2d(0, 54.992600);
line.m_dashes.push_back(31.750000);
line.m_dashes.push_back(-31.750000);
stars.push_back(line);
line.m_dlineangle = 1.0472;
line.m_patternoffset = odgevector2d(-47.624989, 27.496300);
stars.push_back(line);
line.m_dlineangle = 2.0944;
line.m_basepoint = odgepoint2d(15.875000, 27.496300);
line.m_patternoffset = odgevector2d(-47.624989, -27.496300);
stars.push_back(line);
opdb->appservices()->patternmanager()->appendpattern(oddbhatch::kcustomdefined,"my_stars ", stars);
podhatch->setassociative(true);
podhatch->setpattern(oddbhatch::kcustomdefined, "my_stars");
podhatch->setpatternscale(1);
podhatch->setpatternangle(0); // near 30 degrees
podhatch->sethatchstyle(oddbhatch::knormal);
attached images
hi,
in case of the angle hatch, try this code, it should work:
odhatchpatternline line;
line.m_dlineangle=0.0;
line.m_patternoffset=odgevector2d(0.0,offset+dash) ;
line.m_dashes.push_back(dash);
line.m_dashes.push_back(-dash);
line.m_basepoint=odgepoint2d(0.,0.);
pattern.push_back(line);
line.m_dlineangle=1.570796326795;
line.m_patternoffset=odgevector2d(0.0,offset+dash) ;
line.m_basepoint=odgepoint2d(0.0,0.0);
pattern.push_back(line);
i磛e found a lot of information concerning the composition of hatches in the "acad_acg.chm" help file of the autocad 2006 version.
greetings,
susanne
thanks, hermine schotter.
but, i want to understand common rule about the hatch pattern.
i hope to answer the question.
why is different two image that shown from odamfcapp.exe and writen the dxf_code from odamfcapp.exe.
have a nice day~

please note that hatch patterns in dxf and pat files are strored in different coordinate systems. in dxf they're stored in ocs; in pat (and, so, in pattern manager) - in ucs.
sincerely yours,
george udov

also, pattern offset is treated differently.
the clue moment - you should append pattern to pattern manager in same format pattern have in pat file (not dxf).
sincerely yours,
george udov
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)