Is there a way to array with rotation?

Is there a way to array with rotation?

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

Is there a way to array with rotation?

Anonymous
Not applicable

20180517_115617.png

 

 

Is there a way to array with rotation as shown in the picture above?

0 Likes
Accepted solutions (1)
1,079 Views
4 Replies
Replies (4)
Message 2 of 5

DannyNL
Advisor
Advisor
Accepted solution

Quick 'n dirty version.

 

(defun c:Test (/ T_Selection T_BasePoint T_Direction T_Rotation T_NumberOfCopies T_Angle T_Distance T_StartPoint T_Object)
   (if
      (and
         (setq T_Selection      (ssget))
         (setq T_BasePoint      (getpoint             "\nBasepoint           : "))
         (setq T_Direction      (getpoint T_BasePoint "\nDistance & Direction: "))         
         (setq T_Rotation       (getreal              "\nRotation            : "))
         (setq T_NumberOfCopies (getint               "\nNumber of copies    : "))
      )
      (progn
         (setq T_Angle    (angle T_BasePoint T_Direction))
         (setq T_Distance (distance T_BasePoint T_Direction))
         (setq T_Rotation (* T_Rotation (/ pi 180)))
         (setq T_StartPoint T_BasePoint)
         (vla-StartUndoMark (vla-get-ActiveDocument (vlax-get-acad-object)))
         (foreach T_Object (vl-remove-if '(lambda (T_Item) (listp (cadr T_Item))) (ssnamex T_Selection))
            (setq T_Object (vlax-ename->vla-object (cadr T_Object)))            
            (repeat T_NumberOfCopies
               (setq T_Object (vla-Copy T_Object))
               (vla-Move   T_Object (vlax-3D-Point T_StartPoint) (vlax-3D-Point (setq T_StartPoint (polar T_StartPoint T_Angle T_Distance))))
               (vla-Rotate T_Object (vlax-3D-Point T_StartPoint) T_Rotation)
            )
            (setq T_StartPoint T_BasePoint)
         )
         (vla-EndUndoMark (vla-get-ActiveDocument (vlax-get-acad-object)))
      )
   )
   (princ)
)

 

Message 3 of 5

DannyNL
Advisor
Advisor

ArrayRotate.gif

0 Likes
Message 4 of 5

Anonymous
Not applicable

@DannyNLwrote:

Quick 'n dirty version.

 

(defun c:Test (/ T_Selection T_BasePoint T_Direction T_Rotation T_NumberOfCopies T_Angle T_Distance T_StartPoint T_Object)
   (if
      (and
         (setq T_Selection      (ssget))
         (setq T_BasePoint      (getpoint             "\nBasepoint           : "))
         (setq T_Direction      (getpoint T_BasePoint "\nDistance & Direction: "))         
         (setq T_Rotation       (getreal              "\nRotation            : "))
         (setq T_NumberOfCopies (getint               "\nNumber of copies    : "))
      )
      (progn
         (setq T_Angle    (angle T_BasePoint T_Direction))
         (setq T_Distance (distance T_BasePoint T_Direction))
         (setq T_Rotation (* T_Rotation (/ pi 180)))
         (setq T_StartPoint T_BasePoint)
         (vla-StartUndoMark (vla-get-ActiveDocument (vlax-get-acad-object)))
         (foreach T_Object (vl-remove-if '(lambda (T_Item) (listp (cadr T_Item))) (ssnamex T_Selection))
            (setq T_Object (vlax-ename->vla-object (cadr T_Object)))            
            (repeat T_NumberOfCopies
               (setq T_Object (vla-Copy T_Object))
               (vla-Move   T_Object (vlax-3D-Point T_StartPoint) (vlax-3D-Point (setq T_StartPoint (polar T_StartPoint T_Angle T_Distance))))
               (vla-Rotate T_Object (vlax-3D-Point T_StartPoint) T_Rotation)
            )
            (setq T_StartPoint T_BasePoint)
         )
         (vla-EndUndoMark (vla-get-ActiveDocument (vlax-get-acad-object)))
      )
   )
   (princ)
)

 


 

That's exactly what I want!!

Thank you very much!!

0 Likes
Message 5 of 5

DannyNL
Advisor
Advisor

You're welcome & glad I could help Smiley Happy