图层切换功能优化
已有两种图层切换程序:(Defun C:aq ()
(prompt "***切换到【001-建筑-墙体】")
(if (= (TBLOBJNAME "LAYER" "001-建筑-墙体") nil)
(command "layer" "m" "001-建筑-墙体" "c" "7" "" "")
(setvar "clayer" "001-建筑-墙体")
)
(setq SS (ssget))
(if (/= ss nil)
(Command "CHANGE" SS "" "P" "la" "001-建筑-墙体" "")
)
(princ)
)
(Defun C:JD (/ key lay ss)
(initget "1 2 3 4 5 6")
(setq key (getkword "\n选择图层[墙体粗线(1)/完成面中粗(2)/基层中细(3)/细线(4)/填充淡显(5)/尺寸细线(6)]:<基层中细>"))
(cond
((= key "1")(setq lay "008-节点-墙体粗线"))
((= key "2")(setq lay "008-节点-完成面中粗"))
((= key "3")(setq lay "008-节点-基层中细"))
((= key "4")(setq lay "008-节点-细线"))
((= key "5")(setq lay "008-节点-填充淡显"))
((= key "6")(setq lay "008-节点-尺寸细线"))
((= key nil)(setq lay "008-节点-基层中细"))
)
(prompt (strcat "***切换到【" lay "】"))
(if (= (TBLOBJNAME "LAYER" lay) nil)
(command "layer" "m" lay "c" "7" "" ""))
(setvar "clayer" lay)
(setq SS (ssget))
(if (/= ss nil)
(Command "CHANGE" SS "" "P" "la" lay "")
)
(princ)
)
想要优化成:
1.按AQ命令后如没有选择物体,那么点两下右键(回车或者空格),将建筑墙体层切换为当前层。
2.按AQ命令后选择物体,那么只有选择的物体图层改变,但是当前层不变。
(Defun C:aq ()
(prompt "***切换到【001-建筑-墙体】")
(if (= (TBLOBJNAME "LAYER" "001-建筑-墙体") nil)
(entmake (list '(0 . "LAYER") '(100 . "AcDbSymbolTableRecord") '(100 . "AcDbLayerTableRecord") '(70 . 0) '(62 . 7)(cons 2 "001-建筑-墙体")))
)
(setq SS (ssget))
(if (/= ss nil)
(Command "CHANGE" SS "" "P" "la" "001-建筑-墙体" "")
(setvar "clayer" "001-建筑-墙体"))
(princ)
) start4444 发表于 2020-11-3 12:33
(Defun C:aq ()
(prompt "***切换到【001-建筑-墙体】")
(if (= (TBLOBJNAME "L ...
谢谢,就是这样的效果。另外问下entmake与command是一样的效果吧 谢谢! http://bbs.mjtd.com/thread-70009-1-1.html,图层工具还是这个厉害 atone 发表于 2024-2-12 14:36
http://bbs.mjtd.com/thread-70009-1-1.html,图层工具还是这个厉害
分享的切换图层工具真的很厉害!!路过也能捡到宝。
页:
[1]