vladthedog
26th Oct 2009, 09:08 pm
We use the following code to figure square footage for our jobs individual pieces, as well as total it at the end. Currently it draws a polyline of the selected part (using a layer called "temp" with color 50.) I need for it to delete each temporary polyline as we select each area (meaning, we select area 1, we see a bright yellow line showing what we are getting the sqft of, and then when its time to select the 2nd area, the first yellow line dissapears and draws another). Does that make sense? Thanks.
;;;;;;;;;;;;;;;;;;;;;;;;;;;Total Square Footage for Job
;
(defun c:totalft()
(command "undo" "BE")
(setq dim (ssget "x" '((0 . "dimension"))))
(command "chprop" dim "" "la" "sqft" "")
(command "layer" "off" "sqft" "off" "cab lines" "off" "cabnets" "")
(setq area 0)
(command "layer" "m" "sqft" "c" "7" "sqft" "")
(if not
(command "layer" "m" "temp" "c" "50" "temp" ""))
(while
(setq pt (getpoint "Please pick inside the area:"))
(command "-boundary" "a" "i" "n" "+x" "" PT "")
(setq temp (entlast))
(command "area" "o" "l")
(setq areatop (getvar "area"))
(setq top (rtos (/ AREAtop 92903.04) 2 1))
(setq top (strcat top " sqft"))
(setq PT (getpoint "\n pick location for text"))
(command "text" "m" PT 0 top)
(command "chprop" "l" "" "la" "sqft" "")
(command "area" "o" temp
"pedit" temp "w" "5" "")
(setq area (+ area (getvar "area")))
)
(command "layer" "set" "0" "")
(setq FEET (rtos (/ AREA 92903.04) 2 1))
(setq FEET (strcat FEET " sqft"))
(princ "\n")
(setq TXTPT (getpoint "\n Select Location for sqft total"))
(command "text" txtPT 0 FEET)
(command "chprop" "l" "" "la" "sqft" "")
(command "erase" (ssget "x" ' ((8 . "temp"))) ""
"purge" "la" "temp" "n")
(command "layer" "on" "sqft" "on" "cab lines" "on" "cabnets" "")
(command "chprop" dim "" "la" "sqft" "")
(command "undo" "end")
(princ)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;Total Square Footage for Job
;
(defun c:totalft()
(command "undo" "BE")
(setq dim (ssget "x" '((0 . "dimension"))))
(command "chprop" dim "" "la" "sqft" "")
(command "layer" "off" "sqft" "off" "cab lines" "off" "cabnets" "")
(setq area 0)
(command "layer" "m" "sqft" "c" "7" "sqft" "")
(if not
(command "layer" "m" "temp" "c" "50" "temp" ""))
(while
(setq pt (getpoint "Please pick inside the area:"))
(command "-boundary" "a" "i" "n" "+x" "" PT "")
(setq temp (entlast))
(command "area" "o" "l")
(setq areatop (getvar "area"))
(setq top (rtos (/ AREAtop 92903.04) 2 1))
(setq top (strcat top " sqft"))
(setq PT (getpoint "\n pick location for text"))
(command "text" "m" PT 0 top)
(command "chprop" "l" "" "la" "sqft" "")
(command "area" "o" temp
"pedit" temp "w" "5" "")
(setq area (+ area (getvar "area")))
)
(command "layer" "set" "0" "")
(setq FEET (rtos (/ AREA 92903.04) 2 1))
(setq FEET (strcat FEET " sqft"))
(princ "\n")
(setq TXTPT (getpoint "\n Select Location for sqft total"))
(command "text" txtPT 0 FEET)
(command "chprop" "l" "" "la" "sqft" "")
(command "erase" (ssget "x" ' ((8 . "temp"))) ""
"purge" "la" "temp" "n")
(command "layer" "on" "sqft" "on" "cab lines" "on" "cabnets" "")
(command "chprop" dim "" "la" "sqft" "")
(command "undo" "end")
(princ)
)