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

yang686526 2009-05-04 03:14 PM

【转帖】a question about mtext direction1
 
a question about mtext direction!
a question about mtext direction!
hi, acad read the attached drawing2.dwg file which has a mtext, the reading result is like the attached acadread.jpg. i using the following code to read same file, but the reading result is like the attached myappread.jpg.
code:
...
oddbmtextptr ptroddbmtext = poddbent;
mytextptr ptrmytext = new mytext(); //my text
...
ptrmytext->setalignment(ptroddbmtext->attachment());
odgepoint3d odplocation = ptroddbmtext->location();
ptrmytext->setloc(odplocation.x, odplocation.y, odplocation.z);
odgevector3d odvdirection = ptroddbmtext->direction();
//caltwoptangbyxaxis calculate the two points angle
double drotateang = caltwoptangbyxaxis(0, 0, odvdirection.x,
odvdirection.y);
//calculate the rotate matrix, the result is rotatematrix,
calrotatematrix(odplocation.x, odplocation.y, drotateang, rotatematrix);
ptrmytext->trans(rotatematrix);
...
why the both reuslts aren't same? are there some problem in my code or i need another acad data to trans my text?
btw, i get the drotateang is very close to 0 degree.
attached images
your code assumes that the mtext is in xy plane.
but mtext may be in any other plane (which is defined by normal).
rotation angle should be applied around normal vector.
in your case normal is (0,0,-1) and your code assumes that normal is default (0,0,1)
sergey slezkin


所有的时间均为北京时间。 现在的时间是 06:10 PM.