附加值(A-B)=C
你好我正在搜索LISP以选择文本“A”值和文本“B”值,并单击“C”文本,然后文本“C”应自动更新为(A-B)作为此公式。
例如,如果选择文本“A”并选择文本“B”,则文本A为“17.010”,文本B为“14.668”,并且选择“C”的值自动更新为“2.342”
这意味着(A-B)=C(17.010-14.668)=2.342
应重新查询最多3个设计值。
这可能吗
谢谢 这可能对你有所帮助。
如果你点击了一个文本,它将从一开始返回(在调用例程时阅读命令行)
(defun c:sub (/ ss1 ss2 ss3 st1 st2 st3 e)
; Tharwat 20.01.2011
(while
(not (and (setq ss1
(car (entsel "\n Select first text to subtract from :")))
(setq ss2
(car (entsel "\n Select second text :")))
(setq ss3
(car (entsel "\n Select text to insert the result:")))
))
)
(progn
(setq st1
(cdr (assoc 1 (entget ss1))))
(setq st2
(cdr (assoc 1 (entget ss2))))
(setq st3
(cdr (assoc 1 (setq e (entget ss3)))))
(entupd (cdr
(assoc -1
(entmod (subst
(cons 1 (rtos (- (distof st1) (distof st2)) 2 3))
(assoc 1 e)
e)
)
)
)
)
)
(princ)
)
一个注释,OP请求一个带3位小数的双精度,因此您可能希望在代码中使用DISTOF而不是ATOI;此函数还允许您验证字符串的内容。ITOA和RTOS也是如此。非常感谢。
当做
米尔恰 没错,米尔恰。
谢谢,代码已更新。
当做
塔瓦特 http://www.cadtutor.net/forum/showthread.php?46688-组合值。LSP加、除、乘、减对象值
页:
[1]