Originally Posted by

**Avid Idler**
now whats this Lisp routine?

This is a lisp routine to draw parabola:

Code:

; draws parabola
; to draw parabola with given width (w) and height (h)
; calculate focus-vertex distance (f): f=w^2/16/h,
; draw parabola, trim the height, verify dimensions
(defun c:pbl (/ f mxx x ip y cp1 cp2 p1 p2 e1 e2 osn)
(setq osn (getvar "OSMODE"))
(setvar "cmdecho" 0)
(if (= ff nil)
(setq ff 1.0)
)
(princ "\n Focus to center point of parabola <distance> < ")
(princ ff)
(princ " > ??: ")
(initget 2)
(setq f (getdist))
(if (= f nil)
(setq f ff)
)
(setq ff f)
(if (= mxxx nil)
(setq mxxx 2.0)
)
(princ "\n Height < ")
(princ mxxx)
(princ " > ?? : ")
(setq mxx (getdist))
(if (= mxx nil)
(setq mxx mxxx)
)
(setq mxxx mxx)
(setq mx (+ mxx f))
(if (= x1 nil)
(setq x1 0.1)
)
(princ "\n Precision < x distance > < ")
(princ x1)
(princ " > ?? : ")
(setq x (getdist))
(if (= x nil)
(setq x x1)
)
(setq x1 x)
(if (> x 1)
(setq x 1)
)
; -- FIRST SEGMENT ---
(setq ip (getpoint "\n Insert by focus: ")) ; ip = focus point
(setq y (+ f (/ (expt x 2) (* 4 f)))) ; y = distance of point from base line
(setq cp1 (polar ip (* pi 1.5) (* f 2)))
(setq p1 (polar cp1 (* pi 0.5) f))
(setq cp2 (polar cp1 0 x))
(setq p2 (polar cp2 (* pi 0.5) y))
(setvar "osmode" 0)
(command "pline" p1 "w" 0 0 p2 "")
(setq e1 (entlast))
(setq xx x)
(while (> mx y)
(setq xx (+ xx x))
(setq y (+ f (/ (expt xx 2) (* 4 f))))
(setq cp2 (polar cp1 0 xx))
(setq p2 (polar cp2 (* pi 0.5) y))
(command "line" "" p2 "")
(setq e2 (entlast))
(command "pedit" e1 "j" e2 "" "")
)
(command "mirror" e1 "" ip cp1 "")
(command "circle" ip x)
(setvar "osmode" osn)
(princ)
)
(prompt "\n type pbl for parabola")

## Bookmarks