sivapathasunderam Posted April 21, 2021 Share Posted April 21, 2021 Lisp to match rotation angel to another block (first click on a block that rotation pick then another click on another block apply) Quote Link to comment Share on other sites More sharing options...
ronjonp Posted April 21, 2021 Share Posted April 21, 2021 This has nothing to do with a higher power, but it will match the ANGLE of a picked block to a selection. (defun c:foo (/ a e s) (if (and (setq e (car (entsel "\nPick a block to match rotation: "))) (setq a (cdr (assoc 50 (entget e)))) (setq s (ssget ":L" '((0 . "INSERT")))) ) (foreach e (vl-remove-if 'listp (mapcar 'cadr (ssnamex s))) (vla-put-rotation (vlax-ename->vla-object e) a) ) ) (princ) ) 1 Quote Link to comment Share on other sites More sharing options...
tombu Posted April 21, 2021 Share Posted April 21, 2021 (edited) I've used this code by alanjt for many years. Works on Text, Blocks, or Hatch with options. Copyright© March 2009 Alan J. Thompson (alanjt) https://www.theswamp.org/index.php?topic=40450.0 RotateObjects.LSP Edited April 21, 2021 by tombu Quote Link to comment Share on other sites More sharing options...
sivapathasunderam Posted April 21, 2021 Author Share Posted April 21, 2021 @ronjonp & @tombu many thanks to both of you and your valuable contributions ... both of your suggestions work perfectly ! thanks again 1 Quote Link to comment Share on other sites More sharing options...
ronjonp Posted April 21, 2021 Share Posted April 21, 2021 8 minutes ago, sivapathasunderam said: @ronjonp & @tombu many thanks to both of you and your valuable contributions ... both of your suggestions work perfectly ! thanks again Glad to help Here is a version to rotate all objects with a rotation property: (defun c:foo (/ a e o s) (if (and (setq e (car (entsel "\nPick something to match rotation: "))) (setq a (cdr (assoc 50 (entget e)))) (setq s (ssget ":L")) ) (foreach e (vl-remove-if 'listp (mapcar 'cadr (ssnamex s))) (if (vlax-property-available-p (setq o (vlax-ename->vla-object e)) 'rotation) (vla-put-rotation o a) ) ) ) (princ) ) 1 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.