barristann Posted January 25, 2023 Share Posted January 25, 2023 (edited) Hi all, Is it possible to modify this Lee Mac code, to always Scale up by 2 (instead of having the user to enter a value)? Thank you. https://www.cadtutor.net/forum/topic/38409-looking-for-a-lisp-which-scale-objects-with-its-own-center-point/ ;; Scale About Center - Lee Mac (defun c:sac ( / ll sel obj ur ) (initget 6) (if (and (setq *scl* (cond ( (getdist (strcat "\nSpecify Scale Factor" (if *scl* (strcat " <" (rtos *scl* 2) ">: ") ": ")))) ( *scl* ) ) ) (ssget "_:L") ) (progn (vlax-for obj (setq sel (vla-get-activeselectionset (vla-get-activedocument (vlax-get-acad-object)))) (if (null (vl-catch-all-error-p (vl-catch-all-apply 'vla-getboundingbox (list obj 'll 'ur)))) (vla-scaleentity obj (vlax-3D-point (mapcar '(lambda ( a b ) (/ (+ a b) 2.0)) (vlax-safearray->list ll) (vlax-safearray->list ur) ) ) *scl* ) ) ) (vla-delete sel) ) ) (princ) ) (vl-load-com) (princ) Edited January 25, 2023 by barristann Quote Link to comment Share on other sites More sharing options...
ronjonp Posted January 26, 2023 Share Posted January 26, 2023 Try this mod: ;; Scale About Center - Lee Mac (defun c:sac ( / ll sel obj scl ur ) (if (and (setq scl 2 ) (ssget "_:L") ) (progn (vlax-for obj (setq sel (vla-get-activeselectionset (vla-get-activedocument (vlax-get-acad-object)))) (if (null (vl-catch-all-error-p (vl-catch-all-apply 'vla-getboundingbox (list obj 'll 'ur)))) (vla-scaleentity obj (vlax-3D-point (mapcar '(lambda ( a b ) (/ (+ a b) 2.0)) (vlax-safearray->list ll) (vlax-safearray->list ur) ) ) scl ) ) ) (vla-delete sel) ) ) (princ) ) (vl-load-com) (princ) 1 Quote Link to comment Share on other sites More sharing options...
barristann Posted January 26, 2023 Author Share Posted January 26, 2023 You are amazing ronjonp! It works wonders! Thank you ronjonp. Quote Link to comment Share on other sites More sharing options...
ronjonp Posted January 26, 2023 Share Posted January 26, 2023 12 hours ago, barristann said: You are amazing ronjonp! It works wonders! Thank you ronjonp. Glad to help. 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.