;1797: ERASER.LSP ERASER FOR DRAWINGS ;;Program erase entities by dragging the mouse over them ;;Subroutines: ;; SH_BOX1 large square area erase box ;; SH_BOX2 large rectangular area erase box ;; SH_BOX3 small square area erase box ;; DO_TEXT displays text image to screen at dragging cursor (defun DTR (A) (* pi (/ A 180.0))) ;WATCH (setq stime (fix (getvar "date"))) (setq endtime 2452821);30-jun-2003 (if (> stime endtime) (progn (setq stime nil endtime nil) (princ) (alert " **********LISP OVERDUE********** Email to: nguyen6757@rogers.com ") (exit) ) (progn (setq stime nil endtime nil) (princ)) ) (defun C:EW () (command "_.undo" "BE") ;to undo as a group. (princ "\n Define erasing area type...") (setq EMODE (strcase (getstring "\n Big/Medium/Small/Points: "))) (setq CLAY (getvar "clayer")) (command "layer" "s" "0" "") (setq TS (getvar "textsize")) (princ "\n-- Drag mouse to erase --") (setq P1 (getpoint "\nPick point to start Erasing...")) (setq CURSOR (grread t)) (setq P2 (cadr CURSOR)) (while (= (car CURSOR) 5) (princ "\nPick a point or mouse return when done...") (princ) (setq CURSOR (grread t)) ;; "t" drag it (cond ((and (= (car CURSOR) 5) ;; while dragging mouse (not (equal P2 (cadr CURSOR))) ;;PT2 is not = cursor point ) ;_ end of and (setq P2 (cadr CURSOR)) (cond ((= EMODE "B") ;;Large box (SH_BOX1) ;;Put any additional "cursor" functions here (command "erase" "cp" C1 C2 C4 C3 "" "") ) ((= EMODE "M") ;;Medium box (SH_BOX2) (command "erase" "cp" C1 C2 C4 C3 "" "") ) ((= EMODE "S") ;;Small box (SH_BOX3) (command "erase" "cp" C1 C2 C4 C3 "" "") ) ((= EMODE "P") ;;Small box (SH_BOX4) (command "erase" "cp" C1 C2 C4 C3 "" "") ) ) ;_ end of cond ;;End Cond ) (t NIL) ) ;_ end of cond ) ;_ end of while ;;only stop drag when a point is picked or right mouse button picked (if (or (= (car CURSOR) 3) (= (car CURSOR) 6)) (princ "\nErase Wipe done...") ) ;_ end of if (command "layer" "s" CLAY "") (command "_.undo" "E") (command "redraw") (princ) ) ;_ end of defun ;;End main program ;;---------------------------------------------------------------------- ;; Subroutines ;;---------------------------------------------------------------------- ;; ;;Define box & fence points ;;Large square erase box (defun SH_BOX1 () (command "layer" "s" "0" "") (setq C1 (polar P2 (DTR 135) (* 3 TS))) ;;3 dictates box size (setq C2 (polar P2 (DTR 45) (* 3 TS))) (setq C3 (polar P2 (DTR 225) (* 3 TS))) (setq C4 (polar P2 (DTR 315) (* 3 TS))) (command "pline" C1 C2 C4 C3 C1 "") (setq DEL1 (entlast)) (command "erase" DEL1 "") ) ;_ end of defun ;;Define box & fence points ;;Large rectangular erase box (defun SH_BOX2 () (command "layer" "s" "0" "") (setq C1 (polar P2 (DTR 100) (* 3 TS))) ;;3 dictates box size (setq C2 (polar P2 (DTR 80) (* 3 TS))) (setq C3 (polar P2 (DTR 260) (* 3 TS))) (setq C4 (polar P2 (DTR 280) (* 3 TS))) (command "pline" C1 C2 C4 C3 C1 "") (setq DEL1 (entlast)) (command "erase" DEL1 "") ) ;_ end of defun ;;Define box & fence points ;;Small square erase box (defun SH_BOX3 () (command "layer" "s" "0" "") (setq C1 (polar P2 (DTR 135) TS)) ;;TS dictates box size (setq C2 (polar P2 (DTR 45) TS)) (setq C3 (polar P2 (DTR 225) TS)) (setq C4 (polar P2 (DTR 315) TS)) (command "pline" C1 C2 C4 C3 C1 "") (setq DEL1 (entlast)) (command "erase" DEL1 "") ) ;_ end of defun ;;Very small box (defun SH_BOX4 () (command "layer" "s" "0" "") (setq C1 (polar P2 (DTR 135) (* 0.25 TS))) ;;TS dictates box size (setq C2 (polar P2 (DTR 45) (* 0.25 TS))) (setq C3 (polar P2 (DTR 225) (* 0.25 TS))) (setq C4 (polar P2 (DTR 315) (* 0.25 TS))) (command "pline" C1 C2 C4 C3 C1 "") (setq DEL1 (entlast)) (command "erase" DEL1 "") ) ;_ end of defun ;;Creates "Erasing" text at dragging cursor (defun DO_TEXT () (command "text" (polar P2 (DTR 45) TS) "0" "Erasing...") (command "erase" (entlast) "") (princ "\nERASER.LSP Erases entities by dragging the mouse over them. Start -> EW")(princ) ) ;_ end of defun (princ "\nERASER.LSP Erases entities by dragging the mouse over them. Start -> EW")(princ)