- 积分
- 7470
- 明经币
- 个
- 注册时间
- 2010-8-7
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
5明经币
源程序如下
功能是把选择放入0-建筑底图中
(defun c:0T()
(setq ceng "0-建筑底图")
(PRINC "\n---将所选对象设置为")(princ ceng)(PRINC ",属性随层")
(if (= (TBLOBJNAME "LAYER" ceng) nil)
(command "layer" "n" ceng "c" "8" ceng "lt" "" "bylayer" ""))
(while(setq a (ssget":s"))
(setvar "cmdecho" 0)
(command "change" a "" "p" "c" "bylayer" "la" ceng "lw" "bylayer" "")
)
(command "clayer" ceng)
(PRINC "\n---将所选对象设置为")(princ ceng)(PRINC ",属性随层")
(princ)
)
发现问题,如果某层已经设置线型,并在图中linetype 为bylayer情况下, 切换到0-建筑底图 层中,原有线型就会消失
希望大神改进
思路
(defun c:0T()
(setq ceng "0-建筑底图")
(PRINC "\n---将所选对象设置为")(princ ceng)(PRINC ",属性随层")
(if (= (TBLOBJNAME "LAYER" ceng) nil)
(command "layer" "n" ceng "c" "8" ceng "lt" "" "bylayer" ""))
(while(setq a (ssget":s"))
(setvar "cmdecho" 0)
判断物体所在图层是否已经设置非continue的线型,如果是
将物体linetype转换为图层所设置的线型
(command "change" a "" "p" "c" "bylayer" "la" ceng "lw" "bylayer" "")
)
(command "clayer" ceng)
(PRINC "\n---将所选对象设置为")(princ ceng)(PRINC ",属性随层")
(princ)
)
跪求大神完善或者提供更好的源码
|
最佳答案
查看完整内容
(defun c:0T (/ ceng ss en dxf lt)
(setvar "cmdecho" 0)
(setq ceng "0-建筑底图")
(princ (strcat "\n---将所选对象设置为" ceng ",属性随层"))
(if (not (tblsearch "layer" ceng))
(command "_layer" "m" ceng "c" "8" ceng "lt" "Continuous" ceng "")
(command "layer" "s" ceng "c" "8" "" "lt" "Continuous" ceng "")
)
(while (setq ss (ssget ":s"))
(repeat (setq n (sslength ss))
(setq e ...
|