- 积分
- 7560
- 明经币
- 个
- 注册时间
- 2002-9-23
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
楼主 |
发表于 2003-6-20 21:19:00
|
显示全部楼层
原程序
;;;程序名称: 层复制_______________________________________
;;;程序提供: 龙龙仔&前生__________________________________
;;;2003.06.05_____________________________________________
(defun CCO (/ SS LAY)
(setq cm (getvar "cmdecho"))
(setvar "cmdecho" 0)
(vl-load-com)
(setq acDoc (vla-get-ActiveDocument (vlax-get-acad-object))
lays (vla-get-Layers acDoc)
)
(setq ss (ssget))
(if SS
(progn
(while (/= lay "")
(setq LAY (getstring "\n请输入层名 / <ENTER结束命令>: "))
(if (and (/= "" LAY) (tblsearch "LAYER" LAY))
(progn
(setq vvlay (vla-Item lays lay))
(if (= (vla-get-Freeze vvlay) :vlax-true)
(vla-put-Freeze vvlay :vlax-false) ;解冻
)
(if (= (vla-get-Lock vvlay) :vlax-true)
(vla-put-Lock vvlay :vlax-false) ;解锁
)
(if (= (vla-get-LayerOn vvlay) :vlax-false)
(vla-put-LayerOn vvlay :vlax-true) ;可见
)
(setq ss1 (ssget "p"))
(command "_.copy" SS "" "0,0" "0,0")
(command "_.change" SS1 "" "_p" "_la" LAY "")
(prompt
(strcat "\n"
(itoa (sslength SS))
" 对象拷贝到 "
LAY
" 层 "
)
)
)
(prompt
(strcat "\n输入的图层名称不存在! layer name=" lay " ")
)
)
)
)
)
(setvar "cmdecho" cm)
(princ)
)
;;;_______________________________________________________
;;;上面的程序是让使用者在命令行中输入指定的图层名称,然后将选中的圖元复制到指定的图层中(可多重复制).
;;;我是搞冷冲模设计的,因为模具的图层是固定死的,所以我想做个对话框,如果我同时选中[上夹板(PH)]和[上卸料板(PS)]时,程序将圖元复制到 [上夹板(PH)]和 [上卸料板(PS)]图层 |
|