本帖最后由 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 "移动完成")
- ;示例二
- ;copy move addtext 三合一(你想咋玩都行)
- (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))
- )
- )
- )
- )
- )
|