;;; exp_curve.lsp ;;; a program that draw a log curve ;;; copyright 2008 by Charles Robbins (alert "exp_curve.lsp copyright 2008 by Charles Robbins. Type exp_c to start") ;;; start the program (defun c:exp_c (/) ;;; drawing setup (setq osm (getvar "osmode")) ; gets osnap settings and assigns them to osm (setvar "osmode" 0) ; turns osnap settings off ;;; setup layers (command "layer" "n" "curve" "c" "red" "curve" "") ; create curve layer ;;; user input (setq base (getint "\nWhat base number for the curve? ")) (setq lower (getreal "\nStart at what power? [i.e. -10] ")) (setq upper (getreal "\nEnd at what power? [i.e. 10] ")) ;;; draw curve (command "layer" "s" "curve" "") ; set curve layer (setq counter 0) (while (<= lower upper) (setq x lower) (setq y (expt base (fix x))) (setq npt (list x y)) (if (> counter 0)(command "pline" opt npt "")) (setq opt npt) (setq counter (1+ counter)) (setq lower (1+ lower)) ) ;;; join polyline (command "zoom" "e") (setq ss1 (ssget "L")) (setq ss2 (ssget "x" '((8 . "curve")))) ; select all polyline (command "pedit" ss1 "j" ss2 "" "f" "") ;;; end of the main program (command "layer" "s" "0" "") ; set layer to 0 (setvar "osmode" osm) ; turns osnap settings back on )