查看单个帖子
旧 2009-04-27, 06:55 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】cad中自动按颜色分层的lsp

cad中自动按颜色分层的lsp
www.dimcax.com
cad中自动按颜色分层的lsp
哪位好心人帮帮我,先谢谢!
我每天的工作就是从proe中建好3d后转成2d,每次都得用到quick select去设置按颜色分层,然后purge.
我想要的动作如下:
1步:explode 图面中所有块(这此块是proe自动生成,这样才能下面quick select去设置按颜色分层)
2步:purge掉多余不相干的东东,剩下的东西下一步
3步:建新层名“56”color: 5 (blue) linetype:continuous linetype: "bylayer"
4步:建新层名“1”color: 7 (white) linetype:continuous linetype: "bylayer"
5步:建新层名“41”color: 3 (green) linetype:continuous linetype: "bylayer"
6步:建新层名“51”color: (magenta) linetype:center linetype: "bylayer"
7步:tools\quick select , 筛选出图中所有为blue色的东西规为 第2步新建的“56”层
8步:筛选出图中所有为除了blue色的东西规为 第3步新建的“1”层
执行完结果是:只有四个层:“1”“56”“41”“51”颜色不同区分,并筛选出blue为“56”层,其它色均改为白色放到“1”层
“41”&“51”层内没有东西。
我的邮箱是 (15 k) 下载次数:3

学习一下

班主能不能帮帮忙?谢谢!

name.dwg and lisp 程序需置於支援路徑下
(defun c:test ()
(command "insert" "name" ^m)
(ssget "x" '((2 . "sss")))
(command "chprop" "p" "" "layer" "56" "")
(ssget "x" '((8 . "0")))
(command "chprop" "p" "" "layer" "1" "")
)

谢谢,谢谢!
请问(ssget "x" '((2 . "sss"))) 是什么意思,是选择nr所有蓝色物体吗?
还问一下,请问我要实现explode 所有物体,lsp代码是什么?
谢谢你的帮忙。

"sss" 是所附 drw0001.dwg 中之图块名称
--------------------------
;; ss ==> 所有物体
(setvar "qaflags" 1)
(command ".explode" ss "")
(setvar "qaflags" 0)

弱弱地再问一下,请问如果我要处理的图面中没有sss块,而是已炸开了的图元,请问我要选择所有蓝色图元,
(ssget "x" '((2 . "sss"))) 这句要改成什么?因为我看不懂ssget这个函数用法

选择所有蓝色图元
(ssget "x" '((62 . 5)))

谢谢,真是热心人,谢谢你, 在你的帮忙下,以下是我的最终代码
(defun c:test ()
(command "explode" (ssget "x") "")
(command "purge" "a" "*" "n")
(command "insert" "name" ^m)
(ssget "x" '((62 . 5)))
(command "chprop" "p" "" "layer" "56" "")
(ssget "x" '((8 . "0")))
(command "chprop" "p" "" "layer" "1" "")
)
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)