;|SF2TXT.LSP by Paul Kirill, copyright 2005 Kirill Design - PC & CAD Consulting (KDCAD) This routine is freely given and may be freely distributed as long as the Kirill Design copyright and contact info remains intact. There are no guarantees offered with this routine. KDCAD is not responsible for loss of data or work due to the use of this routine. If you have any questions or are interested in contracting for additional custom routines, email us at info@kdcad.com. SF2TXT: Adds up square footage of mulitple polylines and prompts for selection text to modify. Assumes some text is in place to be modified. |; (defun C:SFT (/ sf sftxt a ss n du) (setq a 0 du (getvar "dimunit") ss (ssget '((0 . "*POLYLINE")))) (if ss (progn (setq n (1- (sslength ss))) (while (>= n 0) (command "_.area" "_o" (ssname ss n)) (setq a (+ a (getvar "area")) n (1- n))) (PRINC (strcat "The total area of the selected\nobject(s) is " (if (or (= du 3)(= du 4)(= du 6)) ; ;The following 2 lines translate the area to square inches and feet ;for users using US engineering or architectural units: ; (strcat (rtos a 2 2) " square inches,\nor " (setq SF (rtos (/ a 144.0) 2 0) )" square feet.")) ) ) ) (progn (alert "\nNo Polylines selected!") (C:SFT) ) ) (if SF (progn (setq SFLEN (strlen SF)) (IF (> SFLEN 3) (PROGN (setq SF1 (substr SF 1 (- SFLEN 3))) (setq SF2 (strcat SF1 ",")) (setq SF (vl-string-subst SF2 SF1 SF )) ) ) (while (= SFTXT nil) (SETQ SFTXT (entget (car (entsel "\nSelect square footage text: ")))) ) (setq SFTXT (subst (cons 1 SF) (assoc 1 SFTXT) SFTXT) ) (entmod sftxt) ) ) (princ) ) (princ "\nSF2TXT loaded. Type SFT to run... (KDCAD 2005)")