明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1542|回复: 4

[基础] 【求助】图层向指定图层转换(帮忙看看错在哪里?)

[复制链接]
发表于 2011-3-24 08:20:39 | 显示全部楼层 |阅读模式
本帖最后由 qcw911 于 2011-3-24 18:09 编辑

大家帮忙看看下面代码为什么有错误呢?
执行不了
如果颜色等4 的话执行do_col4
如果颜色等5的话执行do_col5

(defun c:cl(/ tos_layer layernum ent_se)
;感谢露水2提供
   (setq la '("TOS_S1")
     ent_se (ssget (list  (cons 8 (apply 'strcat (mapcar '(lambda (x) (strcat x ",")) la)))))
  )
              (setq num1(1- (sslength ent_se)))
              (setq n 0)
              (while (<= n num1)
                   (setq sevf (ssname ent_se n))
                   (setq sevd (entget sevf))
                   (setq entype (cdr (assoc 62 sevd)))
  
                   (cond ((= entype 4) (do_col4))
                             ((= entype 5) (do_col5))
         
                   )
                   (setq n(1+ n))
                   )
)
(defun do_col4()
(command "chprop" ent_se "" "LA" "TOS_K1" "LT" "continuous" "C" "BYLAYER" "" )
)
(defun do_col5()
(command "chprop" ent_se "" "LA" "TOS_S1" "LT" "continuous" "C" "BYLAYER" "" )
)

"觉得好,就打赏"
还没有人打赏,支持一下
 楼主| 发表于 2011-3-24 08:33:30 | 显示全部楼层
本帖最后由 qcw911 于 2011-3-24 08:34 编辑

这样改也不行啊
(defun c:cl(/ tos_layer layernum ent_se)

   (setq la '("TOS_S1")
     ent_se (ssget (list  (cons 8 (apply 'strcat (mapcar '(lambda (x) (strcat x ",")) la)))))
  )
;******************************************************
              (setq num1(1- (sslength ent_se)))
              (setq n 0)
              (while (<= n num1)
                   (setq sevf (ssname ent_se n))
                   (setq sevd (entget sevf))
                   (setq entype (cdr (assoc 62 sevd)))
               
                   (IF (= entype 4)
                        
                         (do_col4)
               
                     
                         (do_col5)
                    
                   )
                  
               (setq n(1+ n))
                   )

)
(defun do_col4()
(command "chprop" ent_se "" "LA" "TOS_K1" "LT" "continuous" "C" "BYLAYER" "" )
)
(defun do_col5()
(command "chprop" ent_se "" "LA" "TOS_S1" "LT" "continuous" "C" "BYLAYER" "" )
)
发表于 2011-3-24 16:24:03 | 显示全部楼层
    看不懂,顶下.....
发表于 2011-3-24 21:07:19 | 显示全部楼层
本帖最后由 crazylsp 于 2011-3-24 21:11 编辑

先把5字符化,改成"5"就OK了
 楼主| 发表于 2011-3-25 08:36:25 | 显示全部楼层
crazylsp 发表于 2011-3-24 21:07
先把5字符化,改成"5"就OK了

字符画好像不行啊
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2025-6-10 13:28 , Processed in 0.201484 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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