MartinSomerville Posted October 22, 2008 Posted October 22, 2008 Hello How can I extract the numeric value for the current ucs angle. ie world xy plane angle = 0 but if rotated about z say 30 degrees then angle would be 30 (or pi/180*30 for rads) I guess this mighh get complex with non vert z ucs. Anyway, any help would be grand thanks martin Quote
Lee Mac Posted October 22, 2008 Posted October 22, 2008 Hi Martin, Quote (or pi/180*30 for rads)I'm sure it's only a typo, but I thought I'd point out that a conversion from degrees to radians is: (x/180)*pi and going radians to degrees: (x/pi)*180 Just in case you get any erroneous results in the future. Quote
ASMI Posted October 22, 2008 Posted October 22, 2008 UCS rotation defines with X and Y vectors in 3D space. Look for UCSXDIR and UCSYDIR system variables. Quote
lpseifert Posted October 22, 2008 Posted October 22, 2008 You could try this, it should work when the UCS is rotated around Z; probably a better way to do it using UCSXDIR, UCSYDIR as suggested by ASMI, but I guess I was bored... (defun c:test (/ p1w p2w ang) (defun rtd (a) (/ (* a 180.0) pi)) (setq p1w (trans '(0 0 0) 1 0) p2w (trans '(10 0 0) 1 0) ang (rtd (angle p1w p2w)) ) (prompt (strcat "\nThe UCS is rotated " (rtos ang 2 4) " degrees from the WCS")) (princ) ) Quote
MartinSomerville Posted October 22, 2008 Author Posted October 22, 2008 thankyou both for your reply. any help is welcome. Now I should be able to nut out, using this info, how to set a text to zero or 90 angle (relative to ucs) with a click (using (50 . x) ). cheers martin Quote
MartinSomerville Posted October 22, 2008 Author Posted October 22, 2008 ooh we posted at the same time. thanks. will check it out Quote
ABuckingham Posted October 22, 2008 Posted October 22, 2008 Lee Mac said: I'm sure it's only a typo, but I thought I'd point out that a conversion from degrees to radians is: (x/180)*pi Actually it's just normal order of operations not a typo. Division and multiplication are carried out with the same priority so pi/180*x is exactly the same as the formula you provided. Brackets certainly make things easier to read however. Quote
Lee Mac Posted October 22, 2008 Posted October 22, 2008 Quote Actually it's just normal order of operations not a typo. Division and multiplication are carried out with the same priority so pi/180*x is exactly the same as the formula you provided. I'm afraid that I do not agree... there is no way that you would multiply the input angle by 180 to convert to radians. I understand your point that multiplication/division are treated as the same priority, but this makes no difference if the variables being dealt with are placed incorrectly. Quote
ABuckingham Posted October 22, 2008 Posted October 22, 2008 Lee Mac said: I'm afraid that I do not agree... there is no way that you would multiply the input angle by 180 to convert to radians. I understand your point that multiplication/division are treated as the same priority, but this makes no difference if the variables being dealt with are placed incorrectly. As written pi/180*x then the value of x is not being multiplied by 180, it's being multiplied by pi/180 which is correct. Normally expressions are written with constants on the left and variables on the right here. Perhaps it's common practice to work expressions from right to left in the UK? In the US evaluation is done from the left to the right so it's possible it's a cultural difference. Quote
Lee Mac Posted October 22, 2008 Posted October 22, 2008 I read the initial post as: pi/(180*x) and not: (pi/180)*x which is probably why I disagreed with your proposal, but I understand now the point you are making. Quote
ABuckingham Posted October 22, 2008 Posted October 22, 2008 Lee Mac said: which is probably why I disagreed with your proposal, but I understand now the point you are making. And I can certainly see how bracketing clarifies the situation, I tend to use them liberally myself to clarify equations in text forums like this one just to prevent confusion. In a perfect world we'd all be using polish notation. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.