0% found this document useful (0 votes)
14 views7 pages

Beam Fin1

Uploaded by

Surinder Garg
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views7 pages

Beam Fin1

Uploaded by

Surinder Garg
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 7

; get the osnap mode into osnapsaved variable

(defun getosnap()
(setq osnapsaved (getvar "osmode"))
(setvar "osmode" 0)
)

; restore the osnap mode from osnapsaved

(defun restoreosnap()
(if osnapsaved
(setvar "osmode" osnapsaved)
)
)

(defun c:1() (getlines))


(defun c:2() (getlineang))
(defun c:3() (getslablevel))
(defun c:4() (getintersec))
(defun c:5() (sortintersec))
(defun c:6() (drawtopline))
(defun c:7() (drawbottomline))

(defun drawbottomline()
(setq dimscal (/ (getvar "dimscale") 25.0))
(setq dimscal 1.0)
(getosnap)
; (setq xlin1 (car (cdr (assoc 10 (entget lin1)))))
; (setq xlin2 (car (cdr (assoc 10 (entget lin2)))))

(setq xlin1 (car (nth 0 sorted_list)))


(setq xlin2 (car (nth (- (length sorted_list) 1) sorted_list)))

(messagebox "1")
(setq xxlin1 (+ xlin1 (* 2 dimscal) ))
(setq xxlin2 (- xlin2 (* 2 dimscal) ))
;(setq apt1 (list xxlin1 (+ ylevel (* 1 dimscal)) ))
;(setq apt2 (list xxlin2 (+ ylevel (* 1 dimscal)) ))

(setq apt1 (list xxlin1 ylevel ))


(setq apt2 (list xxlin2 ylevel ))

(princ "Values ") (princ apt1) (princ " ") (princ apt2)

(setq yleveldiff (* (- ylevel2 ylevel (* 2 dimscal) ) 1.5)) ;; difference of


level and calculate 150% of it

(command "line" (polar apt1 (* pi 0.5) yleveldiff) apt1 apt2 (polar apt2 (*
pi 0.5) yleveldiff) "")

(messagebox "Completed Draw Bottom")


(restoreosnap)

) ;; (defun drawbottomline()

(defun drawtopline()
(setq dimscal 1.0)
(setvar "osmode" 0)

; (setq xlin1t (car (cdr (assoc 10 (entget lin1)))))


; (setq xlin2t (car (cdr (assoc 10 (entget lin2)))))

(setq xlin1t (car (nth 0 sorted_list)))


(setq xlin2t (car (nth (- (length sorted_list) 1) sorted_list)))

(setq xxlin1t (+ xlin1t (* 1 dimscal) ))


(setq xxlin2t (- xlin2t (* 1 dimscal) ))
;(setq apt1t (list xxlin1t (- ylevel2 (* 1 dimscal) ) ))
;(setq apt2t (list xxlin2t (- ylevel2 (* 1 dimscal) ) ))

(setq apt1t (list xxlin1t ylevel2 ))


(setq apt2t (list xxlin2t ylevel2 ))

(setq yleveldiff (* (- ylevel2 ylevel (* 2 dimscal) ) 1.5)) ;; difference of


level and calculate 150% of it

(command "line" (polar apt1t (* pi 1.5) yleveldiff) apt1t apt2t (polar apt2t
(* pi 1.5) yleveldiff) "")

(messagebox "Completed Draw Top")


(restoreosnap)
) ;; (defun drawtopline()

(defun getlines()
(princ "You may select all the Center and End lines together using
window/Crossing")
(setq lines (ssget ))
(sslength lines)
)
(defun getlineang()
(setq ent1 (ssname lines 0))
(setq entg (entget ent1))
(setq pt1s (cdr (assoc 10 entg)))
(setq pt1e (cdr (assoc 11 entg)))
(setq ang1 (angle pt1e pt1s))
(setq ang2 (angle pt1s pt1e))
(setq lineang (min ang1 ang2))
;; (setq lineang (/ (* (min ang1 ang2) 180 ) pi))
(if (= lineang 0)
(setq lineang pi)
)

lineang)
(defun getslablevel()
(setq slablevel1 (getpoint "Pick the lower Level to draw Slab"))
; (setq slablevel2 (getpoint "Pick the Upper Level to draw Slab"))
(setq slablevel2 (polar slablevel1 (+ lineang (/ pi 2)) 1))

(setq beam-level1 slablevel1)


(setq beam-level2 (getpoint "Pick the Top level to draw Line"))
(setq ylevel (cadr beam-level1))
(setq ylevel2 (cadr beam-level2))
(messagebox "Completed Getlevels")
(setvar "osmode" 0)

)
(defun getintersec()
(setq cou 0)
(setq intersec_list nil)
(repeat (sslength lines)
(setq ent1 (ssname lines cou))
(setq entg (entget ent1))
(setq pt1s (cdr (assoc 10 entg)))
(setq pt1e (cdr (assoc 11 entg)))
(setq intersec (inters slablevel1 slablevel2 pt1s pt1e nil))
(setq cou (+ cou 1))

(if (not intersec_list)


(setq intersec_list (list intersec))
(setq intersec_list (append intersec_list (list intersec)))
);; if
);; repeat
)
(defun sortintersec()
(if (not (EQUAL lineang (/ pi 2) 0.01))
(PROGN
(PRINC "LINES ARE NOT VERTICAL")
(setq sorted_list (vl-sort intersec_list (function (lambda (e1 e2) (< (cadr
e1) (cadr e2))) )))
)
(PROGN
(PRINC "LINES ARE vERTICAL")
(setq sorted_list (vl-sort intersec_list (function (lambda (e1 e2) (< (car
e1) (car e2))) )))
)
);; if
)

(defun beamlines()
(setq bunit (/ 1.0 25.4)) ;; this decides whether drg is in mm or inch
(setq ht1 (* 1.5 bunit (getvar "dimscale"))) ;; 1.5 units height of bend line
base from straight long line
(setq ht2 (* 4.5 bunit (getvar "dimscale"))) ;; 3 units height of bend top
line from bend's bottom base
(setq ht2 (- (- ylevel2 ylevel) 1.5))
(setq ht3 (* 5.75 bunit (getvar "dimscale"))) ;; 1.5 units height of top most
line from bend top most line
(setq ht3 (- ylevel2 ylevel 1.5) )

(setq bendang 1.0) ;; make this 1 if bend line is to made at 45 degrees at


0.6 its around 60 degrees
;;; all height are from the base point

(princ "level1")

(setq addangle lineang)

(setq list_first_point (nth 0 sorted_list))

(setq list_last_point (nth (- (length sorted_list) 1) sorted_list))

;(command "line" (polar2 list_first_point (- addangle (/ pi 2)) 1 addangle


2) (polar list_first_point (- addangle (/ pi 2)) 1 ) (polar list_last_point
(+ addangle (/ pi 2)) 1 ) "")

(princ "level2")

(setq slab_first_point (polar2 list_first_point addangle ht2 (- addangle (/


pi 2)) 1))

(princ "level2")

(setq slab_last_point (polar2 list_last_point addangle ht2 (+ addangle (/


pi 2)) 1))

(princ "level3")

(setq loops (- (/ (length sorted_list) 2) 1))

(setq cou 1 slab_height (- ht2 ht1)) ;; slab height = sh

(princ "Started line")

(command "line" slab_first_point)

(repeat loops

(setq point1 (nth cou sorted_list))


(setq point2 (nth (+ cou 1) sorted_list))
(setq dis1 (distance point1 point2))

(if (= cou 1)
(setq div1 (/ dis1 division) )
(setq div1 (/ dis1 5.0) )
)
(if (= cou loops)
(setq div2 (/ dis1 division) )
(setq div2 (/ dis1 5.0) )
)

(setq p1 (polar point1 addangle ht2))


(setq p2 (polar p1 (- addangle (/ pi 2)) (- div1 (/ slab_height
bendang)) ))

(setq p6 (polar point2 addangle ht2))


(setq p5 (polar p6 (+ addangle (/ pi 2)) (- div2 (/ slab_height
bendang)) ))

(setq p3 (polar2 point1 addangle ht1 (- addangle (/ pi 2)) div1 ))


(setq p4 (polar2 point2 addangle ht1 (+ addangle (/ pi 2)) div2 ))

(command p1 p2 p3 p4 p5)
(setq cou (+ cou 2))
;;(getstring "Press ENter to Move")

);; repeat
(command slab_last_point "")

(setq cou 1)

(setq topline_first_point (polar2 list_first_point addangle ht3 (- addangle


(/ pi 2)) 1))
(setq point1 (nth cou sorted_list))
(setq p1 (polar point1 addangle ht3))
(command "LINE" topline_first_point p1 "")

(repeat loops
(setq point1 (nth cou sorted_list))
(setq point2 (nth (+ cou 1) sorted_list))
(setq dis1 (distance point1 point2))
;;;;; Top Bars to be L/4 if L/5 option and L/5 if L/7 Option selected for first and
last bar
;;;; modified on 30-mar-2005 as desired by Garg Sahib

(if (and (= cou 1) (= division 7.0))


(setq tdiv1 (/ dis1 5.0))
(setq tdiv1 (/ dis1 4.0))

);; if
(if (and (= cou loops) (= division 7.0))
(setq tdiv2 (/ dis1 5.0))
(setq tdiv2 (/ dis1 4.0))
);; if

(setq p1 (polar point1 addangle ht3))


(setq p2 (polar p1 (- addangle (/ pi 2)) tdiv1))

(setq p6 (polar point2 addangle ht3))


(setq p5 (polar p6 (+ addangle (/ pi 2)) tdiv2))

(command "line" p1 p2 "" )


(command "line" p5 p6 "")

(setq cou (+ cou 2))

(if (< cou (- (length sorted_list) 1) )


(progn
(setq nextpoint (nth cou sorted_list))
(setq nextpoint (polar nextpoint addangle ht3 ))
(command "line" p6 nextpoint "")
)
)

);; repeat
(setq topline_last_point (polar2 list_last_point addangle ht3 (+ addangle
(/ pi 2)) 1))
;; (setq point2 (nth sorted_list))
;; (setq p1 (polar point1 addangle ht3))
(command "LINE" topline_last_point p6 "")

) ;;; defun beamlines end here;;;;;

(defun polar2 (point ang1 dis1 ang2 dis2)


(setq temp (polar point ang1 dis1))
(setq temp (polar temp ang2 dis2))
temp)

; prompt message on screen


(defun messagebox(warning)
(alert warning)
)

;;;;; Main Program starts here

(defun c:beam()

(setq sorted_list nil intersec_list nil)


(setq saveosnap (getvar "osmode"))
(setvar "osmode" 0)
(alert "Please set the Dimscale and Units/Dim Style")
(princ "Enter the Dimscale Value")
;(command "dimscale" pause)
;(command "ddim")

(c:1)
(c:2)
(c:3)
(c:4)
(c:5)

(setq division (getreal "Enter the Division for First and Last Slab(7 or 5) <5>"))
(if (= division nil)
(setq division 5.0)
)
(command "layer" "s" "reinforcement" "")
(drawtopline)
(drawbottomline)
(beamlines)
(setvar "osmode" saveosnap)
(command "layer" "s" "0" "")
(princ )

);;

;;;;; Main Program ends here


(defun c:chklist()
(setq cou 0)
(repeat (length intersec_list)
(setq cpt (nth cou intersec_list))
(command "color" 1)
(command "circle" cpt (- ht3 ht2))
(setq cou (+ cou 1))
(setq wait (getstring "Press any key to move"))
)
)

(defun c:chksort()
(setq cou 0)
(repeat (length sorted_list)
(setq cpt (nth cou sorted_list))
(command "color" 2)
(command "circle" cpt (- ht3 ht2))
(setq cou (+ cou 1))
(setq wait (getstring "Press any key to move"))
)
)

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy