Jump to content

Recommended Posts

Posted

Coming back to Autocad after some time away, I used to have a LISP routine that I had written myself.  But I've lost it, and have forgotten how to the programming was done.

The routine would request entities to rotate, and ask for a rotation point, but would then make the reference point equal to the rotation point, thus skipping an annoying stage.

Can somebody point the way for me to do this?

Thanks in advance,

 

Keith

Posted (edited)

If rotation point = ref point

just use rotate command

 

This is what I use to make a rotation with reference. Giving you another one that I don't use as often but when I do it saves time.

usually use it on block to flip them around their mid point.

 

;;----------------------------------------------------------------------------;;
;; ROTATE WITH REFERENCE
(defun C:RH (/ SS)
  (if (setq  SS (ssget ":L"))
    (vl-cmdf "_.Rotate" SS "" Pause "R" "@" Pause Pause)
    (prompt "\nNothing Selected or Entity's on Locked Layer")
  )
  (princ)
)


;;----------------------------------------------------------------------------;;
;; ROTATE MULTIPLE ENTITY'S AROUND THEIR MIDPOINT
(defun C:ROB (/ SS LL UR MPT)
  (vl-load-com)
  (if (setq SS (ssget ":L"))
    (foreach ent (vl-remove-if 'listp (mapcar 'cadr (ssnamex SS)))
      (setq obj (vlax-ename->vla-object ent))
      (vla-getboundingbox obj 'minpt 'maxpt)
      (setq LL (vlax-safearray->list minpt)
            UR (vlax-safearray->list maxpt)
            MPT (mapcar '/ (mapcar '+ LL UR) '(2 2 2))
      )
      (vl-cmdf "_.Rotate" ent "" "_non" MPT pause)
    )
  )
  (princ)
)


 

Edited by mhupp
Posted

Oh, brilliant!  Thank you so much.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...