home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Share Gallery 1
/
share_gal_1.zip
/
share_gal_1
/
GR
/
GR505.ZIP
/
LSP.EXE
/
SAVE.LSP
< prev
next >
Wrap
Lisp/Scheme
|
1988-08-10
|
2KB
|
129 lines
; SAVE.LSP
; Allows SAVE to remember last filename. Has automatic drawing SAVE feature.
; Redefines several commands to include automatic save.
;
; Public Domain
; Copyright 1988 Alacrity
;---------------------
; Some initial values
;---------------------
; Turn off comand echoing
(setvar "CmdEcho" 0)
; Turn off "Are You Sure?"
(setvar "Expert" 2)
; Length of time between saves
(setq lsave 30)
; Time last saved
(setq tsave (getvar "Date"))
; Save (file)name
(if (not sname) (setq sname (getvar "DwgName")))
;------------------
; New SAVE command
;------------------
(command "UNDEFINE" "SAVE")
(defun c:save (/ time char temp)
(setvar "CmdEcho" 0)
(if (/= (setq temp (strcase (getstring (strcat "File name <" sname ">: ")))) "")
(setq sname temp)
)
(command ".SAVE" sname)
(setq tsave (getvar "Date"))
(setvar "CmdEcho" 1)
(princ)
)
;------------------------
; Automatic Save Routine
;------------------------
(defun asave ()
(if (> (- (getvar "Date") tsave) (* lsave 6.94E-4)) ; 0.000694 = 1 minute
(progn
(prompt "\nPerforming Automatic Save...\n")
(command ".SAVE" sname)
(setq tsave (getvar "Date"))
)
)
)
;------------------------------
; Redefine often used commands
;------------------------------
(command "UNDEFINE" "LINE")
(defun C:LINE ()
(asave)
(command ".LINE")
(princ)
)
(command "UNDEFINE" "ARC")
(defun C:ARC ()
(asave)
(command ".ARC")
(princ)
)
(command "UNDEFINE" "CIRCLE")
(defun C:CIRCLE ()
(asave)
(command ".CIRCLE")
(princ)
)
(command "UNDEFINE" "PLINE")
(defun C:PLINE ()
(asave)
(command ".PLINE")
(princ)
)
(command "UNDEFINE" "PEDIT")
(defun C:PEDIT ()
(asave)
(command ".PEDIT")
(princ)
)
(command "UNDEFINE" "TEXT")
(defun C:TEXT ()
(asave)
(command ".TEXT")
(princ)
)
(command "UNDEFINE" "DTEXT")
(defun C:DTEXT ()
(asave)
(command ".DTEXT")
(princ)
)
(command "UNDEFINE" "LAYER")
(defun C:LAYER ()
(asave)
(command ".LAYER")
(princ)
)
(command "UNDEFINE" "BLOCK")
(defun C:BLOCK ()
(asave)
(command ".BLOCK")
(princ)
)
(command "UNDEFINE" "ERASE")
(defun C:ERASE ()
(asave)
(command ".ERASE")
(princ)
)
(command "UNDEFINE" "COPY")
(defun C:COPY ()
(asave)
(command ".COPY")
(princ)
)
(command "UNDEFINE" "MOVE")
(defun C:MOVE ()
(asave)
(command ".MOVE")
(princ)
)
(setvar "CmdEcho" 1)
(princ)
; End Of File