;|
- Import Coordinate X Y from .CSV Excel
File.
- Create by Songkhran Jongkul September
2021
- Contact :
https://www.facebook.com/groups/AutolispTH
|;
(defun
c:imcsv (/ lst)
(setq
old_cmdecho (getvar
"cmdecho"))
(setq
old_osnap (getvar "osmode"))
(setq
old_layer (getvar "clayer")) ;
layer
(defun
Deconstruct_String (st delimiter / p l)
(while (setq p (vl-string-search
delimiter st 0))
(setq l (cons (substr st 1 p) l)
st (substr st (+ p 2) (strlen st))
)
)
(if st (setq l (cons st l)))
(setq l (reverse l))
)
(setvar
"cmdecho" 0)
(setvar
"osmode" 0)
(if
(not (tblsearch "LAYER" "pline_csv"));;<=== Layer Name
(command "._layer"
"_M" "pline_csv" "_Color" "3"
"" "LType" "Continuous" ""
"");;<=== Layer Name
)
(if
(setq file (getfiled "Select .CSV Excel file ..." ""
"csv" 16))
(progn
(setq file (open file
"r"))
(while (setq st (read-line file))
(setq st (Deconstruct_String
st ";"))
(setq p (Deconstruct_String
(car st) ","))
(setq xy (list (read (car
p))(read (cadr p))))
(setq lst (append lst (list
xy)))
)
(close file)
(setvar "clayer"
"pline_csv")
(command "_pline" )
(foreach x lst
(command x)
)
(command "")
(command "_zoom"
"_E")
(setvar "clayer"
old_layer)
)
)
(setq
mylst lst)
(princ)
(setvar
"cmdecho" old_cmdecho)
(setvar
"osmode" old_osnap)
(setvar
"clayer" old_layer)
(princ)
)
(prompt
"\nCreate by Songkhran Jongkul September 2021")
(prompt
"\nContact : https://www.facebook.com/groups/AutolispTH")
(prompt
"\nEnter IMCSV to start Import Coordinate X Y from .CSV Excel File.
")
ไม่มีความคิดเห็น:
แสดงความคิดเห็น