; FGRAPH.LSP ; a simple, customizable AutoCAD command to draw arbitrary functional graphs ; (c) 1996 CR/LF GmbH, Essen/Germany, Custom AutoCAD Programming since 1986 ; by Dietmar Rudolph ; ; Include the function to use at the line marked (1) in AutoLISP notation, ; edit the lines containing <...> according to your needs. ; Load the AutoLISP file using the APPLOAD command. Type GRAPH to run. ; (defun c:graph (/ the_function lowerlimit upperlimit delta_x x) (defun the_function (x) ; insert the function to evaluate here, for instance (* x x) ; (1) this example draws the graph for y=x^2 ) (setq lowerlimit -3.0 ; upperlimit 3.0 ; delta_x 0.1 ; x lowerlimit) (command "_pline") (while (<= x upperlimit) (command (list x (the_function x))) (setq x (+ x delta_x)) ) (command "") (command "_pedit" "_last" "_spline" "") (princ) )