(defun c:ar2csv ()
(setq
old_cmdecho (getvar
"cmdecho")) ;save echo var.
(setvar
"cmdecho" 0) ;echo
off
(setq
txth (getvar "TEXTSIZE")) ;Text
Height
(if
(setq fn (getfiled "Save to CSV file." "" "csv"
1)) ;CSV File Name.
(progn
(setq f (open fn "w")) ;Open the file for
writing
(write-line (strcat
"Num.,Area") f) ;Write header line to file
(setq is 1 ;Number Start
dec 3 ;Decimal
)
(while (setq pt (getpoint
"\nPick in Location: ")) ;Pick point In area.
(command
"_boundary" pt "") ;make
a boundary
(command "_area"
"o" "l") ;get
area by object last.
(command "_erase"
"l" "") ;erase
a boundary
(setq AR (getvar
"area")) ;set area value
(command "_text"
"mc" pt txth "0" (strcat (rtos is 2 0) ". "(rtos
ar 2 dec))) ;draw area on pick point.
(write-line ;Write number and area to file
(strcat (rtos is 2 0)
","
(rtos
ar 2 dec)
);strcat
f
);write-line
(setq is (1+ is)) ;count
number
);end while
(close f) ;Close the file
(princ)
);progn
(princ
"Stopped. Exit.");if don't save cvs file
);if
(setvar
"cmdecho" old_cmdecho) ;set old cmdecho
(princ);clean
);End
(prompt
"\nEnter AR2CSV to Start AREA to Excel.csv")
ไม่มีความคิดเห็น:
แสดงความคิดเห็น