明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2379|回复: 4

块的颜色如何更改?

[复制链接]
发表于 2002-12-1 21:20:00 | 显示全部楼层 |阅读模式
有一些图形文件中用到的块是其它颜色,想用lisp程序统一更改他们的颜色,不知如何实现?
发表于 2002-12-1 23:00:00 | 显示全部楼层

网上有老帖子,用其思路,自己改改。

; convert all the elements of blocks into 0 layer;
; convert all the elements of blocks into 0 layer;

(defun blockconvert( blockname / bn en e)
   (setq bn (tblobjname "block" blockname))
   (setq en (entnext bn))
   (while en
      (setq e (entget en))
      (setq e (subst (cons 8 "0") (assoc 8 e) e))
      (if (assoc 62 e)
          (setq e (subst (cons 62 256)(assoc 62 e) e))
      )
      (entmod e)
      (setq en (entnext en))
   )
   (entupd bn)
)

(defun c:blockConvert(/ bname )
   (ai_undo_push)
   (setq bname (entsel "Select a block:"))
   (setq bname (entget (car bname)))
   (if (= "INSERT" (cdr (assoc 0 bname)))
       (progn
       (setq bname (cdr (assoc 2 bname)))
       (blockconvert bname)
       )
       (princ "\nIt is not a block insert.")
   )
   (princ)
   (ai_undo_pop)
)

最后要regen一下才能看到修改。
 楼主| 发表于 2002-12-2 19:02:00 | 显示全部楼层

谢谢.......

 楼主| 发表于 2002-12-4 22:52:00 | 显示全部楼层

块能用entmod更改吗?

今天看lisp的一本书,讲到块的子图元不能用entmod更改,是这样吗?
发表于 2002-12-5 00:21:00 | 显示全部楼层

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

本版积分规则

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

GMT+8, 2024-9-28 02:15 , Processed in 0.183623 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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