帮忙看看这个问题吧
我需要将上千张图纸中的图块名“拐点”的x、y的比例改为12,我有批量运行LISP的程序,请高手帮我弄一弄这个程序,目标是程序不要提示输入块名 ,也不要提示输入比例值,运行程序,输入命令,就能将图块“拐点”的x、y的比例改为12。谢谢! 帮我修改者留下邮箱,我赠送批量运行LISP的VB程序。LISP我不会,再次感谢!(defun c:gbsc()
(setvar "cmdecho" 0)
(setq <xor (CONS -4 "<XOR")
xor> (CONS -4 "XOR>") )
(setq <and (cons -4 "<and")
and> (cons -4 "and>") )
(setq <or (cons -4 "<OR")
or> (cons -4 "OR>") )
(initget (+ 2 4) "De All")
(setq kword (getkword "D 单个图块 / A <全部图块> :" ))(PRINT)
(cond ((or (= kword "All")(= kword nil))
(setq enst (ssget "x" (list (cons 0 "insert"))))
(setq p 0)
(if enst
(progn
(setq scale_b (getreal "输入图块比例尺:"))(PRINT)
(while (< p (sslength enst))
(setq enst_block (ssname enst p))
(setq block_table (entget enst_block))
(setq block_table (subst (cons 41 scale_b) (assoc 41 block_table) block_table))
(setq block_table (subst (cons 42 scale_b) (assoc 42 block_table) block_table))
(setq block_table (subst (cons 43 scale_b) (assoc 43 block_table) block_table))
(entmod block_table)
(setq p (1+ p))
)
);progn
);if
(if (not enst) (alert "没有选中任何物体 !"))
)
((= kword "De")
(setq bname (getstring "输入块名:"))(PRINT)
(setq enst (ssget "x" (list <and (cons 0 "insert")(cons 2 bname)and>)))
(setq p 0)
(if enst
(progn
(setq scale_b (getreal "输入图块比例尺:"))(PRINT)
(while (< p (sslength enst))
(setq enst_block (ssname enst p))
(setq block_table (entget enst_block))
(setq block_table (subst (cons 41 scale_b) (assoc 41 block_table) block_table))
(setq block_table (subst (cons 42 scale_b) (assoc 42 block_table) block_table))
(setq block_table (subst (cons 43 scale_b) (assoc 43 block_table) block_table))
(entmod block_table)
(setq p (1+ p))
)
);progn
);if
(if (not enst) (alert "没有选中任何物体 !"))
)
);cond
(PRINC)
);DEFUN
试试!(defun c:t11 nil
(if (setq a -1 ss (ssget "x" '((0 . "insert")(2 . "拐点"))))
(while (setq en (ssname ss (setq a (1+ a))))
(entmod(subst '(42 . 2) (assoc 42 (entget en)) (entget en)))
)
)
) wowan1314 发表于 2013-8-20 19:43 static/image/common/back.gif
试试!
嗯 好的 wowan1314 发表于 2013-8-20 19:43 static/image/common/back.gif
试试!
X,Y都改了 局部变量不会产生碰到矛盾吗 Y~_H_~K 发表于 2013-8-20 21:51 static/image/common/back.gif
X,Y都改了 局部变量不会产生碰到矛盾吗
那就不要局部变量算啦。(defun c:t11 nil
(mapcar
''((x)(entmod(subst '(42 . 2) (assoc 42 (entget x)) (entget x))))
(mapcar 'cadr (ssnamex (ssget "x" '((0 . "insert")(2 . "拐点")))))
)
) wowan1314 发表于 2013-8-20 22:11 static/image/common/back.gif
那就不要局部变量算啦。
嗯好的 谢了
页:
[1]