Please pay attention that ANGLE function return the angle in radians, while that command is expecting it in degrees.
Registered forum members do not see this ad.
after searching around I finally found the following code to find the angle between two points:
However, when I test this by either priting ang1, or by adding the following line of code for text,Code:(setq p1 (getpoint "\nSelect First Point: ")) (setq p2 (getpoint "\nSelect Second Point: ")) (setq ang1 (angle p1 p2))
the angle seems to only vary from .5 to about 2.0 and never matches what you'd expect from the p1 and p2 angle (perhaps 48 or 89 degrees).Code:(command "_text" "_J" "_tc" "_non" p1 6.0 ang1 "testing angle")
Could it be that the angle it's grabbing is in some other form and I need to convert it?
Please pay attention that ANGLE function return the angle in radians, while that command is expecting it in degrees.
Regards,
Mircea
AutoCAD's happy user equation: FILEDIA + PICKADD² + PICKFIRST = 3
That was it, thanks!!!
Glad to hear that your issue is solved.
Since you will encounter such case many times from now, I strongly suggest you to define a pair of dedicated functions for Radians-to-Degrees, respectively Degrees-to-Radians conversion.
Regards,
Mircea
AutoCAD's happy user equation: FILEDIA + PICKADD² + PICKFIRST = 3




Heres the two rtd dtr you want also you need to remember that whilst the answer will always be radians it also ignores the UNITS direction setting so 0 is always horizontal to right so sometimes need a bit extra to take into account the north brg as up page at 0.
Code:;The dtr function converts degrees to radians ;The rtd function converts radians to degrees (defun dtr (a) (* pi (/ a 180.0)) ) ; (defun rtd (a) (/ (* a 180.0) pi) )
Last edited by BIGAL; 10th Jul 2012 at 06:33 am.
A man who never made mistakes never made anything
Building on Mircea and Bigal 's suggestions and answers .
Code:(command "_.text" "_J" "_tc" "_non" p1 6.0 (/ (* ang1 180.0) pi) "testing angle")
- When aim is being settled in my mind , I have to reach it and get it in hand whatever it costs and wherever it is and will never give up . Tharwat said
Factors you need to consider when using command approach
Current UCS
Current textsyleCode:(setq p1 (getpoint "\nSelect First Point: ")) (setq p2 (getpoint p1 "\nSelect Second Point: ")) (setq ang1 (angle (trans p1 1 0) (trans p2 1 0)))
If Textstyle height is defined on the current TEXTSYLE, instead of "testing angle" you will get the angle value for string and 6.0 as the angle
HTH
Registered forum members do not see this ad.
Regards,
Mircea
AutoCAD's happy user equation: FILEDIA + PICKADD² + PICKFIRST = 3
Bookmarks