tboy Posted June 11, 2010 Share Posted June 11, 2010 Please post here scripts that can be described as one-click commands. I hope these commands will be useful, mostly (but not only) while working in XYplane. For example I'll post first one: 'Rotate90degrees'. It is made by fixo and posted here as RS: http://www.cadtutor.net/forum/showthread.php?t=24888&page=2 post #19 I made slight modification to eliminate manual entering the rotation value. ;;rs.lsp;;rotate selection set around its center 90 degrees (vl-load-com) ) (defun C:RS90 (/ a axss lp maxp minp midp points rot ss up) (setq ss (ssget) axss (vla-get-activeselectionset (vla-get-activedocument (vlax-get-acad-object)))) (vlax-for a axss (if (not (vl-catch-all-error-p (vl-catch-all-apply (function (lambda () (vla-getboundingbox a 'minp 'maxp)))))) (setq points (append (list (vlax-safearray->list minp) (vlax-safearray->list maxp)) points) ) ) ) (setq lp (car (vl-sort points (function (lambda (a b) (and ( ( up (car (vl-sort points (function (lambda (a b) (and (> (car a) (car b)) (> (cadr a) (cadr b))))))) ) ; (vla-zoomwindow ; (vlax-get-acad-object) ; (vlax-3d-point lp) ; (vlax-3d-point up) ; ) (setq midp (mapcar (function (lambda(a b)(/ (+ a b) 2.))) lp up)) (initget 3) ;;;;;;;;;;;;;;;;;;;;;;;;;(setq rot (getreal "\nEnter a rotation angle in degrees: ")) (vlax-for a axss (vl-catch-all-apply (function (lambda () (vla-rotate a (vlax-3d-point midp) (* 90 (/ PI 180)))))) ) (princ) ) (prompt "\n >>> Type RS90 to execute...") (prin1) It needs little tuning to work correctly with undo/redo but I don't know how and what to modify.Now I'll ask again fixo to modify above and post here MIRROR-X(about X axis) and MIRROR-Y(about Y axis) using same start point (middle of selection set). Quote Link to comment Share on other sites More sharing options...
fixo Posted June 11, 2010 Share Posted June 11, 2010 Please post here scripts that can be described as one-click commands.I hope these commands will be useful, mostly (but not only) while working in XYplane. For example I'll post first one: 'Rotate90degrees'. It is made by fixo and posted here as RS: http://www.cadtutor.net/forum/showthread.php?t=24888&page=2 post #19 I made slight modification to eliminate manual entering the rotation value. It needs little tuning to work correctly with undo/redo but I don't know how and what to modify. Now I'll ask again fixo to modify above and post here MIRROR-X(about X axis) and MIRROR-Y(about Y axis) using same start point (middle of selection set). Instead of this code line to rotate 90 degrees (vla-rotate a (vlax-3d-point midp) (* 90 (/ PI 180)))))) use the following one (vla-rotate a (vlax-3d-point midp) (/ PI 2.0)) ~'J'~ 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.