1个回答
展开全部
(defun c:tt (/ CMDECHO DX ENT F GET GX0 GX8 LEN NN SAVEFILE SS TS)
(princ "\n功能 [指定层文字写入EXCEL]")
(setq cmdecho (getvar 'cmdecho))
(setvar 'cmdecho 0)
(setq savefile (getfiled "" "" "csv" 1))
(setq f (open savefile "a"))
(if
(and
(setq ent (entsel "\n选择要写入EXCEL层的参照文字:"))
(setq get (entget (car ent)))
(setq gx0 (cdr (assoc 0 get)))
(setq gx8 (cdr (assoc 8 get)))
(or (= gx0 "TEXT") (= gx0 "MTEXT"))
)
(progn
(princ "\n框选要写入EXCEL的文字对象:")
(setq ss (ssget (list '(0 . "*text") (cons 8 gx8))))
(and ss
(progn
(setq len (sslength ss))
(repeat len
(setq nn (ssname ss (setq len (1- len)))
dx (cdr (assoc 1 (entget nn)))
ts (cons dx ts)
)
);repeat
(foreach str ts
(WRITE-LINE str f)
)
(close f)
);and-progn
);and
);if-progn
);if
(setvar 'cmdecho cmdecho)
(princ)
)
(princ "\n功能 [指定层文字写入EXCEL]")
(setq cmdecho (getvar 'cmdecho))
(setvar 'cmdecho 0)
(setq savefile (getfiled "" "" "csv" 1))
(setq f (open savefile "a"))
(if
(and
(setq ent (entsel "\n选择要写入EXCEL层的参照文字:"))
(setq get (entget (car ent)))
(setq gx0 (cdr (assoc 0 get)))
(setq gx8 (cdr (assoc 8 get)))
(or (= gx0 "TEXT") (= gx0 "MTEXT"))
)
(progn
(princ "\n框选要写入EXCEL的文字对象:")
(setq ss (ssget (list '(0 . "*text") (cons 8 gx8))))
(and ss
(progn
(setq len (sslength ss))
(repeat len
(setq nn (ssname ss (setq len (1- len)))
dx (cdr (assoc 1 (entget nn)))
ts (cons dx ts)
)
);repeat
(foreach str ts
(WRITE-LINE str f)
)
(close f)
);and-progn
);and
);if-progn
);if
(setvar 'cmdecho cmdecho)
(princ)
)
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询