[LISP]超級隱藏/顯示工具
;;这是无痕的思路(不会用就找他)<BR>;;超级隐藏/显示工具<BR>;;By LUCAS(龙龙仔)<BR>(prompt "\n超级隐藏/显示工具-------------龙龙仔.2004.1")<BR>(alert<BR> (strcat<BR> "\n\n--------------------------------------------------------------------------"<BR> "\n\n----------------超级隐藏/显示工具(测试版V0)-------------------"<BR> "\n\n---------------------------龙龙仔.2004.1-----------------------------"<BR> "\n\n--------------------------------------------------------------------------"<BR> "\n\nE-显示所有/D-隐藏所有/V-显示记录/C-隐藏记录"<BR> "\n\nS-显示上个/F-显示下个/空格-显示锁定/R-显示解锁"<BR> "\n\nB-显示记录/X-退出/Q-删除标记/Z-清空记录/A-增加隐藏:"<BR> "\n\n--------------------------------------------------------------------------"<BR> "\n\n--------------------(XSHOW_LAI <词典名称>)--------------------"<BR> "\n\n----------------------------C:XSHOWALL----------------------------"<BR> "\n\n----------------------------C:XHIDEALL-----------------------------")<BR>)<BR>;;这是无痕的思路(不会用就找他)<BR>;;超级隐藏/显示工具<BR>;;By LUCAS(龙龙仔)<BR>;;写好就没有用过.......<BR>(vl-load-com)<BR>(defun C:XSHOWALL (/ SSOBJ ENT)<BR> (if<BR> (and (ssget "X" (list (cons 60 1) (cons 410 (getvar "CTAB"))))<BR> (setq SSOBJ (ssget "X" (list (cons 410 (getvar "CTAB")))))<BR> )<BR> (progn<BR> (setq<BR> SSOBJ (vla-get-activeselectionset<BR> (vla-get-activedocument (vlax-get-acad-object))<BR> )<BR> )<BR> (vlax-for ENT SSOBJ<BR> (vla-put-visible ENT :vlax-true)<BR> )<BR> (prompt "\n显示所有物件!")<BR> )<BR> (prompt "\n无隐藏物件!")<BR> )<BR> (princ)<BR>)
(defun C:XHIDEALL (/ SSOBJ ENT)<BR> (if (setq SSOBJ (ssget "X" (list (cons 410 (getvar "CTAB")))))<BR> (progn<BR> (setq<BR> SSOBJ (vla-get-activeselectionset<BR> (vla-get-activedocument (vlax-get-acad-object))<BR> )<BR> )<BR> (vlax-for ENT SSOBJ<BR> (vla-put-visible ENT :vlax-false)<BR> )<BR> (prompt "\n隐藏所有物件!")<BR> )<BR> )<BR> (princ)<BR>)
;;(CHECK "LUNG")<BR>(defun CHECK (DICT / DICT_KEY ENT LL N)<BR> (setq DICT_KEY (vlax-ldata-list DICT)<BR> N 0<BR> )<BR> (repeat (length DICT_KEY)<BR> (setq LL (cons (car (nth N DICT_KEY)) LL))<BR> (setq N (1+ N))<BR> )<BR> LL<BR>)
;;(DICT_OFF "LUNG" "1")<BR>(defun DICT_OFF (DICT KEY / SS ENT)<BR> (setq SS (cdr (assoc KEY (vlax-ldata-list DICT))))<BR> (foreach ENT SS<BR> (if (and (setq ENT (handent ENT)) (entget ENT))<BR> (vla-put-visible (vlax-ename->vla-object ENT) :vlax-false)<BR> )<BR> )<BR> (princ)<BR>)
;;(DICT_ON "LUNG" "1")<BR>(defun DICT_ON (DICT KEY / SS ENT)<BR> (setq SS (cdr (assoc KEY (vlax-ldata-list DICT))))<BR> (foreach ENT SS<BR> (if (and (setq ENT (handent ENT)) (entget ENT))<BR> (vla-put-visible (vlax-ename->vla-object ENT) :vlax-true)<BR> )<BR> )<BR> (princ)<BR>)
;;(MAKE_DICT "LUNG" "1" (SSGET))<BR>(defun MAKE_DICT (DICT KEY SS / ENAME_LIST N)<BR> (setq N 0)<BR> (repeat (sslength SS)<BR> (setq ENAME_LIST<BR> (cons (cdr (assoc 5 (entget (ssname SS N))))<BR> ENAME_LIST<BR> )<BR> )<BR> (setq N (1+ N))<BR> )<BR> (vlax-ldata-put DICT KEY ENAME_LIST)<BR>)
;;主程序<BR>;;(XSHOW_LAI "LUNG")<BR>(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")))<BR> (progn<BR> (setq N 1)<BR> (vlax-ldata-put (strcat DICT "_N") "N" 1)<BR> )<BR> )<BR> (if (not (setq LIS (vlax-ldata-get (strcat DICT "_LIS") "LIS")))<BR> (progn<BR> (setq LIS '())<BR> (vlax-ldata-put (strcat DICT "_LIS") "LIS" LIS)<BR> )<BR> )
(setq LOOP t)<BR> (setq MSG<BR> "\nE-显示所有/D-隐藏所有/V-显示记录/C-隐藏记录/S-显示上个/F-显示下个/空格-显<BR>示锁定/R-显示解锁/B-显示记录/X-退出/Q-删除标记/Z-清空记录/A-增加隐藏:"<BR> )<BR> (while LOOP<BR> (setq MODE (grread t 4 2))<BR> (prompt MSG)<BR> (cond
((member MODE '((2 13) (2 88) (2 120) (11 0)))<BR> (setq LOOP NIL)<BR> )
((member MODE '((2 65) (2 97))) ;A<BR> (if (CHECK DICT)<BR> (setq KEY (rtos (1+ (last (setq KEY_LIST<BR> (vl-sort (mapcar 'atof (CHECK DICT)) '<)<BR> )<BR> )<BR> )<BR> )<BR> )<BR> (setq KEY "1")<BR> )<BR> (setq LEN (length (vlax-ldata-list DICT)))<BR> ;;(vlax-ldata-put "LUNG" "KEY_LIST" KEY_LIST)<BR> ;;(setq KEY (rtos (1+ (apply 'max (mapcar 'atof (CHECK "LUNG"))))))<BR> (prompt "\n增选隐藏物件:")<BR> (setq S1 (ssget))<BR> (if S1<BR> (MAKE_DICT DICT KEY S1)<BR> )<BR> )
((member MODE '((2 69) (2 101))) ;E<BR> (C:XSHOWALL)<BR> )
((member MODE '((2 100) (2 68))) ;D<BR> (C:XHIDEALL)<BR> )
((member MODE '((2 67) (2 99))) ;C<BR> (setq CHECK_LIST (CHECK DICT))<BR> (mapcar '(lambda (X)<BR> (DICT_OFF DICT X)<BR> )<BR> CHECK_LIST<BR> )<BR> (prompt "\n隐藏所有标记物件!")<BR> )
((member MODE '((2 86) (2 118))) ;V<BR> (setq CHECK_LIST (CHECK DICT))<BR> (mapcar '(lambda (X)<BR> (DICT_ON DICT X)<BR> )<BR> CHECK_LIST<BR> )<BR> (prompt "\n显示所有标记物件!")<BR> )
((member MODE '((2 83) (2 115))) ;S<BR> (if (not (setq N (vlax-ldata-get (strcat DICT "_N") "N")))<BR> (progn<BR> (setq N 1)<BR> (vlax-ldata-put (strcat DICT "_N") "N" 1)<BR> )<BR> )<BR> (if (setq LIS1 (CHECK DICT))<BR> (progn<BR> (setq LEN (length LIS1))<BR> (if (= N (1- LEN))<BR> (setq N 0)<BR> (setq N (1+ N))<BR> )<BR> (DICT_ON DICT (nth N LIS1))<BR> (if (= N 0)<BR> (setq TMPKEY (nth (1- LEN) LIS1))<BR> (setq TMPKEY (nth (1- N) LIS1))<BR> )<BR> (if (not (member TMPKEY LIS))<BR> (DICT_OFF DICT TMPKEY)<BR> )<BR> (vlax-ldata-put (strcat DICT "_N") "N" N)<BR> (prompt (strcat "\n显示第"<BR> (nth N LIS1)<BR> "笔物件,锁定串列="<BR> (vl-prin1-to-string LIS)<BR> )<BR> )<BR> )<BR> )<BR> )
((member MODE '((2 102) (2 70))) ;F<BR> (if (not (setq N (vlax-ldata-get (strcat DICT "_N") "N")))<BR> (progn<BR> (setq N 1)<BR> (vlax-ldata-put (strcat DICT "_N") "N" 1)<BR> )<BR> )<BR> (if (setq LIS1 (CHECK DICT))<BR> (progn<BR> (setq LEN (length LIS1))<BR> (if (= N 0)<BR> (setq N (1- LEN))<BR> (setq N (1- N))<BR> )<BR> (DICT_ON DICT (nth N LIS1))<BR> (if (= N (1- LEN))<BR> (setq TMPKEY (nth 0 LIS1))<BR> (setq TMPKEY (nth (1+ N) LIS1))<BR> )<BR> (if (not (member TMPKEY LIS))<BR> (DICT_OFF DICT TMPKEY)<BR> )<BR> (vlax-ldata-put (strcat DICT "_N") "N" N)<BR> (prompt (strcat "\n显示第"<BR> (nth N LIS1)<BR> "笔物件,锁定串列="<BR> (vl-prin1-to-string LIS)<BR> )<BR> )<BR> )<BR> )<BR> )
((member MODE '((2 32))) ;""<BR> (if (setq LIS1 (CHECK DICT))<BR> (progn<BR> (if<BR> (not (setq LIS (vlax-ldata-get (strcat DICT "_LIS") "LIS"))<BR> )<BR> (progn<BR> (setq LIS '())<BR> (vlax-ldata-put (strcat DICT "_LIS") "LIS" LIS)<BR> )<BR> )<BR> (if (not (member (nth N LIS1) LIS))<BR> (setq LIS (append LIS (list (nth N LIS1))))<BR> )<BR> (vlax-ldata-put (strcat DICT "_LIS") "LIS" LIS)<BR> (prompt (strcat "\n显示锁定串列"<BR> (vl-prin1-to-string LIS)<BR> ",目前显示第"<BR> (nth N LIS1)<BR> "笔物件"<BR> )<BR> )<BR> )<BR> )<BR> )
((member MODE '((2 114) (2 82))) ;R<BR> (if (setq LIS1 (CHECK DICT))<BR> (progn<BR> (if<BR> (not (setq LIS (vlax-ldata-get (strcat DICT "_LIS") "LIS"))<BR> )<BR> (progn<BR> (setq LIS '())<BR> (vlax-ldata-put (strcat DICT "_LIS") "LIS" LIS)<BR> )<BR> )<BR> (if (member (nth N LIS1) LIS)<BR> (setq LIS (vl-remove (nth N LIS1) LIS))<BR> )<BR> (vlax-ldata-put (strcat DICT "_LIS") "LIS" LIS)<BR> (prompt (strcat "\n显示锁定串列"<BR> (vl-prin1-to-string LIS)<BR> ",目前显示第"<BR> (nth N LIS1)<BR> "笔物件"<BR> )<BR> )<BR> )<BR> )<BR> )
((member MODE '((2 122) (2 90))) ;Z<BR> ;|<BR> (setq<BR> KEY_LIST1 (mapcar 'rtos<BR> (vl-sort (mapcar 'atof (CHECK "LUNG")) '<)<BR> )<BR> )|;<BR> ;|<BR> (setq CHECK_LIST (CHECK "LUNG"))<BR> (mapcar '(lambda (X)<BR> (vlax-ldata-delete "LUNG" X)<BR> )<BR> CHECK_LIST<BR> )|;<BR> (initget "Y ")<BR> (if (getkword "\n真的要清除所有标记物件!<N>:")<BR> (progn<BR> (dictremove (namedobjdict) DICT)<BR> (dictremove (namedobjdict) (strcat DICT "_N"))<BR> (dictremove (namedobjdict) (strcat DICT "_LIS"))<BR> (prompt "\n已清除所有标记物件!")<BR> )<BR> (prompt "\n保留标记物件!")<BR> )<BR> )
((member MODE '((2 113) (2 81))) ;Q<BR> (if (setq LIS1 (CHECK DICT))<BR> (progn<BR> (DICT_ON DICT (nth N LIS1))<BR> (vlax-ldata-delete DICT (nth N LIS1))<BR> (prompt (strcat "\n已删除"<BR> (nth N LIS1)<BR> "标记,目前标记"<BR> (vl-prin1-to-string (CHECK DICT))<BR> )<BR> )<BR> (setq N 1)<BR> )<BR> )<BR> )
((member MODE '((2 66) (2 98))) ;B<BR> (prompt<BR> (strcat "\n目前标记" (vl-prin1-to-string (CHECK DICT)))<BR> )<BR> )<BR> )<BR> )<BR> (princ)<BR>)<BR>(prompt "\n超级隐藏/显示工具-------------龙龙仔.2004.1")<BR>(alert<BR> (strcat<BR> "\n\n--------------------------------------------------------------------------"<BR> "\n\n----------------超级隐藏/显示工具(测试版V0)-------------------"<BR> "\n\n---------------------------龙龙仔.2004.1-----------------------------"<BR> "\n\n--------------------------------------------------------------------------"<BR> "\n\nE-显示所有/D-隐藏所有/V-显示记录/C-隐藏记录"<BR> "\n\nS-显示上个/F-显示下个/空格-显示锁定/R-显示解锁"<BR> "\n\nB-显示记录/X-退出/Q-删除标记/Z-清空记录/A-增加隐藏:"<BR> "\n\n--------------------------------------------------------------------------"<BR> "\n\n--------------------(XSHOW_LAI <词典名称>)--------------------"<BR> "\n\n----------------------------C:XSHOWALL----------------------------"<BR> "\n\n----------------------------C:XHIDEALL-----------------------------")<BR>)<BR> http://bbs.mjtd.com/thread-179289-1-1.html
更新使用说明 应该有多种选择的吧,试一下啦,谢谢大神的奉献 先标记一个,后面要深入请教了! 试一下 <A name=43350><FONT color=#000066><B>龙龙仔</B></FONT></A>,说说怎么用呀 我也试 龙龙仔发表于2004-8-16 13:16:00static/image/common/back.gif回复:(龙龙仔)超级隐藏/显示工具 ;;这是无痕的思路(不会用就找他) ...
<BR>晕啊~。。。。 那里晕了,以前你不是有个的展示,借一下可以吗? 8-)<BR> 龙龙仔发表于2004-8-23 8:53:00static/image/common/back.gif那里晕了,以前你不是有个的展示,借一下可以吗? 8-)
<BR>可以,你去找找,我可不记得在哪里了;P 两人倒是谦虚的很啊! 俺也学习学习 人谦虚,东西实在。