;;; motion1.LSP ;;; a program that moves a ball down 10 stairs ;;; copyright 2007 by Charles W. Robbins (alert "motion1.LSP - copyright 2007 by Charles W. Robbins. Type m1 to start.") ;;; start the program (defun c:m1 (/) ;;; select the ball (setq ss1 (ssget "x" '((8 . "ball")))) ; select the ball (setq filename 1000) ; start moving at 1000 ;;; stair while loop (setq staircounter 0) (while (< staircounter 10) ;;; Horizontal movement (setq counter1 0) ; set counter1 to 0 (while (< counter1 5) ; 5 increment loop (command "move" ss1 "" "@" "@2,0") ; moves the ball 10 inches (command "export" (strcat (itoa filename) ".bmp") "") ; writes to file (setq filename (1+ filename)) ; add one to the filename (setq counter1 (1+ counter1)) ; add one to counter1 ) ;;; Vertical movement (setq counter1 0) ; set counter1 to 0 (while (< counter1 4) ; 4 increment loop (command "move" ss1 "" "@" "@0,-2") ; moves the ball down 8 inches (command "export" (strcat (itoa filename) ".bmp") "") ; writes to file (setq filename (1+ filename)) ; add one to the filename (setq counter1 (1+ counter1)) ; add one to counter1 ) (setq staircounter (1+ staircounter)) ; add one to the stair counter ) ;;; end the program )