You are on page 1of 2

;

; Select closed polyline and place mtext with the room name and Area in m2
;
; How to use:
; 1. select polyline
; 2. type in room name
; Note: the getstring function does not allow spaces, so use a _
underscore to seperate words
; 3 select insert point
; 4 Something similar to this will be placed with MTEXT
; room_name
; Area: 111.11 m2
; 5 MTEXT will be placed with no wrap, to current settings
;
; Created
; 11-June-2003 YZ
; This code was taken from an internet web site. the original author was 'Jos
van Doorn'.
; Among other things, I have modified the program to use MTEXT.
;

(defun drtxt (/ rn tx ls vl lt ht lb hb nr pt)


(setq tx (strcat "Area: "
(rtos (/ (getvar "area") 1000000) 2 2)
" m2"
)
rn (getstring "\nRoom Name: ")
)
(setq ls (list (cons 1 tx))
vl (textbox ls)
vl (cadr vl)
lt (car vl)
ht (cadr vl)
vl (grread T)
nr (car vl)
pt (cadr vl)
)
(princ "\nInsert Point: ")
(while (/= nr 3)
(command "redraw")
(grdraw pt (setq pt (polar pt 0 lt)) 7)
(grdraw pt (setq pt (polar pt (* pi 0.5) ht)) 7)
(grdraw pt (setq pt (polar pt pi lt)) 7)
(grdraw pt (polar pt (* pi 1.5) ht) 7)
(setq vl (grread T)
nr (car vl)
pt (cadr vl)
)
) ;end while function
(command "-mtext" pt "w" 0 rn tx "")
(redraw)
) ; end drtxt function

(defun c:pla ()
(setvar "cmdecho" 0)
(while (setq et
(car
(entsel "\nSelect polyline: ")
) ;end car function
) ;end setq function
(command "area" "o" et)
(drtxt)
) ; wnd while funtion

(setvar "cmdecho" 1)
(princ)

) ; end c:pla function

You might also like