I created a function to facilitate the move.
But if the move is the same exact distance & direction from the first
pick for the move as the pick point is from the origin (0 0 0) the routine
will not permit this move.
Example: pick at 12,12 moved to 24,24 will not be allowed
Too bad there is not a way to get the last input, if we had a function like
(lastkey) that returned the last key press or neg number if mouse or tablet
button was pressed.
;;;=======================[ Move_Only.lsp ]=======================
;;; Author: Copyright© 2005 Charles Alan Butler
;;; Version: 1.0 July 7, 2005
;;; Purpose: move an entity or ss, do not allow user to press enter
;;; Usage : (move_only ss msg basept)
;;; Arguments:
;;; ss ss or ent to move
;;; msg msg to user before move, may be nil
;;; basept first point of move, may be nil
;;; Returns: -list (start_point end_point) of move
;;;==============================================================
(defun move_only (ss basept msg / ent stpt loop newpt)
;; return sum of 3d points
(defun sum_pts (op p1 p2)
(list
(apply op (list (car p2) (car p1)))
(apply op (list (cadr p2) (cadr p1)))
(apply op (list (caddr p2) (caddr p1)))
)
)
;; return a point, lower left box coordinates
(defun getref (ent / ll ur)
(vla-getboundingbox (vlax-ename->vla-object ent) 'll 'ur)
(vlax-safearray->list ll)
)
(if (= (type ss) 'PICKSET)
(setq ent (ssname ss 0))
(setq ent ss)
)
(setq stpt (getref ent)) ; get start ref point (lower left of ent)
(if (null basept) ; pisk start point of move
(while (or (null (setq basept (getpoint "\nPick base point of move.")))
(/= (type basept) 'LIST))
(prompt "\n*** Error, you must pick a start point.")
)
)
(setq loop t) ; loop flag
(while loop
(if msg (princ msg) )
(command "._move" ss "" basept pause)
(setq newpt (getref ent)) ; new start point
(if (>= 0.0001 (distance (setq offset (sum_pts '+ stpt basept)) newpt))
;; if ss moved via vector point--1 then ENTER was pressed
(progn ; move ss back and make user move again
(prompt "\n*** Error, you must pick a distination point.")
;(command "._move" ss "" "non" newpt "non" stpt)
(command "._undo" "")
)
;; ELSE point was picked, ok to exit loop
(setq loop nil)
)
)
(list basept (sum_pts '+ basept (sum_pts '- stpt newpt)))
)