Bill Tillman Posted June 9, 2016 Posted June 9, 2016 I have never really researched this but does anyone know of a method or LISP code which would allow me to enter two points and have an arc slung between them that would look like a chain. I'd like to have the line have a slight catenary curve to it. I've tried using some blocks for this but it just gets to complex. Then someone suggested creating a new linetype which would handle it. ??? I've not worked with new linetypes before but I guess now is a good time to start. Quote
SLW210 Posted June 9, 2016 Posted June 9, 2016 Do you have an example of how you want the chain to look? What type of Chain? Roller, Engineered, Lifting, etc.? There are some linetypes for chains around, I have some for Lifting type link chains I got from somewhere a while ago, easy enough to create with a shape file. Quote
lrm Posted June 9, 2016 Posted June 9, 2016 I know this does not directly answer your question for making a chain but it might help in getting the cable sag correct. For a post on the Autodesk 3ds Max forum I have been playing around with catenary (cycloid) curve math. The math is quite interesting and not always well behaved. I created the attached Excel file to determine the mid-span sag of a cable given the cable length and the distance between the poles from which the cable is hung. The solution requires the use of Excel's numerical solver. To use the Excel file enter the cable length in cell B5, the distance between the poles in cell B7 and an initial guess for the solution (1 is usually ok) in cell B9. Then go to Goal Seek (DATA, What-If-Analysis, Goal Seek...) and set the goal of making cell B13 = 0 by changing cell B9. Click OK and the mid-span cable sag will be calculated in cell B6. In this example a cable 10' long will have a sag of 3.6' if the poles are 6' apart. Cable-Sag.xls ~Lee Quote
eldon Posted June 9, 2016 Posted June 9, 2016 These lines made using the command Measure and two blocks kindly supplied by Jeffrey P Sanders. Quote
steven-g Posted June 9, 2016 Posted June 9, 2016 These lines made using the command Measure and two blocks kindly supplied by Jeffrey P Sanders. +1 Nice idea to chain blocks together (pun intended) I often use this method with blocks, never actually thought of using the measure command multiple times to create more complex designs. I'm sure I'll use this soon. Quote
dtkell Posted June 9, 2016 Posted June 9, 2016 I found this years ago and thought it would come in handy if I ever needed to use it. That hasn't happened. (Until I got to share it here!) I hope you can use it and it does what you want it to do. You'll just have to supply your own chain linetype or the linked blocks method supplied elsewhere. ;NAME: catenary.lsp ;PROJECT: General ;OBJECTIVE: Graphic the catenary function ;ACAD VERSION: AutoLISP for AutoCAD ;VERSION: April 24 2001 ;AUTOR: Hector Monroy, M.S. Civil Eng. , M.S. Computer and Systems Eng. ;hmonroy@ieee.org ;------------------------------------------------------------------------- ;FUNCTION: c:catenary ;OBJECTIVE: graphic catenary function ;PARAMETERS: nil ;GLOBAL VARIABLES: ; global_xv ; global_yv ; global_c ;RETURN: nil (defun c:catenary( / t0 p pnt1 pnt2 x1 x2 y1 y1 h l alpha v f ) (setq t0 (getreal "\nTension in the cable:")) (setq p (getreal "\ncable weight per unit length:")) (setq pnt1 (getpoint "\nInitial point:")) (setq pnt2 (getpoint pnt1 "\nEnd point:")) (setq x1 (car pnt1)) (setq x2 (car pnt2)) (setq y1 (cadr pnt1)) (setq y2 (cadr pnt2)) (setq h(- y1 y2)) (setq global_c(/ t0 p)) (setq L( - x2 x1)) (setq alpha(/ h (* 2 global_c (sinh (/ L (* 2 global_c)))))) (setq v(+ (/ L 2) (* global_c (arcsinh alpha)))) (setq f(* global_c (- (cosh (/ v global_c)) 1))) (setq global_xv(+ x1 v)) (setq global_yv(- y1 f)) (printpntlst (graphFx '(+ (* global_c (- (cosh (/ (- x global_xv) global_c)) 1)) global_yv) x1 x2 1.0)) );endDefun ;------------------------------------------------------------------------- ;------------------------------------------------------------------------- ;FUNCTION: cosh ;OBJECTIVE: hyperbolic cosine ;PARAMETERS:angle in radians ;RETURN: real (defun cosh(angles / angles) (/ (+ (exp angles)(exp (* angles -1))) 2) );endDefun ;------------------------------------------------------------------------- ;------------------------------------------------------------------------- ;FUNCTION: sinh ;OBJECTIVE: hyperbolic sine ;PARAMETERS:angle in radians ;RETURN: real (defun sinh(angles / angles) (/ (- (exp angles)(exp (* angles -1))) 2) );endDefun ;------------------------------------------------------------------------- ;------------------------------------------------------------------------- ;FUNCTION: arcsinh ;OBJECTIVE: arc hyperbolic sine ;PARAMETERS:real ;RETURN: real (defun arcsinh(angles / angles) (log(+ (sqrt (+ (* angles angles) 1)) angles)) );endDefun ;------------------------------------------------------------------------- ;------------------------------------------------------------------------- ;FUNCTION: GraphFx ;OBJECTIVE: Graphic functions type F[x]=y ; plane XY [Z=0] ;PARAMETERS: function fltStart fltEnd fltStep ;function:non-evaluated list ; use prefix mathematic notation [AutoLisp] ; x is the variable ; example '(+ (* 2 x x) x 3) ;fltStart: float [real] variable ; first x value ;fltEnd: float [real] variable ; last x value ;fltStep: float [real] variable ; Increasing the x variable ;WARNING: does not identify indeterminations ;RETURN: a list type [[fltstart y][x y] [x y]...[fltEnd y]] with all evaluated points (defun GraphFx (function fltStart fltEnd fltStep / function fltStart fltEnd fltStep x y lstPoints) (setq lisPoints nil) (if (<= fltStart fltEnd) (progn (setq x fltStart) (while (< x fltEnd) (setq y(eval function)) (setq lstPoints (append lstPoints (list (list x y 0)))) (setq x(+ x fltStep)) );endwhile (setq x fltEnd) (setq y(eval function)) (setq lstPoints (append lstPoints (list (list x y 0)))) );endprogn );endif lstPoints ) ;------------------------------------------------------------------------- ;------------------------------------------------------------------------- ;FUNCTION: GraphPar ;OBJECTIVE: Graphic parametric function ; q is the parameter in the function ;PARAMETERS:FunctionX FunctionY FunctionZ fltStart fltEnd fltStep ;function_:non-evaluated list ; use prefix mathematic notation [AutoLisp] ; q is the variable ; example '(+ (* 2 q q) q 3) ; functionX generate x variable ; functionY generate y variable ; functionZ generate z variable ;fltStart: float [real] variable ; first q value ;fltEnd: float [real] variable ; last q value ;fltStep: float [real] variable ; Increasing the q variable ;WARNING: does not identify indeterminations ;RETURN: a list type [[x y][x y] [x y]...[x y]] with all evaluated points (defun GraphPar (functionx functiony functionz fltStart fltEnd fltStep / functionx functiony functionz fltStart fltEnd fltStep x y z q lstPoints) (setq lstPoints nil) (if (<= fltStart fltEnd) (progn (setq q fltStart) (while (< q fltEnd) (setq x(eval functionx)) (setq y(eval functiony)) (setq z(eval functionz)) (setq lstPoints (append lstPoints (list (list x y z)))) (setq q(+ q fltStep)) );endwhile (setq q fltEnd) (setq x(eval functionx)) (setq y(eval functiony)) (setq z(eval functionz)) (setq lstPoints (append lstPoints (list (list x y z)))) );endprogn );endif lstPoints );endDefun ;------------------------------------------------------------------------- ;------------------------------------------------------------------------- ;FUNCTION: Printpntlst ;OBJECTIVE: printing a point list ; use 3DPOLY ;PARAMETERS: lstPoints ;lstPoints: list with points ;point is a list type [x y z] or [x y] ;x,y,z are type float ;WARNING: no error capture ;RETURN nil (defun Printpntlst(lstPoints / lstPoints pnt) (setq echoCurrent(cmdechoOFF)) (command "3DPOLY") (foreach pnt lstPoints (command pnt)) (command "") (setvar "CMDECHO" echoCurrent) nil );endDefun ;------------------------------------------------------------------------- ;------------------------------------------------------------------------- ;FUNCTION: cmdechoOFF ;OBJECTIVE: OFF the cmdecho enviromental variable ;RETURN: integrer ; current variable status (defun cmdechoOFF( / echoCurrent) (setq echoCurrent(getvar "CMDECHO")) (setvar "CMDECHO" 0) echoCurrent );endDefun ;------------------------------------------------------------------------- Quote
Bill Tillman Posted June 9, 2016 Author Posted June 9, 2016 I found a really nice LISP on Cadalyst.com but unfortunately it's DCL and as everyone who knows my projects are completely automated. I got some good ideas from it though and I'll be working with some more ideas on this shortly. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.