Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Copy move & rotate Block(s) about the y-axis

1 REPLY 1
Reply
Message 1 of 2
Anonymous
708 Views, 1 Reply

Copy move & rotate Block(s) about the y-axis

I found a program which rotates selected block(s) about thier insertion point.  I modified it to rotate each of the block(s) about the y-axis.  Works great.  Now, I would like to change it so that it rotates a copy of each block about the y-axis and leaves the origial block in place.  Its kind of like the mirror command exept it is rotating the new block(s) to the other side instead of flipping them.  I want to keep all or the parameters of the block(s) the same as each original.   I am using AutoCAD 2010.  MOCORO is not recognized as a command.  The new features workshop says to use the new command AMCOPYRM, which is not recognized either.  Go figure.

 

(defun RotateDuplication (/ CN ENT theObjects SS)
  (vl-load-com)
  (setq SS (ssget (list (cons 0 "INSERT"))))
  (repeat (setq CN (sslength SS))
    (setq CN      (1- CN)
   ENT      (ssname SS CN)
   theObjects (vlax-ename->vla-object ENT)
    )
    (setq theAngle (vla-get-rotation theObjects))
    (setq theAngle (+ theAngle pi))
    (vla-put-rotation theObjects theAngle)
    (setq
      pt (vlax-safearray->list
    (vlax-variant-value (vla-get-insertionpoint theObjects))
  )
    )
    (vla-put-insertionPoint
      theObjects
      (vlax-3d-point (list (car pt) (* (cadr pt) -1) (caddr pt)))
    )
  )     ; end repeat
  (princ)
)

1 REPLY 1
Message 2 of 2
Anonymous
in reply to: Anonymous

Little more persistance and I was able to figure it out.  I forgot about the copy ability of the rotate command.  Works like a charm! Sometimes relaying the problem helps to find a solution.

 

Thanks anyways,

 

(defun RotateDuplication ( / CN ENT theObjects SS)
  (vl-load-com)
  (setq SS (ssget (list (cons 0 "INSERT") ) ) )
  (repeat (setq CN (sslength SS) )
    (setq CN (1- CN)
   ENT (ssname SS CN)
   theObjects (vlax-ename->vla-object ENT) )
    (setq pt (vlax-safearray->list (vlax-variant-value (vla-get-insertionpoint theObjects) ) ) )
    (setq thept  (list (car pt) (- (cadr pt) (cadr pt) ) (caddr pt) ) )
    (vl-cmdf "rotate" ENT "" thept "c" 180)
  ); end repeat
  (princ)
)

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost