明经CAD社区

 找回密码
 注册

扫一扫,访问微社区

QQ登录

只需一步,快速开始

查看: 21981|回复: 64

[LISP]超級隱藏/顯示工具

  [复制链接]
发表于 2004-8-16 13:16 | 显示全部楼层 |阅读模式
;;这是无痕的思路(不会用就找他)
;;超级隐藏/显示工具
;;By LUCAS(龙龙仔)
(prompt "\n超级隐藏/显示工具-------------龙龙仔.2004.1")
(alert
(strcat
"\n\n--------------------------------------------------------------------------"
"\n\n----------------超级隐藏/显示工具(测试版V0)-------------------"
"\n\n---------------------------龙龙仔.2004.1-----------------------------"
"\n\n--------------------------------------------------------------------------"
"\n\nE-显示所有/D-隐藏所有/V-显示记录/C-隐藏记录"
"\n\nS-显示上个/F-显示下个/空格-显示锁定/R-显示解锁"
"\n\nB-显示记录/X-退出/Q-删除标记/Z-清空记录/A-增加隐藏:"
"\n\n--------------------------------------------------------------------------"
"\n\n--------------------(XSHOW_LAI <词典名称>)--------------------"
"\n\n----------------------------C:XSHOWALL----------------------------"
"\n\n----------------------------C:XHIDEALL-----------------------------")
)
[power=1] ;;这是无痕的思路(不会用就找他)
;;超级隐藏/显示工具
;;By LUCAS(龙龙仔)
;;写好就没有用过.......
(vl-load-com)
(defun C:XSHOWALL (/ SSOBJ ENT)
(if
(and (ssget "X" (list (cons 60 1) (cons 410 (getvar "CTAB"))))
(setq SSOBJ (ssget "X" (list (cons 410 (getvar "CTAB")))))
)
(progn
(setq
SSOBJ (vla-get-activeselectionset
(vla-get-activedocument (vlax-get-acad-object))
)
)
(vlax-for ENT SSOBJ
(vla-put-visible ENT :vlax-true)
)
(prompt "\n显示所有物件!")
)
(prompt "\n无隐藏物件!")
)
(princ)
) (defun C:XHIDEALL (/ SSOBJ ENT)
(if (setq SSOBJ (ssget "X" (list (cons 410 (getvar "CTAB")))))
(progn
(setq
SSOBJ (vla-get-activeselectionset
(vla-get-activedocument (vlax-get-acad-object))
)
)
(vlax-for ENT SSOBJ
(vla-put-visible ENT :vlax-false)
)
(prompt "\n隐藏所有物件!")
)
)
(princ)
) ;;(CHECK "LUNG")
(defun CHECK (DICT / DICT_KEY ENT LL N)
(setq DICT_KEY (vlax-ldata-list DICT)
N 0
)
(repeat (length DICT_KEY)
(setq LL (cons (car (nth N DICT_KEY)) LL))
(setq N (1+ N))
)
LL
) ;;(DICT_OFF "LUNG" "1")
(defun DICT_OFF (DICT KEY / SS ENT)
(setq SS (cdr (assoc KEY (vlax-ldata-list DICT))))
(foreach ENT SS
(if (and (setq ENT (handent ENT)) (entget ENT))
(vla-put-visible (vlax-ename->vla-object ENT) :vlax-false)
)
)
(princ)
) ;;(DICT_ON "LUNG" "1")
(defun DICT_ON (DICT KEY / SS ENT)
(setq SS (cdr (assoc KEY (vlax-ldata-list DICT))))
(foreach ENT SS
(if (and (setq ENT (handent ENT)) (entget ENT))
(vla-put-visible (vlax-ename->vla-object ENT) :vlax-true)
)
)
(princ)
) ;;(MAKE_DICT "LUNG" "1" (SSGET))
(defun MAKE_DICT (DICT KEY SS / ENAME_LIST N)
(setq N 0)
(repeat (sslength SS)
(setq ENAME_LIST
(cons (cdr (assoc 5 (entget (ssname SS N))))
ENAME_LIST
)
)
(setq N (1+ N))
)
(vlax-ldata-put DICT KEY ENAME_LIST)
) ;;主程序
;;(XSHOW_LAI "LUNG")
(defun XSHOW_LAI (DICT / KEY N LEN LIS LIS1 LOOP MSG MODE S1 TMPKEY) (if (not (setq N (vlax-ldata-get (strcat DICT "_N") "N")))
(progn
(setq N 1)
(vlax-ldata-put (strcat DICT "_N") "N" 1)
)
)
(if (not (setq LIS (vlax-ldata-get (strcat DICT "_LIS") "LIS")))
(progn
(setq LIS '())
(vlax-ldata-put (strcat DICT "_LIS") "LIS" LIS)
)
) (setq LOOP t)
(setq MSG
"\nE-显示所有/D-隐藏所有/V-显示记录/C-隐藏记录/S-显示上个/F-显示下个/空格-显
示锁定/R-显示解锁/B-显示记录/X-退出/Q-删除标记/Z-清空记录/A-增加隐藏:"
)
(while LOOP
(setq MODE (grread t 4 2))
(prompt MSG)
(cond ((member MODE '((2 13) (2 88) (2 120) (11 0)))
(setq LOOP NIL)
) ((member MODE '((2 65) (2 97))) ;A
(if (CHECK DICT)
(setq KEY (rtos (1+ (last (setq KEY_LIST
(vl-sort (mapcar 'atof (CHECK DICT)) '<)
)
)
)
)
)
(setq KEY "1")
)
(setq LEN (length (vlax-ldata-list DICT)))
;;(vlax-ldata-put "LUNG" "KEY_LIST" KEY_LIST)
;;(setq KEY (rtos (1+ (apply 'max (mapcar 'atof (CHECK "LUNG"))))))
(prompt "\n增选隐藏物件:")
(setq S1 (ssget))
(if S1
(MAKE_DICT DICT KEY S1)
)
) ((member MODE '((2 69) (2 101))) ;E
(C:XSHOWALL)
) ((member MODE '((2 100) (2 68))) ;D
(C:XHIDEALL)
) ((member MODE '((2 67) (2 99))) ;C
(setq CHECK_LIST (CHECK DICT))
(mapcar '(lambda (X)
(DICT_OFF DICT X)
)
CHECK_LIST
)
(prompt "\n隐藏所有标记物件!")
) ((member MODE '((2 86) (2 118))) ;V
(setq CHECK_LIST (CHECK DICT))
(mapcar '(lambda (X)
(DICT_ON DICT X)
)
CHECK_LIST
)
(prompt "\n显示所有标记物件!")
) ((member MODE '((2 83) (2 115))) ;S
(if (not (setq N (vlax-ldata-get (strcat DICT "_N") "N")))
(progn
(setq N 1)
(vlax-ldata-put (strcat DICT "_N") "N" 1)
)
)
(if (setq LIS1 (CHECK DICT))
(progn
(setq LEN (length LIS1))
(if (= N (1- LEN))
(setq N 0)
(setq N (1+ N))
)
(DICT_ON DICT (nth N LIS1))
(if (= N 0)
(setq TMPKEY (nth (1- LEN) LIS1))
(setq TMPKEY (nth (1- N) LIS1))
)
(if (not (member TMPKEY LIS))
(DICT_OFF DICT TMPKEY)
)
(vlax-ldata-put (strcat DICT "_N") "N" N)
(prompt (strcat "\n显示第"
(nth N LIS1)
"笔物件,锁定串列="
(vl-prin1-to-string LIS)
)
)
)
)
) ((member MODE '((2 102) (2 70))) ;F
(if (not (setq N (vlax-ldata-get (strcat DICT "_N") "N")))
(progn
(setq N 1)
(vlax-ldata-put (strcat DICT "_N") "N" 1)
)
)
(if (setq LIS1 (CHECK DICT))
(progn
(setq LEN (length LIS1))
(if (= N 0)
(setq N (1- LEN))
(setq N (1- N))
)
(DICT_ON DICT (nth N LIS1))
(if (= N (1- LEN))
(setq TMPKEY (nth 0 LIS1))
(setq TMPKEY (nth (1+ N) LIS1))
)
(if (not (member TMPKEY LIS))
(DICT_OFF DICT TMPKEY)
)
(vlax-ldata-put (strcat DICT "_N") "N" N)
(prompt (strcat "\n显示第"
(nth N LIS1)
"笔物件,锁定串列="
(vl-prin1-to-string LIS)
)
)
)
)
) ((member MODE '((2 32))) ;""
(if (setq LIS1 (CHECK DICT))
(progn
(if
(not (setq LIS (vlax-ldata-get (strcat DICT "_LIS") "LIS"))
)
(progn
(setq LIS '())
(vlax-ldata-put (strcat DICT "_LIS") "LIS" LIS)
)
)
(if (not (member (nth N LIS1) LIS))
(setq LIS (append LIS (list (nth N LIS1))))
)
(vlax-ldata-put (strcat DICT "_LIS") "LIS" LIS)
(prompt (strcat "\n显示锁定串列"
(vl-prin1-to-string LIS)
",目前显示第"
(nth N LIS1)
"笔物件"
)
)
)
)
) ((member MODE '((2 114) (2 82))) ;R
(if (setq LIS1 (CHECK DICT))
(progn
(if
(not (setq LIS (vlax-ldata-get (strcat DICT "_LIS") "LIS"))
)
(progn
(setq LIS '())
(vlax-ldata-put (strcat DICT "_LIS") "LIS" LIS)
)
)
(if (member (nth N LIS1) LIS)
(setq LIS (vl-remove (nth N LIS1) LIS))
)
(vlax-ldata-put (strcat DICT "_LIS") "LIS" LIS)
(prompt (strcat "\n显示锁定串列"
(vl-prin1-to-string LIS)
",目前显示第"
(nth N LIS1)
"笔物件"
)
)
)
)
) ((member MODE '((2 122) (2 90))) ;Z
;|
(setq
KEY_LIST1 (mapcar 'rtos
(vl-sort (mapcar 'atof (CHECK "LUNG")) '<)
)
)|;
;|
(setq CHECK_LIST (CHECK "LUNG"))
(mapcar '(lambda (X)
(vlax-ldata-delete "LUNG" X)
)
CHECK_LIST
)|;
(initget "Y ")
(if (getkword "\n真的要清除所有标记物件!<N>:")
(progn
(dictremove (namedobjdict) DICT)
(dictremove (namedobjdict) (strcat DICT "_N"))
(dictremove (namedobjdict) (strcat DICT "_LIS"))
(prompt "\n已清除所有标记物件!")
)
(prompt "\n保留标记物件!")
)
) ((member MODE '((2 113) (2 81))) ;Q
(if (setq LIS1 (CHECK DICT))
(progn
(DICT_ON DICT (nth N LIS1))
(vlax-ldata-delete DICT (nth N LIS1))
(prompt (strcat "\n已删除"
(nth N LIS1)
"标记,目前标记"
(vl-prin1-to-string (CHECK DICT))
)
)
(setq N 1)
)
)
) ((member MODE '((2 66) (2 98))) ;B
(prompt
(strcat "\n目前标记" (vl-prin1-to-string (CHECK DICT)))
)
)
)
)
(princ)
)
(prompt "\n超级隐藏/显示工具-------------龙龙仔.2004.1")
(alert
(strcat
"\n\n--------------------------------------------------------------------------"
"\n\n----------------超级隐藏/显示工具(测试版V0)-------------------"
"\n\n---------------------------龙龙仔.2004.1-----------------------------"
"\n\n--------------------------------------------------------------------------"
"\n\nE-显示所有/D-隐藏所有/V-显示记录/C-隐藏记录"
"\n\nS-显示上个/F-显示下个/空格-显示锁定/R-显示解锁"
"\n\nB-显示记录/X-退出/Q-删除标记/Z-清空记录/A-增加隐藏:"
"\n\n--------------------------------------------------------------------------"
"\n\n--------------------(XSHOW_LAI <词典名称>)--------------------"
"\n\n----------------------------C:XSHOWALL----------------------------"
"\n\n----------------------------C:XHIDEALL-----------------------------")
)
[/power]
发表于 2004-8-16 15:07 | 显示全部楼层
试一下
发表于 2004-8-16 16:59 | 显示全部楼层
龙龙仔,说说怎么用呀
发表于 2004-8-19 17:26 | 显示全部楼层
我也试
发表于 2004-8-21 14:14 | 显示全部楼层
龙龙仔发表于2004-8-16 13:16:00回复:(龙龙仔)超级隐藏/显示工具 ;;这是无痕的思路(不会用就找他) ...

晕啊~。。。。
 楼主| 发表于 2004-8-23 08:53 | 显示全部楼层
那里晕了,以前你不是有个的展示,借一下可以吗? 8-)
发表于 2004-8-25 03:45 | 显示全部楼层
龙龙仔发表于2004-8-23 8:53:00那里晕了,以前你不是有个的展示,借一下可以吗? 8-)

可以,你去找找,我可不记得在哪里了;P
发表于 2004-10-23 06:06 | 显示全部楼层
两人倒是谦虚的很啊!
发表于 2005-1-18 14:52 | 显示全部楼层
俺也学习学习
发表于 2006-4-16 20:02 | 显示全部楼层
人谦虚,东西实在。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号  
©2000-2017 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2018-4-27 00:53 , Processed in 0.234879 second(s), 27 queries , Gzip On.

Powered by Discuz! X3.3

© 2001-2013 Comsenz Inc.

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