MOVE动态移动,将一个命令掰开玩儿
本帖最后由 dcl1214 于 2023-10-16 11:09 编辑;示例1
(setq ent (car (entsel)))
(setq pt (getpoint))
(vl-cmdf "move" ent "")
(while (= 1 (logand 1 (getvar 'cmdactive)))
(vl-cmdf pt "\\")
(setq pts (append pts (list (getvar 'lastpoint))))
)
(alert "移动完成")
;示例二
;copymoveaddtext三合一(你想咋玩都行)
(and (setq c (car (entsel "请选择一个圆")))
(setq obj (vlax-ename->vla-object c))
(setq pt-C (vlax-safearray->list
(vlax-variant-value (vla-get-center OBJ))
)
)
)
(if (and obj
pt-C
(SETQ PT (GETPOINT "请点击鼠标左键开始绘制直线"))
)
(progn (setq i 1)
(vl-cmdf "_.pline" "non" pt)
(setq e-L (entlast))
(while (= 1 (logand 1 (getvar 'cmdactive)))
(vl-cmdf "\\")
(if (= 1 (logand 1 (getvar 'cmdactive)))
(progn
(setq p (getvar 'lastpoint))
(setq obj-new (vla-copy obj))
(vla-move obj-new
(vlax-3d-point pt-C)
(vlax-3d-point p)
)
(vla-AddText
(vla-get-modelSpace
(vla-get-ActiveDocument (vlax-get-acad-object))
)
(itoa i)
(vlax-3d-Point p)
6
)
(setq i (1+ i))
)
)
)
)
)
(vl-cmdf "move" (Car(entsel)) "" (getpoint) pause)就行,没必要折腾 kozmosovia 发表于 2023-10-16 10:29
(vl-cmdf "move" (Car(entsel)) "" (getpoint) pause)就行,没必要折腾
你没看懂
请看下面代码
(if (SETQ PT(GETPOINT))
(progn (vl-cmdf "_.pline" "non" pt)
(setq e-L (entlast))
(while (= 1 (logand 1 (getvar 'cmdactive)))
(vl-cmdf "\\")
)
)
) 本帖最后由 dcl1214 于 2023-10-16 10:36 编辑
while里面可以加各种其他代码,这是一种写法,可以让一个命令拆开,并在中间加各种逻辑代码 很有意思!
页:
[1]