Polar Autolisp Command
Polar Autolisp Command
(OP)
I am trying to write a command to draw a formed channel. I am using the polar command to find the points around the channel.
ex. (setq pt2 (polar pt1 (dtr 180) 5))
The problem I am comming across is that the two angles of the channel will not always be 90 deg. For instance if the two angles are 90 the top leg will end up in a 0 deg direction according to the UCS. However if the two angles were 135 deg the top leg would be in a 90 deg direction. So in short the second angle is based off the first angle. I tried to use the angbase command to rotate the ucs, but found that the polar command works off of the WCS; which can not be edited. Is there another command similiar to polar that will work with the ucs? or some other way to base the second angle off the first. Thank you.
ex. (setq pt2 (polar pt1 (dtr 180) 5))
The problem I am comming across is that the two angles of the channel will not always be 90 deg. For instance if the two angles are 90 the top leg will end up in a 0 deg direction according to the UCS. However if the two angles were 135 deg the top leg would be in a 90 deg direction. So in short the second angle is based off the first angle. I tried to use the angbase command to rotate the ucs, but found that the polar command works off of the WCS; which can not be edited. Is there another command similiar to polar that will work with the ucs? or some other way to base the second angle off the first. Thank you.





RE: Polar Autolisp Command
If I am understanding you correctly, you maybe be experiencing some of the same problems that I have. One of the biggest things that I have found is to make sure that you shut off ALL OSNAPS before your LISP program tries to draw anything. If you need to pick OSNAP points during the LISP program, make sure that you shut off the OSNAPS, turn them on just before asking to select the point, and then shut them off again directly after the LISP program gets the point. I have had some strange results when I forgot to add this in.
Also, I agree with you that sticking to using the WCS and using polar is a better option.
Hope this helps,
Paul
RE: Polar Autolisp Command
RE: Polar Autolisp Command
(command "line" "@" "@23.5<45" "")
Or, you can calculate each point using the "polar" function, then use the "trans" function to convert from WCS to UCS.
RE: Polar Autolisp Command
RE: Polar Autolisp Command
(setq pt2 (polar pt1 (dtr 180) 5))
You could draw a line from pt1 to pt2 with
(command "line" pt1 (strcat "@" (rtos 5) "<" (itoa 180)) "")
You could also get the polar command to work if you added your pre-defined angle to the UCS rotation angle. You can get the UCS angle from the UCSXDIR system variable.
RE: Polar Autolisp Command
(setq inspt (getpoint "\n Pick insertion point."))
(setq pt1 (trans (polar inspt (dtr ia1) oro1) 0 1)
pt2 (trans (polar pt1 (dtr ia1) l2) 0 1)
pt3 (trans (polar pt2 (dtr ia1) oro2)0 1)
pt4 (trans (polar pt3 (dtr ia2) oro2) 0 1)
pt5 (trans (polar pt4 (dtr ia2) l3) 0 1)
pt6 (trans (polar pt5 (dtr (- ia2 90)) at) 0 1)
pt7 (trans (polar pt6 (dtr (- ia2 180)) l3) 0 1)
pt8 (trans (polar pt7 (dtr (- ia2 180)) iro2) 0 1)
pt9 (trans (polar pt8 (dtr (- ia1 180)) iro2) 0 1)
pt10 (trans (polar pt9 (dtr (- ia1 180)) l2) 0 1)
pt11 (trans (polar pt10 (dtr (- ia1 180)) iro1) 0 1)
pt12 (trans (polar pt11 (dtr 0) iro1) 0 1)
pt13 (trans (polar pt12 (dtr 0) l1) 0 1)
pt14 (trans (polar pt13 (dtr 270) at) 0 1)
pt15 (trans (polar pt14 (dtr 180) l1) 0 1)
)
(command "line" pt1 pt2 "")
(command "ucs" "z" ab)
(command "arc" pt4 "e" pt2 "r" orad)
(command "line" pt4 pt5 pt6 pt7 "")
(command "arc" pt7 "e" pt9 "r" ir)
(command "ucs" "z" a11)
(command "line" pt9 pt10 "")
(command "arc" pt10 "e" pt12 "r" ir)
(command "line" pt12 pt13 pt14 pt15 "")
(command "arc" pt1 "e" pt15 "r" orad)
(command "rotate" "l" "" inspt PAUSE)
RE: Polar Autolisp Command
seems to be missing a space
after the next to last bracket.
pt3 (trans (polar pt2 (dtr ia1) oro2) 0 1)
I hope that is it.
RE: Polar Autolisp Command