sky899150 发表于 2024-3-22 09:32:56

gaics 发表于 2021-11-23 13:14
(entsel "选择一条直线:"))后面多个括号。vla-put-layer括号不匹配
entsel一次就够了



(DEFUN C:jz1()全部图层加前缀并将0图层归于jz-0
    (setvar "cmdecho" 0)
(vl-load-com)
(setq pre "jz-")
(setq        doc    (vla-get-activedocument
               (vlax-get-acad-object)
             )
        layers (vla-get-layers doc)
)
(vlax-for lay        layers
    (setq lname (vla-get-name lay))
    (if        (not (member lname '("0" "Defpoints")))
      (vla-put-Name lay (strcat pre lname))
    )
(command "-layer" "N" "jz-0" "")
(setq lst '(("0" "jz-0")
            
             )
)
(foreach a lst
    (if (setq ss (ssget "x" (list (cons 8 (car a)))))
      (command "change" ss "" "p" "la" (cadr a) "c" "bylayer" "")
    )
)

)
)
大师帮我看看这个代码呢对于复杂点的图纸 就一直卡着呢,我想全部图层加前缀并将0图层上的图元归于jz-0
页: 1 [2]
查看完整版本: 更改单个图元图层到指定图层的代码,求诊断