; Numeric Texts Sum Report as txt file with text string in format A+B+C+.. = Sum
; Created by Dlanor 2018
; Based on mfuccaro@hotmail.com routine with Enhancements by CAD Studio, 2012 and Tharwat routine
; Saved from: http://www.theswamp.org/index.php?topic=54104.0

(defun C:tax (/ c_doc ent ss t_lst xport_str fn file)
(prompt "\nSelect 2 M. Numeric Texts to Multiple : ")
(setq c_doc (vla-get-activedocument (vlax-get-acad-object))
ent (ssget '((0 . "TEXT")))
ss (vla-get-activeselectionset c_doc)
xport_str ""
)
(vlax-for obj ss
(setq t_lst (cons (atof (vla-get-textstring obj)) t_lst))
(if (= (strlen xport_str) 0)
(setq xport_str (strcat xport_str (vla-get-textstring obj)))
(setq xport_str (strcat xport_str " * " (vla-get-textstring obj)))
)
)
(setq xport_str (strcat xport_str " = " (rtos (apply '* t_lst) 2 2))
ss nil
fn (strcat (getvar "dwgprefix") "Export Report.txt")
file (open fn "a") ; append
)
(write-line "" file)
(princ (strcat "\nAreas written to:" fn))
(write-line "Area =" file)
(princ xport_str file)
(write-line " m²" file)
(close file)
(startapp "notepad.exe" fn)
)
(c:tax)

Advertisements