;;; Mcr.Lsp ;;; Copyright (C) 1990 by Autodesk Australia Pty. Ltd. ;;; ;;; Permission to use, copy, modify, and distribute this software and its ;;; documentation for any purpose and without fee is hereby granted. ;;; ;;; THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. ;;; ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF ;;; MERCHANTABILITY ARE HEREBY DISCLAIMED. ;;; ;;;------------------------------------------------------------------------- ;;; DESCRIPTION: ;;; ;;; Mcr.Lsp provides two new commands, MoveRot and CopyRot. ;;; MoveRot, MOVEs and ROTATEs selected entities whilst ;;; CopyRot, COPYies and ROTATEs selected entities. ;;; ;;; Written by Sam Crupi, Autodesk Australia Pty. Ltd. ;;; October 1987 ;;; Modified by Jeff De Silva & Sam Crupi, Autodesk Australia Pty. Ltd. ;;; November 1990 ;;; ;;; Version 1.0 ;;; 4 December 1990 ;;; ;;;------------------------------------------------------------------------- ;;; ;;; Error function ;;; (defun mcr_err (s) ; If an error (such as CTRL-C) occurs ; while this command is active... (if (/= s "Function cancelled") (if (= s "quit / exit abort") (princ) (princ (strcat "\nError: " s)) ) ) (if mcr_oer ; If an old error routine exists (setq *error* mcr_oer) ; then, reset it ) (if mcr_oce ; Reset command echoing on error (setvar "cmdecho" mcr_oce) ) (princ) ) ;;; ;;; Command MoveRot ;;; (defun c:MoveRot (/ sset mcr_oce mcr_oer) (setq mcr_oce (getvar "cmdecho")) ; save cmdecho setting (setvar "cmdecho" 0) ; turn cmdecho off (if *error* ; Set our new error handler (setq mcr_oer *error* *error* mcr_err) (setq *error* mcr_err) ) (princ (strcat "\nMoveRot, Version " mcr_ver ", (C) 1990 by Autodesk Australia Pty. Ltd. " ) ) (if (setq sset (ssget)) ; get selection set (progn (setvar "cmdecho" 1) ; turn cmdecho on to allow MOVE ; prompts to appear (command "MOVE" sset "" pause pause) ; MOVE them ;; now ROTATE the selection set using the LASTPOINT as Base point (command "ROTATE" sset "" (getvar "LASTPOINT") pause) ) ) (setvar "cmdecho" mcr_oce) ; reset cmdecho to old setting (if mcr_oer ; If an old error routine exists (setq *error* mcr_oer) ; then set it back ) (princ) ) ;;; ;;; Command CopyRot ;;; (defun c:CopyRot (/ mcr_oce mcr_oer sset) (setq mcr_oce (getvar "cmdecho")) ; save cmdecho setting (setvar "cmdecho" 0) ; turn cmdecho off (if *error* ; Set our new error handler (setq mcr_oer *error* *error* mcr_err) (setq *error* mcr_err) ) (princ (strcat "\nCopyRot, Version " mcr_ver ", (C) 1990 by Autodesk Australia Pty. Ltd. " ) ) (if (setq sset (ssget)) ; get selection set (progn (command "COPY" sset "" "0,0" "0,0") ; COPY selection set over itself (setvar "cmdecho" 1) ; turn cmdecho on to allow MOVE ; prompts to appear (command "MOVE" "p" "" pause pause) (redraw) ; Redraw screen ;; now ROTATE the selection set using the LASTPOINT as Base point (command "ROTATE" "p" "" (getvar "LASTPOINT") pause) ) ) (setvar "cmdecho" mcr_oce) ; reset cmdecho to old setting (if mcr_oer ; If an old error routine exists (setq *error* mcr_oer) ; then set it back ) (princ) ) ;;; ;;; Define the c: functions. ;;; (defun c:MR () (c:MoveRot) ) (defun c:CR () (c:CopyRot) ) (setq mcr_ver "1.0") ; set version number string (princ (strcat "\nC:MCR (v" mcr_ver ") loaded.")) (princ "\nMR or MoveRot to Move and Rotate, CR or CopyRot to Copy and Rotate.") (princ)