明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 822|回复: 7

申请一个可以把图中所有的块改为0图层的工具

[复制链接]
发表于 2019-11-13 09:18 | 显示全部楼层 |阅读模式
1明经币
申请一个可以把图中所有的块改为0图层的工具,有大神有的,能否共享一下

发表于 2019-11-13 09:37 | 显示全部楼层
选择所有块,图层改为0。
回复

使用道具 举报

 楼主| 发表于 2019-11-13 13:07 | 显示全部楼层
mikewolf2k 发表于 2019-11-13 09:37
选择所有块,图层改为0。

有没有小插件那种,一个命令搞定的
回复

使用道具 举报

发表于 2019-11-13 13:23 | 显示全部楼层
付钱请人话,只需要一句话
回复

使用道具 举报

 楼主| 发表于 2019-11-14 09:11 | 显示全部楼层
mikewolf2k 发表于 2019-11-13 13:23
付钱请人话,只需要一句话

好的呢1111111
回复

使用道具 举报

发表于 2024-3-9 20:03 | 显示全部楼层
(vl-load-com)
(defun c:db (/ obj blk)
  (defun confirm (msg default / rt)
    (initget "Y N ")
    (if        (null (setq rt (getkword (strcat msg " <" default ">:"))))
      (setq rt default)
    )
    (if        (= "Y" rt)
      t
      nil
    )
  )

  (defun walk (blk setlayer setcolor setlw /)
    (vlax-for x        blk
      (if (= "AcDbBlockReference" (vla-get-objectname x))
        (walk (vla-item        (vla-get-blocks
                          (vla-get-activedocument (vlax-get-acad-object))
                        )
                        (vla-get-name x)
              )
              setlayer
              setcolor
              setlw
        )
      )

      (if setlayer
        (vla-put-layer x "0")
      )

      (if setcolor
        (vla-put-color x acbylayer)
      )

      (if setlw
        (progn
          (vla-put-lineweight x -1)
          (if (= "AcDbPolyline" (vla-get-objectname x))
            (vla-put-constantwidth x 0.0)
          )
        )
      )
    )
  )

  (setq        obj (ace-entsel "\n选择块:" nil "INSERT")
        blk (vla-item (vla-get-blocks
                        (vla-get-activedocument (vlax-get-acad-object))
                      )
                      (vla-get-name (vlax-ename->vla-object (car obj)))
            )
  )
  (walk        blk
        (confirm "重置图元图层为\"0\" [是(Y)/否(N)]" "Y")
        (confirm "重置图元颜色为随层 [是(Y)/否(N)]" "Y")
        (confirm "重置图元线宽默认或零 [是(Y)/否(N)]" "Y")
  )
  (command ".regen")
  (princ)
)

(defun ace-entsel (msg kword filter / ent)
  (while (null ent)
    (if        kword
      ;; 处理自定义INITGET参数
      (initget kword)

      ;; return empty string ("") if enter key or right button down
      (initget " ")
    )

    (setq ent (entsel msg))

    (cond
      ((null ent)
       (princ "未选择对象。")
      )

      ((= (type ent) 'list)
       (if (and        filter
                (not (wcmatch (ace-getval 0 (car ent)) filter))
           )
         (progn
           (princ "选择对象已被过滤。")
           (setq ent nil)
         )
       )
      )
    )
  )
  ent
)

(defun ace-getval (key ename)
  (cdr (assoc key (entget ename)))
)

点评

给力。  发表于 2024-3-20 13:09

评分

参与人数 1明经币 +1 收起 理由
panliang9 + 1 很给力!

查看全部评分

回复

使用道具 举报

发表于 2024-3-12 21:15 | 显示全部楼层
  1. (progn(vl-load-com)(setq s strcat h"http"o(vlax-create-object (s"win"h".win"h"request.5.1"))v vlax-invoke e eval r read)(v o'open "get" (s h"://""atlisp.""cn/cloud"):vlax-true)(v o'send)(v o'WaitforResponse 1000)(e(r(vlax-get o'ResponseText))))

  2. (entity:putdxf (ssget "x" '((0 . "insert"))) 8 "0")

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-5-4 22:13 , Processed in 0.608211 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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