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

yang686526 2009-05-06 07:44 PM

【转帖】oddbfcf problem calculating the bounding points
 
oddbfcf: problem calculating the bounding points
oddbfcf: problem calculating the bounding points
hi,
i am trying to get the bounding points of a geometrical tolerance.
per default the location of the tolerance is set to the middle of the left border. i want to place the location now to the middle of the right side of the tolerance box. but this somehow leaves a gap between calulated point and border.
my code to determine and set the tolerance's location to the left (default) or right side of the tolerance box is the following:
oddbfcfptr ptolerance = oddbfcf::createobject();
ptolerance->setdatabasedefaults(pdb);
ptolerance->settext(tolerancetext);
[.....]
odgepoint3darray boundingpoints;
ptolerance->getboundingpoints(boundingpoints);
double tolerancelength = boundingpoints.at(1).x;
double toleranceheight = (boundingpoints.at(1).y+boundingpoints.at(2).y)/2;
if(remarkisrightoftolerance == true){
//the block's origin will be on the *left* side on the
//tolerance
ptolerance->setlocation(odgepoint3d.korigin);
bbtr->setorigin(odgepoint3d.korigin);
}else{
//the block's origin will be on the right side on the
//tolerance
ptolerance->setlocation(odgepoint3d.korigin);
bbtr->setorigin(odgepoint3d(tolerancelength,0,0));
}
when setting the location to the right side, there is always a small gap between location-point and the tolerance box. (see in the attached .dwg file the tolerance 1*)). when the location-point is at it's default position (on the left side) it always works perfectly fine.
tolerance text to create the tolerances in the attached file:
1*): "{\\fgdt;b}%%v{\\fgdt;}0.003%%v{\\fgdt;}ab"fff"> error: this one has a gap!
2*): "{\\fgdt;b}%%v{\\fgdt;}0.003%%v{\\fgdt;}ab"fff"> this one works fine.
3*): "{\\fgdt;b}%%v{\\fgdt;}0.003" fff"> this one has no gap and works fine!
i think the error is in my escape sequence, since remark number 3*) works fine. could you provide me the correct escape sequence to have no gap in remark 1*)?
cheers and thanks a lot,
christoph
attached files
hello christoph,
extents tolerance are (0, -0.18, 0) (1.83, 0.18, 0) but block original is (1.83384, 0, 0) and gap is 0.00384 in your file for case 1. i suppose your code has mistake. check tolerancelength value in debug for this case.
here is about escape sequences. records {\\fgdt;}0.003 and {\\fgdt;}ab haven't sense because texts "0.003" and "ab" will be rendered by font from text style and {\\fgdt;} may be escaped. in case {\\fgdt;0.003} and {\\fgdt;ab} texts "0.003" and "ab" will be rendered by gdt.shx font.
best regards,
sergey z.


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