![]() |
【转帖】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. |