Repeat rotation

Repeat rotation

Anonymous
Not applicable
908 Views
1 Reply
Message 1 of 2

Repeat rotation

Anonymous
Not applicable

Hi.  I am wanting to write a lisp to repeat rotate objects with a specified angle at the start.  I want to specify the angle at the start and then make various selection sets which would rotate by this angle each time I specify a new selection set.

 

So far, the code I have made looks like this, but it doesn't seem to work.  The selection set is not valid or something I don't know, maybe I cannot use the (command "rotate") thing with this?

 

(defun dtr (deg)(* pi (/ deg 180.0)))
(defun r2d (deg)(* 180.0 (/ deg pi)))

 

(defun c:reprot ()

 

(defun *error* (s)
(vl-bt)
(setvar "osmode" oldsnap)
(princ)
)

 

(setq oldsnap "osmode")

(setvar "osmode" 0)

 

(setq ang (getreal "\nEnter angle to repeat rotate objects with: "))

 

(while

 

(princ "\nSelect objects: ")
(setq ss (ssget))

 

(setq p (getpoint "\nClick on base point: "))

 

(command "rotate" ss p ang)

 

)

 

(setvar "osmode" oldsnap)

 

)

 

Thanks

 

Derryck

 

 

0 Likes
Accepted solutions (1)
909 Views
1 Reply
Reply (1)
Message 2 of 2

DannyNL
Advisor
Advisor
Accepted solution

You need to close your selection set.

After passing your selected object SSGET will keep asking for selecting objects unless you give an enter. In your current code you pass the point parameter p as second selection and this gives you the error.

 

(command "rotate" ss "" p ang)