yhly555 发表于 2015-6-3 10:52:35

关于批量选择图块的问题

本帖最后由 yhly555 于 2015-6-3 10:58 编辑

为什么我这样写不能选择到指定块名称的图块呢?谢谢!(defun c:tt (mane)
   (ssget "X" (list '(0 . "insert") (cons 2 mane)))
)

(c:tt "gc177")

Andyhon 发表于 2015-6-3 11:34:49

这样能选到吗?
(setqmane "gc177")
(ssget "X" (list '(0 . "insert") (cons 2 mane)))

yhly555 发表于 2015-6-3 11:42:53

Andyhon 发表于 2015-6-3 11:34 static/image/common/back.gif
这样能选到吗?
(setqmane "gc177")
(ssget "X" (list '(0 . "insert") (cons 2 mane)))

我试了也不行,且这样的话不带参数,我是想写成带参数的。

琴剑江山_10184 发表于 2015-6-3 13:53:45

本帖最后由 琴剑江山_10184 于 2015-6-3 13:57 编辑

yhly555 发表于 2015-6-3 11:42 static/image/common/back.gif
我试了也不行,且这样的话不带参数,我是想写成带参数的。
(defun c:tt (/ EN GE SEL)
(princ "\n功能 [选择相同块名]")
(and (setq seL (entsel "\n选择源图块:"))
       (progn
(setq en (cdr (assoc 2 (entget (car seL))))
      ge (ssget "x" (list '(0 . "INSERT") (cons 2 en))))   
)
       (if (> (sslength ge) 0) (sssetfirst nil ge))
       )
(princ)
)
你的要这样定义函数
(defun tt (mane)
(if (setq ii (ssget "X" (list '(0 . "insert") (cons 2 mane))))
    (sssetfirst nil ii)
)
)


(tt "块名")

Andyhon 发表于 2015-6-3 17:01:41

...我试了也不行...

这个得有 '不行 的调试图面供验证

xyp1964 发表于 2015-6-4 19:47:53

(defun tt (name)(ssget "X" (list '(0 . "insert") (cons 2 name))))
页: [1]
查看完整版本: 关于批量选择图块的问题