更改对象(线)LTSCAL
大家好,我一直在尝试创建简单的lisp,它可以实现以下功能1、选择对象(直线、多段线、圆、圆弧等)
2、提示用户输入所需的线型比例
但不幸的是,我的代码没有按我想要的方式工作,我们非常感谢您的帮助。非常感谢。
(defun c:TEST (/ SSET )
(setq sset (ssget))
(command "_.CHANGE" SSET "_P" "LTSCALE" ))
(defun C:test ( / n SS i e enx )
(and
vlax-get-acad-object
(not (initget (+ 2 4)))
(or (setq n (getreal "\nSpecify new LTSCALE value < 1 >: ")) (setq n 1))
(setq SS (ssget "_:L"))
(repeat (setq i (sslength SS))
(setq e (ssname SS (setq i (1- i))))
(vla-put-LinetypeScale (vlax-ename->vla-object e) n)
); repeat
); and
(princ)
) (vl-load-com) (princ)
非常感谢Grrr。干杯
我还尝试了香草:
(defun C:test ( / n SS i e enx )
(and
(not (initget (+ 2 4)))
(or (setq n (getreal "\nSpecify new LTSCALE value < 1 >: ")) (setq n 1))
(setq SS (ssget "_:L"))
(repeat (setq i (sslength SS))
(setq e (ssname SS (setq i (1- i))))
(setq enx (entget e))
(cond
( (assoc 48 enx)
(setq enx (subst (cons 48 n) (assoc 48 enx) enx))
)
( (not (assoc 48 enx))
(setq enx (append (list (cons 48 n)) enx))
)
); cond
(entmod enx) (entupd (cdr (assoc -1 enx)))
); repeat
); and
(princ)
)
现在似乎可以工作了,第一次失败了,所以我放弃了使用VLISP(忘记从第一个代码中删除enx变量)。
仍然不起作用。
编辑:哦,我只需要使用
(not (initget 4))
而不是
(not (initget (+ 2 4)))
页:
[1]