声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 4062|回复: 1

[AutoCAD] 图层控制 lisp,图层管理工具

[复制链接]
发表于 2005-8-2 09:07 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
本帖最后由 wdhd 于 2016-3-30 09:17 编辑

  ;laymod.lsp

  ;__________________________

  ;解决R14“bonus”工具的移植

  ;图层管理工具

  ; left2r

  ;2004.12.18

  ;lleft@126.com

  ;浙江杭州

  ;-------------------------------------------

  ;图层对象选择,将标注归入dim层,文字归入txt层

  ;___________________________________________

  (defun C:laymod(/ lm_ssd lm_sst)

  (if (not (tblsearch "layer" "DIM"))

  (command "-layer" "n" "DIM" "c" "1""DIM"""));endif

  (if (not (tblsearch "layer" "TXT"))

  (command "-layer" "n" "TXT" "c" "1""TXT"""));endif

  (setq lm_ssd (ssget "X" '((0 . "DIMENSION")))

  lm_sst (ssget "X" '((-4 . ""))));endsetq

  (if lm_ssd (command "chprop" lm_ssd "" "la" "DIM"""))

  (if lm_sst (command "chprop" lm_sst "" "la" "TXT"""))

  );end defun

  ;-------------------------------------

  ;图层孤立显示,通过选择对象单显某图层

  ;_____________________________________

  (defun C:layiso(/ l9_ss l9_ent l9_lay ii)

  (setq l9_ss "" ii 0)

  (princ "\n选择要保留显示的图层:")

  (setq l9_ss (ssget))

  (if l9_ss (command "-layer""off""*""y"""))

  (repeat (sslength l9_ss)

  (setq l9_ent (entget (ssname l9_ss ii)))

  (setq l9_lay (cdr (assoc 8 l9_ent)) ii (1+ ii))

  (command "-layer""on" l9_lay "")

  );end repeat

  );end defun layiso

  ;--------------------------

  ;打开所有图层

  ;__________________________

  (defun C:layon()(command "-layer""on""*"""))

  ;--------------------------

  ;解除所有图层锁定

  ;__________________________

  (defun C:layul()(command "-layer""u""*"""))

  ;--------------------------

  ;解除所有图层冻结

  ;__________________________

  (defun C:layuk()(command "-layer""t""*"""))

  ;--------------------------

  ;通过选择解除图层锁定

  ;__________________________

  (defun C:layulk(/ l9_ss l9_ent l9_lay)

  (setq l9_ss (entsel "\n选择要解锁的图层:"))

  (while l9_ss

  (setq l9_ent (entget (car l9_ss)))

  (setq l9_lay (cdr (assoc 8 l9_ent)))

  (command "layer""u" l9_lay"")

  (setq l9_ss (entsel "\n选择要解锁的图层:"))

  );end while

  );end defun

  ;--------------------------

  ;通过选择锁定图层

  ;__________________________

  (defun C:laylck(/ l9_ss l9_ent l9_lay)

  (setq l9_ss (entsel "\n选择要锁定的图层:"))

  (while l9_ss

  (setq l9_ent (entget (car l9_ss)))

  (setq l9_lay (cdr (assoc 8 l9_ent)))

  (command "layer""u" l9_lay"")

  (setq l9_ss (entsel "\n选择要锁定的图层:"))

  );end while

  );end defun

  ;--------------------------

  ;通过选择冻结图层

  ;_________________

  (defun C:layfrz(/ l9_ss l9_ent l9_lay l9_clay ii)

  (setq l9_clay (getvar "clayer"))

  (princ "\n选取冻结图层参考对象: ")

  (setq l9_ss (ssget))

  (setq ii 0)

  (command "-layer")

  (repeat (sslength l9_ss)

  (setq l9_ent (entget (ssname l9_ss ii)))

  (setq l9_lay (cdr (assoc 8 l9_ent)))

  (command "f" l9_lay)

  (setq ii (1+ ii))

  );end repeat

  (command "")

  );end defun layfrz

  ;--------------------------

  ;通过选择隐藏图层

  ;__________________________

  (defun C:layoff(/ l9_ss l9_ent l9_lay l9_clay ii)

  (princ "\n选取隐藏图层参考对象: ")

  (setq l9_ss (ssget))

  (setq l9_clay (getvar "clayer"))

  (setq ii 0)

  (command "-layer")

  (repeat (sslength l9_ss)

  (setq l9_ent (ssname l9_ss ii))

  (setq l9_lay (cdr (assoc 8 (entget l9_ent))))

  (if (/= l9_lay l9_clay)

  (command "off" l9_lay)(command "off" l9_lay"y")

  );end if

  (setq ii (1+ ii))

  );end repeat

  (command "")

  );end defun layoff

  ;--------------------------

  (princ "\n---------->> 图层调整

  (laymod)layiso/layon/layuk/layulk/laylck/layfrz/layoff<<----------")

  (prin1)
回复
分享到:

使用道具 举报

发表于 2006-8-11 09:48 | 显示全部楼层
怎么全是编程内容
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-11-15 21:53 , Processed in 0.067713 second(s), 18 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表