The following code should reply to your request.
The generated curve is slightly different from the template one because the template one seems to be a parabola instead of a catenary curve.
The user is prompted to specify the start and end points, the tension, the unit weight and the vertical exaggeration (Y scale / X scale). The previously entered values are purposed as default values (just click Enter to accept).
;; Draws a spline figuring a catenary
;;
;; Arguments
;; pt1 : start point
;; pt2 : end point
;; n : number of fit points
;; th : horizontal tension
;; w : unit weight
;; k : vertical exaggeration (Y scale / X scale)
(defun drawCatenary (pt1 pt2 n th w k / cosh sinh asinh fitPoints)
;; Returns the hyperbolic cosine
(defun cosh (x)
(/ (+ (exp x) (exp (- x))) 2.)
)
;; Returns the hyperbolic sine
(defun sinh (x)
(/ (- (exp x) (exp (- x))) 2.)
)
;; Returns the inverse hyperbolic sine
(defun asinh (x)
(log (+ x (sqrt (+ (* x x) 1.))))
)
;; Computes the n fit points of the spline figuring the catenary between pt1 and pt2
;; with a = Th / w
(defun fitPoints (pt1 pt2 n a k / lg ht stp alpha beta gamma d1 d2 x)
(setq x (car pt1)
lg (- (car pt2) x)
ht (/ (- (cadr pt1) (cadr pt2)) k)
stp (/ lg (- n 1))
alpha (/ ht (* 2. a (sinh (/ lg (* 2. a)))))
beta (+ (/ lg 2.) (* a (asinh alpha)))
gamma (* a (- (cosh (/ beta a)) 1.))
d1 (+ x beta)
d2 (- (cadr pt1) (* k gamma))
pts (list pt1)
)
(repeat (- n 2)
(setq pts (cons
(list (setq x (+ x stp))
(+ (* k a (- (cosh (/ (- x d1) a)) 1.)) d2)
0.
)
pts
)
)
)
(reverse (cons pt2 pts))
)
(entmakex
(append
(list '(0 . "SPLINE")
'(100 . "AcDbEntity")
'(100 . "AcDbSpline")
(cons 70 8)
(cons 71 3)
(cons 74 (length lst-pts))
)
(mapcar '(lambda (x) (cons 11 x))
(fitPoints pt1 pt2 n (/ th w) k)
)
)
)
)
;; default values
(setq *tension* 3024.)
(setq *unitWeight* 2.004)
(setq *exaggeration* 10.)
(setq *numFitPoints* 17)
;; Command CATENARY
(defun c:CATENARY (/ pt1 pt2 th w n k)
(if
(and
(setq pt1 (getpoint "\nStart point: "))
(setq pt2 (getpoint pt1 "\nEnd point: "))
)
(progn
(if (setq th (getreal
(strcat
"\nHorizontal tension <"
(rtos *tension*)
">: "
)
)
)
(setq *tension* th)
(setq th *tension*)
)
(if (setq w (getreal
(strcat
"\nUnit weight <"
(rtos *unitWeight*)
">: "
)
)
)
(setq *unitWeight* w)
(setq w *unitWeight*)
)
(if (setq k (getreal
(strcat "\nVertical exaggeration <"
(rtos *exaggeration*)
">: "
)
)
)
(setq *exaggeration* k)
(setq k *exaggeration*)
)
(drawCatenary (trans pt1 1 0) (trans pt2 1 0) *numFitPoints* th w k)
)
)
(princ)
)