Jump to content

rescale Areas ?


prax3des

Recommended Posts

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

Link to comment
Share on other sites

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 by ronjonp
Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...