Power Line Cable Sag

Power Line Cable Sag

goswami5chirag
Participant Participant
5,966 Views
40 Replies
Message 1 of 41

Power Line Cable Sag

goswami5chirag
Participant
Participant

Does anyone know about any function that can draw profile sag of Power Line Cable sag (Catenary) ?

Here is Picture for your reference for the kind of thing i wanted

Screenshot (28).png

0 Likes
Accepted solutions (1)
5,967 Views
40 Replies
Replies (40)
Message 21 of 41

goswami5chirag
Participant
Participant

Asking for littile more help,

on the same programme i want to add line in the Lowest point of the curve..

here is a photo for reference.

 

 

Screenshot (37).png

0 Likes
Message 22 of 41

Sea-Haven
Mentor
Mentor

I tried the code is there a typo ?

 

lst-pts should it be pts ? It works then.

 

Lowest pt as you now have pts list can find the pt with lowest Y, would probably redo the pts involved say 100 steps to get a more accurate X&Y. Keep the dwg as is only use the larger step size for the XY. 

0 Likes
Message 23 of 41

goswami5chirag
Participant
Participant

Not understood , I want a line to show the Null point of the curve, that should be generated by the programme at the same time of creating the curve.

 

0 Likes
Message 24 of 41

Sea-Haven
Mentor
Mentor

I posted as a possible solution to Gile he is a very good programmer so I am sure if he can find time will add the request. 

0 Likes
Message 25 of 41

goswami5chirag
Participant
Participant

Still did not get any solution..please help.!!

0 Likes
Message 26 of 41

marko_ribar
Advisor
Advisor

Look at this function :

(vlax-curve-getclosestpointtoprojection)

 

HTH. M.R.

Marko Ribar, d.i.a. (graduated engineer of architecture)
0 Likes
Message 27 of 41

goswami5chirag
Participant
Participant

Can't find any Function ?

0 Likes
Message 28 of 41

Sea-Haven
Mentor
Mentor

Hope Gile does not mind but added a low pt.

 

;; Draws a spline figuring a catenary 
;; By Gile
;; Arguments
;; pt1 : start point
;; pt2 : end point
;; n   : number of fit points
;; th  : horizontal tension (N)
;; w   : unit weight (kg)
;; lowest point added by AlanH

(defun drawCatenary (pt1 pt2 n th w / 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 / (µ * 9.81)
(defun fitPoints (pt1 pt2 n a / lg ht stp alpha beta gamma d1 d2 x)
  (setq pts '())
    (setq x	(car pt1)
	  lg	(- (car pt2) x)
	  ht	(- (cadr pt1) (cadr pt2))
	  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) gamma)
	  pts	(list pt1)
    )
    (repeat (- n 2)
      (setq pts	(cons
		  (list	(setq x (+ x stp))
			(+ (* a (- (cosh (/ (- x d1) a)) 1.)) d2)
			0.
		  )
		  pts
		)
      )
    )
    (reverse (cons pt2 pts))
)

)


(defun c:CATENARY (/ pt1 pt2 th w n)

  (and
    (setq pt1 (getpoint "\nStart point: "))
    (setq pt2 (getpoint pt1 "\nEnd point: "))
    (setq th (getreal "\nHorizontal tension (Newtons): "))
    (setq w (getreal "\nUnit weight (Kilograms): "))
    (setq n 9) ;_ number of fit points
    (drawCatenary pt1 pt2 n th w)
    )
    
    (entmakex
    (append
      (list '(0 . "SPLINE")
	    '(100 . "AcDbEntity")
	    '(100 . "AcDbSpline")
	    (cons 70 8)
	    (cons 71 3)
	    (cons 74 (length pts))
      )
      (mapcar '(lambda (x) (cons 11 x))
	      (fitPoints pt1 pt2 n (/ th (* w 9.81)))
      )
    )
  )


    (fitPoints pt1 pt2 100 (/ th (* w 9.81)))
    (setq pts (vl-sort pts '(lambda (x y) (< (cadr x)(cadr y)))))
    (command "point" (car pts))
    (setvar 'pdmode 34)

  (princ)
)
0 Likes
Message 29 of 41

goswami5chirag
Participant
Participant

Not working

0 Likes
Message 30 of 41

goswami5chirag
Participant
Participant

Its not working - "error: no function definition: FITPOINTS"

0 Likes
Message 31 of 41

Sea-Haven
Mentor
Mentor

Ok it works now but did some more testing.

 

Pain in the, can not edit a previous post all other forums let you update / remove code etc.

 

;; Draws a spline figuring a catenary by Gile
;;
;; Arguments
;; pt1 : start point
;; pt2 : end point
;; n   : number of fit points
;; th  : horizontal tension (N)
;; w   : unit weight (kg)

;; Lowest point added by AlanH

(defun drawCatenary (pt1 pt2 n th w / 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 / (µ * 9.81)
  (defun fitPoints (pt1 pt2 n a / lg ht stp alpha beta gamma d1 d2 x)
  
    (setq x	(car pt1)
	  lg	(- (car pt2) x)
	  ht	(- (cadr pt1) (cadr pt2))
	  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) gamma)
	  pts	(list pt1)
    )
    (repeat (- n 2)
      (setq pts	(cons
		  (list	(setq x (+ x stp))
			(+ (* 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 pts))
      )
      (mapcar '(lambda (x) (cons 11 x))
	      (fitPoints pt1 pt2 n (/ th (* w 9.81)))
      )
    )
  )
  (setq pts nil)
  (fitPoints pt1 pt2 100 (/ th (* w 9.81)))
  (setq pts (vl-sort pts '(lambda (x y) (< (cadr x)(cadr y)))))
  (command "point" (car pts))
  (setvar 'pdmode 34)
)

(defun c:CATENARY (/ pt1 pt2 th w n)
  (and
    (setq pt1 (getpoint "\nStart point: "))
    (setq pt2 (getpoint pt1 "\nEnd point: "))
    (setq th (getreal "\nHorizontal tension (Newtons): "))
    (setq w (getreal "\nUnit weight (Kilograms): "))
    (setq n 10) ;_ number of fit points
    (drawCatenary pt1 pt2 n th w)
  )
  
  (princ)
)
(c:CATENARY )

 

 

0 Likes
Message 32 of 41

goswami5chirag
Participant
Participant

Can you Update  this on the earlier Programme so that I can use this on a continous way. Also the curve dosent seem to Match , The accuracy of the curve is ok in the Earlier Programme . 

0 Likes
Message 33 of 41

Sea-Haven
Mentor
Mentor

I used 100 steps to work out low pt, but the program used like 9 for the illustration so the point does not match, the points are spline fit rather than a series of say straights. I am a civil engineer and for years road Vertical curves have been plotted as a pline with little tiny straight segments. 

 

In the updated code Gile asks for how many steps so could do 100 or change my code to a lower value depends on how accurate you want it. I can say at 9 steps for curve compared 100 for low pt,  there is a big difference but curve looks good.

 

You could change the POINT to say text writing X & Y value but would want something like,

Left pole xxxrl

low pt aaaarl

right pole bbbbrl

 

Your opportunity to have a go at coding.

0 Likes
Message 34 of 41

goswami5chirag
Participant
Participant

There is a huge difference in the curve is not matching with my templateScreenshot (41).png

0 Likes
Message 35 of 41

darkfuneral
Explorer
Explorer

Hello,

 

The tension is clear to me, but the weight is it in KG for the span (lets say 50 m * 0.771 kg/km = 38.55 kg for the wire in the span) or is it in 'kg/km', 'kg/m'. If it's the weight in the span(50 m) and the next span is different (80 m), how to set it?

The other thing is the exaggeration 'k' is it the raito between X and Y? If I want X to be 1:500 scale and Y to be 1:2000 scale, so k=4 ?.

It works very well, I just need some clarifications 🙂

 

Thanks in advance,

Plamen

0 Likes
Message 36 of 41

Sea-Haven
Mentor
Mentor

The other thing is the exaggeration 'k' is it the raito between X and Y? If I want X to be 1:500 scale and Y to be 1:2000 scale

 

The quick way to do this is to draw it at 1:1 then make it all a block then change the X & Y scales to suit, then explode. 

0 Likes
Message 37 of 41

loitientran
Explorer
Explorer
Your code is great, however, if applied in a 3D CAD environment to draw a curve connecting two points of a hanging electrical wire, there will be issues with UCS (User Coordinate System) transformations. Could you upgrade it further?
0 Likes
Message 38 of 41

Sea-Haven
Mentor
Mentor

If you set a UCS plane through the 2 points then the code should work. You may need to just work with the 2 points having a dummy z of 0 for the plane to work correctly.

0 Likes
Message 39 of 41

loitientran
Explorer
Explorer

This method is to manually put 2 points into a plane. However, a power line project will have many pairs of points, so manual operation like this will take a lot of time. My wish is to automatically switch UCS when selecting any 2 points to draw a curve.

0 Likes
Message 40 of 41

Sea-Haven
Mentor
Mentor

"My wish is to automatically switch UCS when selecting any 2 points to draw a curve" That is what I was suggesting. get the 2 points as XYZ but convert the Z to zero. Use these 2 points as the starting point of a vertical UCS. You then need to re-arrange the XYZ of the points to suit the new UCS and run the lisp.

0 Likes