Vertical Pipe Deflection


(defun rtd (x)
(* 180.0 (/ x pi))) ;equation that switches degree to radians

(setq a (getreal “\nSlope of pipe 1: “))
(setq b (getreal “\nSlope of pipe 2: “))

(setq c ( – a b ))
(setq d (abs c))
(setq e (/ d 100))
(setq f (atan e))
(setq g (rtd f))

(setq aa (getreal “\nEnter bend: “))

(set def (abs (- aa g)))

(alert (rtos def))



Line Segements from Arc Given Offset Distance

(defun C:UTARC (/)

(setq ent (ssget))
(setq arc (entlast)) ;object entith
(setq Object (vlax-Ename->Vla-Object arc))

(setq B1 (vla-get-radius object))
(setq B3 (vla-get-arclength object))

(setq B2 (getreal “\nMax Distance from Curve : “))

(setq M1 (- B1 B2))

(setq M2 (* M1 M1))

(setq J1 (* B1 B1))

(setq J4 (- J1 M2))

(setq J5 (sqrt J4 ))

(setq J6 (* J5 2))

(setq J7 (/ B3 J6))

(setq J8 (1+ (fix J7)))

(alert (strcat “Number of segments: ” (rtos j8 2 0)))

(setq oldsnap (getvar “osmode”))
(setvar “osmode” 0)
(setq oldecho (getvar “cmdecho”))
(setvar “cmdecho” 0)

(while (setq ent (entsel “\nPick arc: “))
(setq obj (vlax-ename->vla-object (car ent)))
(if (= div nil) (setq div (getint “\nEnter number of chords: “)))

(setq endpt (vlax-curve-getEndPoint obj)
totlen (vlax-curve-getDistAtPoint obj endpt)
arclen (/ totlen div)
chrdpt (vlax-curve-getStartPoint obj)
num 1
(setq lst ‘())
(setq lst (list chrdpt))
(repeat div
(setq newpt (vlax-curve-getPointatDist obj (* arclen num)))
(setq lst (cons newpt lst))
(setq num (+ num 1))
) ;repeat

(entmakex (append (list (cons 0 “LWPOLYLINE”)
(cons 100 “AcDbEntity”)
(cons 100 “AcDbPolyline”)
(cons 90 (length lst))
(cons 70 0))
(mapcar (function (lambda (p) (cons 10 p))) lst))

) ; end while

(setvar “cmdecho” oldecho)
(setvar “osmode” oldsnap)