![]() |
【转帖】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 |
所有的时间均为北京时间。 现在的时间是 09:00 AM. |