简单移动命令问题
我是AutoLISP的初学者,由于某些原因,我无法正确使用这个移动命令。我所要做的就是选择交叉窗口中从(12,0)到(0,4)的所有内容,并将其全部向右移动12英寸。这就是我所拥有的,但当我运行程序时,它只是抓住标题栏,并将其他所有内容保留在原位。
(命令“move”“12,0”“0,4”“@”“@12,0”)
我需要使用ssget或其他一些选择命令来选择多个实体吗?
提前谢谢。 有很多方法可以做到这一点,例如:
(setq wpt1 '(12 0)
wpt2 '(0
4)
disp
12
ang 0
movept (mapcar '+ wpt1 (list disp 0));;you can use instead : move pt (list (+
(car wpt1 disp)(cadr wpt1)))
)
(command
"move" (ssget "w" wpt1 wpt2) "" "_non" wpt1 "_non" movept)
这段代码也应该有效
(command "_select" "_w" "12,0" "0,4" "" "move" "_p" "" "@" "@12,0") 另一个
(defun c:test (/ ss l sset)(vl-load-com)
(if (setq ss (ssget "_w" '(12. 0. 0.) '(0. 4. 0.)))
(repeat
(setq l (sslength ss))
(setq sset (ssname ss (setq l (1- l))))
(vla-move (vlax-ename->vla-object sset)
(vlax-3d-point 0. 0. 0.)
(vlax-3d-point 12. 0. 0.)
)
)
)
(princ)
)
Tharwat 这不应该是交叉窗的“c”吗? 我会这样做:
(defun c:test ( / ss )
(if (setq ss (ssget "_C" '(12.0 0.0) '(0.0 4.0)))
(command "_.move" ss "" "_non" '(0. 0. 0.) "_non" '(12. 0. 0.))
)
(princ)
)
因为ssget将提供更通用、更可靠的选择。 哇,我太离谱了。
谢谢你的帮助,这些效果很好。 哇哇,如果我添加另一种方法,使5种不同的方式做一个简单的动作,这是否打破了纪录。
(defun C:CHX ()
(SETVAR "CMDECHO" 0)
(setq sn (getvar "osmode"))
(command "osnap" "near")
(setq x 0)
(princ "\nalters object in X direction")
(setq ht (getstring "\n What is amount of change: "))
(setq newht (strcat ht ",0"))
(while (= x 0)
(setq newobj (entsel "\nPoint to object: "))
(if (/= newobj nil)
(progn
(command "move" newobj "" "0,0" newht)
))
(if (= newobj nil)(setq x 1))
)
)
很抱歉偏离了轨道。
页:
[1]