明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1943|回复: 9

一个十分方便的关闭层的小程序

[复制链接]
发表于 2006-1-19 23:21 | 显示全部楼层 |阅读模式
(defun c:ff(/ pt ss w e l )
  (setq oer *error* *error* myerr)
  (setvar "cmdecho" 0)
  (setq ss (entsel "\n点取层中某一物体:"))
  (while ss
     (setq w (getvar "clayer"))
     (if (= (type ss) 'list)
       (progn
         (setq e (entget (car ss)) L (cdr (assoc 8 e)))
         (if (eq l w) (command "layer" "off" l "y" "")
           (command "layer" "off" l "")
         )
         (princ (strcat "    (" l "层已被关闭)"))
       )
     )
     (initget "U")
     (setq ss (entsel "\nU/<点取层中某一物体>:"))
     (if (eq ss "U") (command "u"))
  )
  (setq *error* oer)
  (princ "\n        
发表于 2006-1-20 09:08 | 显示全部楼层
发表于 2006-9-17 19:29 | 显示全部楼层
好呀
发表于 2006-9-18 15:24 | 显示全部楼层

好呀好呀!!!

发表于 2006-9-21 10:31 | 显示全部楼层

加载后提示字符串有缺陷!

发表于 2006-9-21 13:43 | 显示全部楼层

(defun c:test(/ ss nn st lay)
  (setvar "cmdecho" 0)
  (command ".undo" "be")
  (princ "请选择欲关闭图层中的对象 < 可框选 >:")
  (if (setq ss (ssget))
    (progn
      (setq nn (sslength ss) st 0)     
      (repeat nn
        (setq lay (cdr (assoc 8 (entget (ssname ss st)))))
        (if (or (= (strcase lay) (getvar "clayer"))(= lay (getvar "clayer")))
          (command ".layer" "off" lay "y" "")
          (command ".layer" "off" lay "")
        )
        (setq st (1+ st))
      )
    )
    (princ "\n没有选中物件.")
  )
  (command ".undo" "e")
  (prin1)
)

发表于 2006-9-28 12:57 | 显示全部楼层
好用吗?
发表于 2006-9-28 16:48 | 显示全部楼层

能告诉我怎么用吗

发表于 2006-9-29 08:21 | 显示全部楼层

楼主,什么东西都用不了呢,请解释!!!!!!!?????????

发表于 2006-11-4 21:46 | 显示全部楼层
楼主的LSP不完整,不过6楼的哥们儿的做的不错!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-4-28 00:42 , Processed in 0.449292 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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