Hello everyone 🙂
I'm trying to make a default prompt selection on my rotation angle but can't seem to make it work. Please help.....Thanks in advance 🙂
(prompt "Select Entities to Rotate")
(setq ss (ssget))
(setq num (sslength ss))
(setq x 0)
(if ss
(if (setq ang (getreal "\nEnter Rotation Angle [45/90/180] <45>: "))
(repeat num
(setq ename (ssname ss x))
(setq elist (entget ename))
(setq pnt (cdr(assoc 10 elist)))
(command "Rotate" ename "" pnt ang)
(setq x (1+ x))
)
)
)
)
Solved! Go to Solution.
Solved by Lee_Mac. Go to Solution.
You can check out Lee Mac's website (link below). He explains how to do this well.. Use (INITGET...)
There are of course many ways this could be achieved depending on the behaviour you are looking for from the program; since you are restricting the user to angles of 45, 90 or 180, a getkword prompt may be more appropriate, for example:
(prompt "Select Entities to Rotate") (if (setq sel (ssget "_:L")) (progn (initget "45 90 180") (setq ang (atoi (cond ((getkword "\nEnter Rotation Angle [45/90/180] <45>: ")) ("45")))) ... ) )
Thank you for the recommendation Shneuph!
@JCprog wrote:
Thanks for the code Lee but it gives me this error:
; error: bad argument type: fixnump: nil
did you copy all brackets from Lee's code?
Lee's code with other formatting, copy all code, and try it
(initget "45 90 180") (setq ang (atoi (cond ((getkword "\nEnter Rotation Angle [45/90/180] <45>: ")) ("45") ) ) )
Henrique
Thanks for the code Lee but it gives me this error:
; error: bad argument type: fixnump: nil
Sorry, but I see nothing in my posted code that would cause that error - please note that the code I have posted is by no means a complete program, but just the snippet relevant to your question.
Thanks for the code Lee....I finally got it to work!
Excellent to hear - you're welcome JCprog