Jagaimo
画層名から画層情報を取得する練習問題 解答編です
解答
(defun c:Test (/ LyInfo Tx)
(setq LyInfo (tblsearch "layer" "0"))
(setq Tx
(strcat "画層名: 0"
"\n色 :"(itoa (cdr(assoc 62 LyInfo)))
"\n線種 : "(cdr(assoc 6 LyInfo))
)
)
(alert Tx)
(princ)
)
Visual LISP を使った場合
(defun c:Test ( / ActiveDoc LyInfo Tx)
(setq ActiveDoc (vla-get-activedocument
(vlax-get-Acad-Object)
)
)
(setq LyInfo
(vla-item
(vla-get-layers ActiveDoc)
"0"
)
)
(setq Tx
(strcat "画層名: 0"
"\n色 :"(itoa (vla-get-color LyInfo))
"\n線種 : "(vla-get-linetype LyInfo)
)
)
(alert Tx)
(princ)
)
Comments