- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi all!
To start, I've researched this a bit and found a lot that dances around what I need, but nothing spot on.
Please see the code below:
(defun c:FIXALIGN ( / SScounter MOVEcounter objectList moveDistanceList
toPoint objectSS objectName moveDistance)
(setvar "cmdecho" 0)
(setq SScounter 0)
(setq MOVEcounter 0)
(setq objectsList ())
(setq moveDistanceList ())
(setq toPoint (car (getpoint "Select a point to align with")))
(while (< SScounter 2) ;;;will need to exited via pressing ENTER
(setq objectSS (ssget "_:S"))
(setq objectName (ssname objectSS 0))
(setq objectList (append objectList (list objectName)))
(setq objectPoint (car (getpoint "Select point on object")))
(setq moveDistance (- objectPoint toPoint))
(setq moveDistanceList (append moveDistanceList (list moveDistance)))
(setq SScounter (+ SScounter 1))
(princ)
) ;while
(while (< MOVEcounter (length moveDistanceList))
(command "move" (nth MOVEcounter objectList) "" (list 0 0 0)
(list (* (nth MOVEcounter moveDistanceList) -1) 0 0)) ;move
(setq MOVEcounter (+ MOVEcounter 1))
(princ)
) ;while
(setvar "cmdecho" 1)
(princ)
) ;FIXALIGN
----
I want the first while loop (building the list values) to be exited by keystroke ENTER (and obviously not exit the lisp routine). Currently, I've put artificial values for the number of iterations for testing only. Will using ENTER in this way be possible?
Also, if there would be a way to execute the 'move' portion of the routine so if it needs to be undone (using CTRL Z) all the actions of the routine can be undone hitting undo once rather than multiple times in order to account for each iteration of the move command. With reason, is this possible?
Solved! Go to Solution.