请教关于用entmake批量创建图层的问题
;用entmake创建图层(defun jianceng()
(if (= xianxing nil) (setq xianxing "Continuous"))
(if (= xiankuan nil) (setq xiankuan 13))
(if (= dayin nil) (setqdayin 1))
;自动加载线型 Gu_xl 2013-5-29 http://bbs.mjtd.com/forum.php?mod=viewthread&tid=101668&page=2#pid588571
(or (TBLSEARCH "LTYPE" xianxing);线型
(vl-catch-all-apply
'vla-load
(list (vla-get-Linetypes
(vla-get-ActiveDocument (vlax-get-acad-object)))
xianxing ;线型
(findfile "acad.lin"))))
(entmake (list '(0 . "LAYER")
'(100 . "AcDbSymbolTableRecord")
'(100 . "AcDbLayerTableRecord")
'(70 . 0)
(cons 2 cengming) ;层名
(cons 62 yanse) ;颜色
(cons 6 xianxing) ;线型
(cons 370 xiankuan) ;线宽,100=1
(cons 290 dayin) ;0不打印,1打印
))
(princ))
(defun c:`q(); 层名 颜色 线型 线宽 打印
(setq cengming "A" yanse 1 xianxing "center" xiankuan 100 dayin 0)(jianceng)
(setq cengming "B" yanse 2 ) (jianceng)
(setq cengming "C" yanse 3 ) (jianceng)
(setq cengming "D" yanse 4 ) (jianceng)
(setq cengming "E" yanse 5 ) (jianceng)
(setq cengming "F" yanse 6 ) (jianceng)
(setq cengming "G" yanse 7 ) (jianceng)
(setq cengming "H" yanse 8 ) (jianceng)
(setq cengming "I" yanse 9 ) (jianceng)
(princ))
哪位大师方便帮看看哪里写得不对,图层建了,但线宽、线型、打印状态都全部一样了,要怎么改呢?线谢谢了 本帖最后由 edata 于 2014-9-1 09:32 编辑
;用entmake创建图层
;(jianceng cengming yanse xianxing xiankuan dayin flag)
;(jianceng 层名 颜色 线型 线宽 打印 同名是否强制更新)
(defun jianceng (cengming yanse xianxing xiankuan dayin flag)
(or xianxing (setq xianxing "Continuous"))
(or xiankuan (setq xiankuan 13))
(or dayin (setq dayin 1))
(or yanse (setq yanse 7))
;自动加载线型 Gu_xl 2013-5-29 http://bbs.mjtd.com/forum.php?mo ... mp;page=2#pid588571
(and xianxing
(or (TBLSEARCH "LTYPE" xianxing) ;线型
(vl-catch-all-apply
'vla-load
(list (vla-get-Linetypes
(vla-get-ActiveDocument (vlax-get-acad-object))
)
xianxing ;线型
(findfile "acad.lin")
)
)
)
)
(and
cengming
(if (and (setq en (tblobjname "layer" cengming)) flag)
(progn
;强制更新
(setq elist (entget en))
(and yanse (setq elist (subst (cons 62 yanse) (assoc 62 elist) elist)))
(and xianxing (setq elist (subst (cons 6 xianxing) (assoc 6 elist) elist)))
(and xiankuan (setq elist (subst (cons 370 xiankuan) (assoc 370 elist) elist)))
(and dayin (setq elist (subst (cons 290 dayin) (assoc 290 elist) elist)))
(entmod elist)
)
(entmake (list '(0 . "LAYER")
'(100 . "AcDbSymbolTableRecord")
'(100 . "AcDbLayerTableRecord")
'(70 . 0)
(cons 2 cengming) ;层名
(cons 62 yanse) ;颜色
(cons 6 xianxing) ;线型
(cons 370 xiankuan) ;线宽,100=1
(cons 290 dayin) ;0不打印,1打印
)
)
)
)
(princ)
)
(defun c:`q(); 层名 颜色 线型 线宽 打印
;(jianceng cengming yanse xianxing xiankuan dayin flag)
;(jianceng 层名 颜色 线型 线宽 打印 同名是否强制更新)
(jianceng "A" 1 "center" 100 0 t)
(jianceng "B" 2 nil nil nil t)
(jianceng "C" 3 nil nil nil t)
(jianceng "D" 4 nil nil nil t)
(princ)
) (or xiankuan (setq xiankuan 13)) 请问线宽改成“默认”,怎么改? 有没有人知道这个最原始创建图层的帖子在哪啊,好像找不到了 是否强制更新 t 是 nil 否
遇到图层名已经存在,如果是t,则更新设置的属性 颜色等等。如果是nil则保持原状。 edata 发表于 2014-8-30 19:56 static/image/common/back.gif
是否强制更新 t 是 nil 否
遇到图层名已经存在,如果是t,则更新设置的属性 颜色等等。如果是nil则保持原状 ...
好像有处错误,
(or yanse (setq dayin 7)) 学习了 好东西,学习了 学习了,entmake确实要快点 是否可以强制线型比例为 1 很好,很受用 学习了!!!
页:
[1]
2