Hi to all, need a little help here...am new to lisp and i want the routine to remember the last inputed offset distance if the user runs the command again. My code keeps on resetting it to 1
(defun c:offset+ () (c:off+))
(defun c:off+ (/ *error* ent dist kwrd ofside dist1)
;; 24 october 2012 nod684
(defun *error* (msg)
(command "._undo" "_end")
(setvar 'osmode osm)
(setvar 'cmdecho cmd1)
)
(command "._undo" "_begin")
(setq cmd1 (getvar 'cmdecho))
(setvar 'cmdecho 0)
(setq osm (getvar 'osmode))
(setvar 'osmode 923)
(prompt "\nSelect Object to Offset: ")
(while (not ent)
(setq ent (ssget "_+.:S:L" '((0 . "*LINE,CIRCLE,ELLIPSE"))))
)
(initget (+ 1 2 4 64))
(setq dist (if dist dist1 1.0 ))
(if
(setq dist1 (cond ((getdist (strcat "\n Specify Offset Distance <" (rtos dist 2 2) ">: ")))
(T dist)
)
)
(setq dist dist1)
(while (= ofside nil)
(setq ofside (getpoint "\nSide to offset on: "))
)
(initget (+ 2 4) "Yes No")
(setq kwrd (getkword "\nDelete source object? [Yes/No] <Yes>: "))
(if (/= kwrd "No")
(setq kwrd "Yes")
)
(command "offset" "erase" "no" dist ent ofside "")
(if (eq kwrd "Yes")
(command "erase" ent "")
)
(*error* "")
(princ "\nDone!")
(princ))