KumKum Posted December 6, 2020 Share Posted December 6, 2020 Hi I work in a company, people come to us with their plot registry, on which are the dimensions (north,east,south,west) and area of their plots. But there are no angles. For example, a plot of 25 * 10 meters with an area (according to the mathematical calculations) should be 250 square meters. But 244.95 is listed on the registry.My question is how do I quickly draw this plot (according to the registry) in AutoCAD? Is there any lisp for this? Quote Link to comment Share on other sites More sharing options...
BIGAL Posted December 8, 2020 Share Posted December 8, 2020 Post image/dwg etc. Quote Link to comment Share on other sites More sharing options...
paulmcz Posted December 8, 2020 Share Posted December 8, 2020 (defun c:sz (/ a ar b ip p1 p2 x y) (setq x (getdist "\n X dimension? :") y (getdist "\n Y dimension? :") ar (getreal "\n Area? :") a (sqrt (/ ar (/ x y))) b (* a (/ x y)) ip (getpoint "\n Insert rectangle:") p1 (polar ip 0 a) p2 (polar p1 (* pi 0.5) b) ) (command "rectang" ip p2) (princ)) Try this Quote Link to comment Share on other sites More sharing options...
paulmcz Posted December 9, 2020 Share Posted December 9, 2020 Or, it could be a parallelogram (defun c:sx (/ ar h ip l p1 p2 p3 p4 x y) (setq x (getdist "\n X dimension? :") y (getdist "\n Y dimension? :") ar (getreal "\n Area? :") ip (getpoint "\n Insert figure:") h (/ ar x) l (sqrt (- (expt y 2) (expt h 2))) p1 (polar ip 0 x) p2 (polar ip 0 l) p3 (polar p2 (* pi 0.5) h) p4 (polar p3 0 x) ) (command "pline" p1 ip p3 p4 "c") (princ)) Quote Link to comment Share on other sites More sharing options...
ronjonp Posted December 10, 2020 Share Posted December 10, 2020 (edited) You could also use something like this to draw whatever shape then scale to get the area you want. (defun c:scaletoarea (/ _getarea a a2 ll o s) ;; RJP » 2020-12-09 ;; Scales an object to a desired area (defun _getarea (e / a) (if (vl-catch-all-error-p (setq a (vl-catch-all-apply 'vlax-curve-getarea (list e)))) 0 a ) ) (if (and (setq s (ssget ":L" '((0 . "~INSERT")))) (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) )(vl-load-com) Edited December 10, 2020 by ronjonp 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.