Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Measuring Area Using Override Dimensions, Was Told To Try Here

5 REPLIES 5
Reply
Message 1 of 6
esallen
598 Views, 5 Replies

Measuring Area Using Override Dimensions, Was Told To Try Here

Hi All,

 

I'm very new to AutoCAD, I was hired to complete a space project this summer which required basic AutoCAD knowledge. I am responsible for populating a database in which one of the fields is the area of individual rooms in a building. The instructions indicated that I was to use polylines to enclose each room / area and to find the area based on these values.

 

Earlier this year, another student was hired to confirm the measurements on building blueprints. This student took accurate measurements of each room, however instead of correcting the drawings, he simply added override text to the dimensions. Therefore the displayed dimensions are correct but my area values using polylines are inaccurate.

 

The project that I'm working on includes a number of drawings and close to 1000 rooms. I downloaded a function I found online that allows me to figure out which dimensions were overridden by boxing them in a different colour and I've found that it is a significant ammount.

 

Is there a way to use these overridden dimensions, without altering the physical nature of the drawing, to find the area of a room?

 

Any advice is greatly appreciated, otherwise I'll be forced to do each calculation by hand haha.

 

Thanks in advance

 

Too Long, Didn't Read:

Need to use polylines to calculate area of many rooms. Dimensions have been overridden and are inaccurate. Can i use the overridden dimensions without altering the physical drawing?

5 REPLIES 5
Message 2 of 6
Kent1Cooper
in reply to: esallen


@esallen wrote:

....

Need to use polylines to calculate area of many rooms. Dimensions have been overridden and are inaccurate. Can i use the overridden dimensions without altering the physical drawing?


I can imagine a way to do that if all the rooms are rectangles with only two dimensions.  You could presumably use the Polylines as fences for finding the appropriate Dimension entities, extract the override text content from those [or use the measured value when there's no override], convert it from text to numerical values, and multiply them together.

 

But if the rooms might have columns boxed out projecting off the walls or into the corners, curved or angled edges anywhere, or other non-rectangularities, it's kind of hard to imagine how it could be done.

Kent Cooper, AIA
Message 3 of 6
Hallex
in reply to: esallen

Try this code, sorry without good explanation

;; require rooms on layer "A-ROOM", otherwise change the layer name within the code

(defun C:ARL(/  a acsp adoc ar b clay lyr maxp midp minp mtx pl setlayer sset txth)
  
(defun *error* (msg)
      (vla-endundomark (vla-get-activedocument
              (vlax-get-acad-object))
	      )
    (cond ((or (not msg)
	       (member msg '("console break" "Function cancelled" "quit / exit abort"))
	       )
	   )
	  ((princ (strcat "\nError: " msg)))
	  )
(setvar "cmdecho" 1)
(setvar "clayer" clay) 
    (princ)
    )
  
 (defun setlayer  (adoc layername num /)
    (setq lyr (vl-catch-all-apply
		'vla-add
		(list (vla-get-layers adoc) layername)))
    (vl-catch-all-apply
      'vla-put-color
      (list lyr (if num (if (< num 255) num 0))))
    )
;;------------------------------ main part -------------------------------;;
  
(setq adoc (vla-get-activedocument
              (vlax-get-acad-object))
      acsp (vla-get-block(vla-get-activelayout adoc))) 
  (vla-startundomark adoc )
  (setq clay (getvar "clayer"))
  (setlayer adoc "A-ROOM-TEXT" 12)
  (if (setq sset (ssget "_X" (list
			       (cons 0 "lwpolyline");<-- object type
			       (cons 70 1);<-- closed polyline
			       (cons 410 (getvar "ctab"));<-- current tab
			       (cons 8 "A-ROOM");<-- desired layer, you have to change them to your suit
				     )))
  (progn
    ;; define text height
  (initget 6)
  (setq txth (getreal (strcat "\nEnter text height for label <" (rtos(getvar "dimtxt")) ">: ")))
  (cond ((not txth)(setq txth (getvar "dimtxt"))));if enter pressed, so return default
  (setvar "clayer" "A-ROOM-TEXT");<-- set text layer here, change them to your suit
  
  ;; loop thru selected closed polylines on layer "A-ROOM"
  (vlax-for plobj (vla-get-activeselectionset adoc)
    ;; get bounds of every contour
    (vla-getboundingbox plobj 'minp 'maxp)
    ;; calculate midpoint (pseudo-center)
    (setq midp (mapcar '(lambda (a b) (/ (+ a b) 2))
	   (vlax-safearray->list minp)
	  (vlax-safearray->list maxp)))
    
    (setq ar (vla-get-area plobj));<-- get area
    ;; create mtext object
    (setq mtx (vlax-invoke
		acsp
		'addmtext
		midp
		0.0
		(strcat "\\A1;Area:\\P\\C1;" (rtos ar 2 2) " m.")));<-- change color(C1;),units (2 for metric) and precision (2) here
    (vlax-put mtx 'height txth)
    (vlax-put mtx 'attachmentpoint 5)
    )
    )
    )
  
  (vla-regen adoc 0)
  (*error* nil)
  (princ)
  )
(princ "\nStart command with ARL...")
(princ)
(vl-load-com)
(princ)

 

 

~'J'~

_____________________________________
C6309D9E0751D165D0934D0621DFF27919
Message 4 of 6
Patchy
in reply to: Hallex

Hi Hallex,

I tried your code but it label the actual polylines of the rooms, I think the request was to use the override dimensions to calculate the area, because the person that worked on this drawing before used override dimensions and did not revise the room sizes.

Message 5 of 6
esallen
in reply to: Patchy

Yes Patchy, that's correct. Thank you Hallex for your time and effort it is greatly appreciated. I'm not entirely sure if what I'm asking can even be done.

Message 6 of 6
Hallex
in reply to: Patchy

Sorry, my bad

I didn't understand the question, so forget about

Regards,

 

~'J'~

 

 

_____________________________________
C6309D9E0751D165D0934D0621DFF27919

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost