tc405003 发表于 2005-11-1 13:02:00

请教如何取得图层列表及相应的颜色与线型列表

<P>请教如何取得图层列表及相应的颜色与线型列表</P>
<P>这是BDY老大的取得图层列表的LISP</P>
<P>(defun Get-Laylist-BDY (/ DOC LAY-L LAYS)<BR>&nbsp; (setq doc (vla-get-activedocument (vlax-get-Acad-Object)))<BR>&nbsp; (setq lays (vla-get-layers doc))<BR>&nbsp; (vlax-for item lays<BR>&nbsp;&nbsp;&nbsp; (SETQ LAY-L (APPEND LAY-L (LIST (vla-get-Name item))))<BR>&nbsp; )<BR>)</P>

meflying 发表于 2005-11-1 13:22:00

取得图层名后,使用(cdr (assoc 62 (tblsearch "layer" layname)))获得颜色,,同样,组码6是线形

xyp1964 发表于 2005-11-2 11:40:00

(defun c:test (/ s1 la co lt lst)
(setq s1 (tblnext "layer" T)
la(tbl 2 s1)
co(tbl 62 s1)
lt(tbl 6 s1)
lst (cons (list la co lt) lst)
)
(while (setq s1 (tblnext "layer" nil))
    (setq la(tbl 2 s1)
   co(tbl 62 s1)
   lt(tbl 6 s1)
   lst (cons (list la co lt) lst)
    )
)
(princ"\n层 颜色 线型列表 : ")
(princ"\n")
lst
)
(defun tbl (mode ent)
(cdr (assoc mode ent))
)

magicheno 发表于 2023-7-8 00:55:56

感谢大佬分享
页: [1]
查看完整版本: 请教如何取得图层列表及相应的颜色与线型列表