Rotate a Copy of selected Objects - works not properly

Rotate a Copy of selected Objects - works not properly

Anonymous
Not applicable
1,170 Views
4 Replies
Message 1 of 5

Rotate a Copy of selected Objects - works not properly

Anonymous
Not applicable

Hello,

 

I create a lisp for "Rotate a Copy of selected Objects". But it doesn't work properly.

It is created the same way as written earlier lisp RTREFPOI:

http://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/rotate-selected-object-to-position-gi...

so I don't know what's the problem. It doesn't listen the option "Copy", because it rotates selected Object, but not copies.

 

If you use ROTATE command to rotate and copy an object, there is step-by-step command list from CommandLine:

Command: ROTATE
Current positive angle in UCS:  ANGDIR=counterclockwise  ANGBASE=0
Select objects: 1 found
Select objects:
Specify base point:
Specify rotation angle or [Copy/Reference] <270>: c
Rotating a copy of the selected objects.
Specify rotation angle or [Copy/Reference] <270>: 21


And here are my two lisps for "Rotate Copy of selected Object":

; Works not properly
; RTC = RoTate and Copy
(DEFUN C:RTC1
 ()
 (setq zbior (ssget))
 (COMMAND "_ROTATE"
  ;Select objects:
   zbior
  ;Specify base point:
   pause
  ;Specify rotation angle or [Copy/Reference] <270>: c
   "_C"
  ;Rotating a copy of the selected objects.
  ;Specify rotation angle or [Copy/Reference] <270>: 21
   
 )
)
;---
; Works not properly
; RTC = RoTate and Copy
(DEFUN C:RTC
 ()
 (setq zbior (ssget))
 (setq basept (getpoint "\nSpecify base point: "))
 (setq ang (getangle "\nSpecify rotation angle: "))
 (COMMAND "_ROTATE"
  ;Select objects:
   zbior
  ;Specify base point:
   basept
  ;Specify rotation angle or [Copy/Reference] <270>: c
   "_C"
  ;Rotating a copy of the selected objects.
  ;Specify rotation angle or [Copy/Reference] <270>: 21
   ang
 )
)

; Works not properly
; Here is what is in CommandLine:

;Command: rtc
;Select objects: 1 found
;Select objects:
;Specify base point:
;Specify rotation angle: 34
;Invalid window specification.
;; error: Function cancelled
;Specify first corner: Specify opposite corner: 1 found (1 duplicate)
;Select objects: 1 found (1 duplicate), 1 total
;Select objects: 1 found (1 duplicate), 1 total
;Select objects:
;Specify base point:
;Specify rotation angle or [Copy/Reference] <0>:
;Command: *Cancel*

 

Where is error and how to repair it?

 

0 Likes
1,171 Views
4 Replies
Replies (4)
Message 2 of 5

Kent1Cooper
Consultant
Consultant

Complete the selection set:

....

   zbior ""

....

Kent Cooper, AIA
0 Likes
Message 3 of 5

Anonymous
Not applicable

Thank you. Now both RTC1 and RTC are working.

 

I think about one thing. There is one difference between these two lisps.

In RTC1, after you pick BasePoint, it shows dynamic position of rotating Objects.

In RTC, after you pick BasePoint, it DOES NOT show dynamic position of rotating Objects.

 

Do you know, why it is so?

 

And in general, what to type in a lisp routine to get possibility to whatch dinamically changed drawing?

So it is for example in Lee Mac's 3-Point-Rectangle lisp, in command 3PRD (3-Point-Rectangle Dinamic)

http://www.lee-mac.com/3pointrectangle.html

0 Likes
Message 4 of 5

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:

.... There is one difference between these two lisps.

In RTC1, after you pick BasePoint, it shows dynamic position of rotating Objects.

In RTC, after you pick BasePoint, it DOES NOT show dynamic position of rotating Objects.

 

Do you know, why it is so?

 

And in general, what to type in a lisp routine to get possibility to whatch dinamically changed drawing?

....


Because in RTC, at the point where it's asking for the angle, you are not in the Rotate command yet.

 

Dynamic viewing of what the result will be depends a lot on what you are doing.  If it's not within a command that handles that for you, it will probably need to involve (grread), (grdraw), (grvecs) and/or temporary (entmake) functions.  If you Search for those, you will probably find examples [such as many of Lee's routines, or my RectMidPoint routine, which was my first foray into that kind of territory].

Kent Cooper, AIA
0 Likes
Message 5 of 5

Anonymous
Not applicable

Thank you.

 

I feel I understand this problem. it is similar to this problem:

http://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/rotate-radians-select-amp-have-to-pre...

On this site Lee Mac published good lisp for "Rotate about an angle given by multiple of PI Radians"

 

I rewrite it and I get lisp which is good working:

 

;On ground of Lee Mac's lisp RTRAD = RoTate in RADians
; http://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/rotate-radians-select-amp-have-to-press-2xenter-not-1x/td-p/5481467
(defun c:RTCLM ( / bpt mlt sel ) ;; Define function & declare local variables
    (if ;; If the following expressions return a non-nil value
        (and ;; All of the enclosed expressions must return a non-nil value for AND to return T
            (setq sel (ssget "_:L")) ;; Prompt for a selection of objects on unlocked layers
            (setq bpt (getpoint "\nSpecify base point: ")) ;; Prompt for a base point
;            (setq mlt (getreal "\nSpecify number of PI: ")) ;; Prompt for a multiple of pi radians
            (setq ang (getreal "\nSpecify rotation angle: "))
        ) ;; end AND
        ;; The following is the 'then' argument for the IF function:
        (command
            "_.rotate"
            sel "" ;; Submit the selection of objects
            "_non" ;; Command modifier to ignore any active Object Snap modes
            bpt    ;; Submit the UCS base point
            "_c" ; NEW
;            (angtos ang) ;; Submit the multiple of pi radians (i.e. multiple of 180 degrees)
        ) ;; end COMMAND
        ;; If we required an 'else' argument, it would go here
    ) ;; end IF
    (princ) ;; Suppress the return of the last evaluated expression
) ;; end DEFUN
;Select objects:
;Specify base point:
;Specify rotation angle or [Copy/Reference] <0>:
;Command: *Cancel*


;Command: ROTATE
;Current positive angle in UCS:  ANGDIR=counterclockwise  ANGBASE=0
;Select objects: 1 found
;Select objects:
;Specify base point:
;Specify rotation angle or [Copy/Reference] <270>: c
;Rotating a copy of the selected objects.
;Specify rotation angle or [Copy/Reference] <270>: 21

 

0 Likes