明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 3078|回复: 11

[函数] 让对象从屏上消失与再现

[复制链接]
发表于 2011-3-26 15:28 | 显示全部楼层 |阅读模式
;;;这是ac_bonus.lsp内的一个子程序。我对理解了的进行了注示;不理解的,等着你来
;;;这里面有许多程序,可以借用和拿来学习,不用动脑筋去思考

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;60为图元可见性,1不可见
;;示例(setq a (ssget))
;;;(ss_visible a 1)选择对象不见,(ss_visible a 0)又可见了
(defun ss_visible ( ss code / na e1 n)
(if ss
     (progn
      (setq n 0)
      (repeat (sslength ss)
       (setq na (ssname ss n)
             e1 (entget na)
       );setq
       (if (not (assoc 60 e1))
           (setq e1 (append e1 (list (cons 60 code))));setq then
           (setq e1 (subst (cons 60 code) (assoc 60 e1) e1));setq else
       );if
       (entmod e1)
       (entupd na)
       (setq n (+ n 1));setq
      );repeat
     );progn
);if
);defun ss_visible

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x

评分

参与人数 1金钱 +50 收起 理由
mccad + 50 好程序

查看全部评分

"觉得好,就打赏"
还没有人打赏,支持一下
发表于 2021-3-24 15:35 | 显示全部楼层
感谢楼上分享!
发表于 2019-7-5 16:25 | 显示全部楼层
感谢楼上分享!
 楼主| 发表于 2011-3-26 15:30 | 显示全部楼层
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Str2lst - string to list
;Takes two string arguments. A delimiter or token and the main string.
;Returns a list of sub-strings from the main string.
;(setq b "人之初" c "之"),(str2lst b c)返回("之");(str2lst c b)返回("人" "初")
(defun str2lst ( a b / n c lst lst2 leng)

(setq lst (strsea a b)
        n 0
);setq
(if lst
    (progn
     (setq c (substr b
                     1
                     (-
                        (nth 0 lst)
                        1
                     );minus
             );substr
     );setq
     (setq lst2 (append lst2 (list c)));setq
     (repeat (- (length lst) 1)
     (setq leng (-
                   (nth (+ n 1) lst)
                   (nth n lst)
                   (strlen a)
                );minus
             c        (substr b
                        (+
                           (nth n lst)
                           (strlen a)
                        );plus
                        leng
                );substr
     );setq
     (setq lst2 (append lst2 (list c)));setq
     (setq n (+ 1 n));setq
     );repeat
     (setq c (substr b
                     (+
                        (nth n lst)
                        (strlen a)
                     );plus
             );substr
     );setq
     (setq lst2 (append lst2 (list c)));setq
    );progn then
    (setq lst2 (append lst2 (list b)));setq else
);if

lst2
);defun str2lst
发表于 2011-3-27 23:56 | 显示全部楼层
感谢共享,
发表于 2011-4-22 07:09 | 显示全部楼层
谢谢楼主的分享
收藏下来看看学习学习
谢谢
发表于 2011-4-22 11:04 | 显示全部楼层
感谢楼主分享学习!
发表于 2011-4-22 16:21 | 显示全部楼层
好东西,感谢分享。
发表于 2011-4-22 17:37 | 显示全部楼层
好程序,学习了
发表于 2011-4-23 18:56 | 显示全部楼层
本帖最后由 啵浪鼓 于 2011-4-23 18:57 编辑

1楼程序挺好的,隐藏那全开图层也没法打开,不知道的人都不知道图档里还有被隐藏的东东!

不过,输出"erase"  "all" 可以删除掉!
发表于 2011-4-24 15:44 | 显示全部楼层
感谢,学习下
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-5-3 14:40 , Processed in 1.218247 second(s), 30 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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