prax3des Posted June 30, 2020 Share Posted June 30, 2020 Good afternoon everyone.Sometimes I run into the following problem.I have a room of X square meters, but in autocad it indicates other meters. Is there a lisp that can help me rescale to get those square meters?Attached sample dwg Drawing1.dwg Quote Link to comment Share on other sites More sharing options...
ronjonp Posted June 30, 2020 Share Posted June 30, 2020 (edited) Try this: (defun c:scaletoarea (/ _getarea a a2 ll o s ur) ;; RJP » 2020-06-30 (defun _getarea (e / a) (if (not (vl-catch-all-error-p (setq a (vl-catch-all-apply 'vlax-curve-getarea (list e))))) a 0. ) ) (if (and (setq s (ssget ":L")) (setq a (getreal "\nEnter desired area: "))) (foreach e (vl-remove-if 'listp (mapcar 'cadr (ssnamex s))) (if (/= 0 (setq a2 (_getarea e))) (progn (vla-getboundingbox (setq o (vlax-ename->vla-object e)) 'll 'ur) (setq ll (mapcar '+ (vlax-safearray->list ll) (vlax-safearray->list ur))) (vlax-invoke o 'scaleentity (mapcar '/ ll '(2 2 2)) (sqrt (/ a a2))) ) ) ) ) (princ) ) Edited June 30, 2020 by ronjonp Quote Link to comment Share on other sites More sharing options...
prax3des Posted July 1, 2020 Author Share Posted July 1, 2020 Great !!!! thank you Quote Link to comment Share on other sites More sharing options...
ronjonp Posted July 1, 2020 Share Posted July 1, 2020 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.