(defun c:tt (/ b c doc lays p p0)
(princ "\n选择对象")
(if (and (ssget)
(setq p (getpoint "\n点取基点:"))
(setq p (vlax-3D-point p))
(setq p0 (vlax-3D-point 0 0 0))
)
(progn
(setq doc (vla-get-ActiveDocument(vlax-get-acad-object)))
(setq lays (vla-get-Layers doc))
(vlax-for a (vla-get-activeselectionset doc)
(setq b (vla-Item lays (vla-get-Layer a)))
(setq c (vla-get-Lock b))
(vla-put-Lock b :vlax-false)
(vla-Move a p p0)
(vla-put-Lock b c)
)
)
)
)波总代码
(defun c:tt (/ p s ss)
(princ "\n选择对象")
(if (and (setq s (ssget))
(setq p (getpoint "\n点取基点:"))
)
(progn
(vlax-for a (vla-get-Layers (vla-get-ActiveDocument(vlax-get-acad-object)))
(setq ss (cons (list a (vla-get-Lock a)) ss))
)
(foreach x ss (vla-put-Lock (car x) :vlax-false))
(command "MOVE" s "" "non" p "non" '(0 0))
(foreach x ss (apply 'vla-put-Lock x))
)
)
)
(defun c:tt (/ b c doc lays p p0)
(princ "\n选择对象")
(if (and (ssget)
(setq p (getpoint "\n点取基点:"))
(setq p (vlax-3D-point p))
(setq p0 (vlax-3D-point 0 0 0))
)
(progn
(setq doc (vla-get-ActiveDocument(vlax-get-acad-object)))
(setq lays (vla-get-Layers doc))
(vlax-for a (vla-get-activeselectionset doc)
(setq b (vla-Item lays (vla-get-Layer a)))
(setq c (vla-get-Lock b))
(vla-put-Lock b :vlax-false)
(vla-Move a p p0)
(vla-put-Lock b c)
)
)
)
)
(defun c:tt (/ b c doc lays p p0)
(princ "\n选择对象")
(if (and (ssget)
(setq p (getpoint "\n点取基点:"))
(setq p (vlax-3D-point p))
(setq p0 (vlax-3D-point 0 0 0))
)
(progn
(setq doc (vla-get-ActiveDocument(vlax-get-acad-object)))
(setq lays (vla-get-Layers doc))
(vlax-for a (vla-get-activeselectionset doc)
(setq b (vla-Item lays (vla-get-Layer a)))
(setq c (vla-get-Lock b))
(if (= :vlax-false c)
(vla-Move a p p0)
(progn
(vla-put-Lock b :vlax-false)
(vla-Move a p p0)
(vla-put-Lock b c)
)
)
)
)
)
)