Search the Community
Showing results for tags 'excel format'.
-
Layer lineweight extraction into excel file error
kam1967 posted a topic in AutoLISP, Visual LISP & DCL
Hi. I am trying to extra layer data, including the lineweight onto an excel format. I added the lineweight information into the lisp routine, but I am definitely doing something wrong, as it continues to give me an error. Thank you in advance! Here is the routine that was modified to include the lineweight.. (defun c:LA2EXCEL (/ nm lnm llnm nam name opf ln lname color ltype lna lnamea colora ltypea,line_wt,description) ; ;I added line_wt in the line above ; (setq nm (getvar "dwgname")) (setq lnm (strlen nm)) (setq llnm (- lnm 3)) ;(setq lay_alst (entget (tblobjname "LAYER" "LAYER-NAME"))) ;(setq line_wt (cdr (assoc 370 lay_alst))) (setq lay_alst (entget (tblobjname "LAYER" "LAYER-NAME"))) ; ;I added this line below (setq line_wt (cdr (assoc 370 lay_alst))) ;I added this line above ; (setq nam (substr nm 1 llnm)) (setq name (strcat nam "csv")) (setq opf (open name "w")) (setq ln (tblnext "layer" T)) (setq lname (cdr (assoc 2 ln))) (setq color (cdr (assoc 62 ln))) (setq ltype (cdr (assoc 6 ln))) (setq stat (cdr (assoc 70 ln))) (cond ((= stat 1)(setq state "FROZEN")) ((= stat 2)(setq state "FROZEN IN NEW VPORT")) ((= stat 4)(setq state "LOCKED")) ((< color 0)(setq state "OFF")) ((>= color 0)(setq state "ON")) ) (write-line "Layer Name,Color,Linetype,Condition,Line_wt,Description" opf) (write-line (strcat lname "," (rtos (abs color) 2 0) "," ltype "," state) opf) (while (setq lna (tblnext "layer")) (setq lnamea (cdr (assoc 2 lna))) (setq colora (cdr (assoc 62 lna))) (setq ltypea (cdr (assoc 6 lna))) (setq stata (cdr (assoc 70 lna))) (cond ((= stata 1)(setq statea "FROZEN")) ((= stata 2)(setq statea "FROZEN IN NEW VPORT")) ((= stata 4)(setq statea "LOCKED")) ((< colora 0)(setq statea "OFF")) ((>= colora 0)(setq statea "ON")) ) (write-line (strcat lnamea "," (rtos (abs colora) 2 0) "," ltypea "," statea) opf) ) (close opf) (alert (strcat "File " name " created in current folder")) (princ) ) hanks!- 8 replies
-
- extraction
- excel format
-
(and 1 more)
Tagged with: