SLdesign V3.0 画钢筋
本帖最后由 尘缘一生 于 2024-8-29 04:56 编辑如果大型软件哪边,结构模型建的合理,准确,到CAD里,实际上钢筋是不用再需要寻思的,然而,有时候进行二次设计,还偶尔需要画,
需要时候,就费事,为此,做下子这个功能,
大家觉得还有点用,我贴下代码,可惜我集成太多,抽函数,基本不可能做到,也就是,不能独立运行,
更何况,代码还错综复杂的全局变量,节选摘录部分:
;;nam1 在 nam2 nam3 两个实体间均布---(一级)---
;;div 目标实体总数(包含nam1 nam2)
;;返回包含nam2 nam3的:实体中点表
;;SLdesign V3.0Modify by 尘缘一生QQ:15290049
(defun sl:djbz (nam1 nam2 nam3 div / p1 p2 p0 ang dis d i lis)
(setq p1 (e-mid nam2) p2 (e-mid nam3) ang (angle p1 p2) dis (distance p1 p2) lis (list p1 p2) div (1- div))
(if (> div 1)
(progn
(setq d (/ dis div) i 0)
(while (> (1- div) 0)
(setq p0 (polar p1 ang (* (setq i (1+ i)) d)))
(setq lis (cons p0 lis))
(vla-move (vla-copy (en2obj nam1)) (vlax-3D-point p1) (vlax-3D-point p0))
(setq div (1- div))
)
(redraw)
)
)
(setq lis (gps->lst-delsame (order-pt lis)));点击排序并删除重复点
lis
)
;;点表引线批量标注----(一级)----
;;txt1 线上文字 nil txt2 线下文字nilkd3 0 1 线上-下开关 h 文字高度
;;SLdesign V3.0Modify by 尘缘一生QQ:15290049
(defun sl:dd-pliang (plis txt1 txt2 kd3 h / bb loop pt p pp pj p00 p0 p1 p2 f3 f8 e_lst ang d0 kk str str1 str2 msg e s i el1 el2 hi kh1 kh2 d)
(setq e_lst (sysvar '("CMDECHO" "OSMODE" "ORTHOMODE")) pp (slget-box plis))
(if (= p00 nil) (setq p00 (caddr pp)))
(setq f8 (getvar 'ORTHOMODE) f3 (getvar "OSMODE"))
(setvar "CMDECHO" 0)
(setvar "OSMODE" 2048)
(setq
str (slmsg "\n->[切换方式(Tab)/正交(F8)/扑捉(F3)]..." "\n->ち传よΑ(Tab)/タユ(F8)/汲(F3)..." "\n->...")
str1 (slmsg "当前:<平行>" "讽玡:<キ︽>" "Current:<Parallel>")
str2 (slmsg "当前:<集中>" "讽玡:<栋い>" "Current:<Concentrate>")
hi (/ h slbl) d (* hi 0.8 slbl)
)
(if (and txt1 (= kd3 0) (/= txt1 "") (/= txt1 " "))
(progn
(slmkwz txt1 p00 hi nil nil nil nil 241 "m")
(setq kh1 (text:slstringlen txt1 h $hz 0.7))
(setq el1 (entget (entlast)))
)
)
(if (and (= kd3 1) txt2 (/= txt2 "") (/= txt2 " "))
(progn
(slmkwz txt2 p00 hi nil nil nil nil 241 "m")
(setq kh2 (text:slstringlen txt2 h $hz 0.7))
(setq el2 (entget (entlast)))
)
)
(cond
((and kh1 (not kh2))
(setq kh kh1)
)
((and kh2 (not kh1))
(setq kh kh2)
)
((and kh1 kh2)
(setq kh (max kh1 kh2))
)
)
(if (or (not kh) (< kh 0)) (setq kh (distance (car pp) (cadr pp))))
(setq loop t kk t)
(princ (strcat str str1))
(while loop
(setq bb (grread t 15 2) p0 (cadr bb))
(cond
((equal bb '(2 6));F3切换捕捉开关
(cond
((and (< f3 16384) (/= f3 0))
(setq f3 (+ f3 16384))
(prompt (slmsg "\n <对象捕捉 关>" "\n <癸禜 闽>" "\n <OSnap Off>"))
)
((or (= f3 0) (>= f3 16384))
(setq f3 16383)
(prompt (slmsg "\n <对象捕捉 开>" "\n <癸禜 秨>" "\n <OSnap On>"))
)
)
(setvar "OSMODE" f3) (redraw)
)
((equal bb '(2 15)) ;F8切换正交开关
(if (= f8 0)
(progn (setq f8 1) (prompt (slmsg "\n <正交 开>" "\n <タユ 秨>" "\n <Orth open>")))
(progn (setq f8 0) (prompt (slmsg "\n <正交 关>" "\n <タユ 闽>" "\n <Orth off>")))
)
(setvar 'ORTHOMODE f8) (redraw)
)
((member bb '((2 9)));;table 键
(if kk
(setq kk nil msg str2)
(setq kk t msg str1)
)
(princ (strcat str msg))
)
((= (car bb) 5);移动时
(setq pt p0 e (entlast))
(if s (sl:erase s))
(if (= f8 1)
(if (< (abs (- (car p00) (car p0))) (abs (- (cadr p00) (cadr p0))))
(setq pt (list (car p00) (cadr p0)))
(setq pt (list (car p0)(cadr p00)))
)
)
(if (and (<= f3 16384) (> f3 0))
(setq pt (slosnappt (car (nentselp pt)) pt))
)
(setq i -1 pp nil ang (angle p00 pt))
(if (= ang 0) (setq ang (+ ang 0.001)))
(while (setq p (nth (setq i (1+ i)) plis))
(if kk
(setq pj (inters p (polar p ang 300.0) pt (polar pt 0 300.0) nil))
(setq pj pt)
)
(fy_lineformat (makeline p pj) "PUB_DIM" nil nil 241)
(setq pp (cons pj pp))
)
(setq pp (order-pt pp))
(if (> (car pt) (car p00))
(progn
(setq p1 (car pp) p2 (polar (last pp) 0.0 kh))
(fy_lineformat (makeline p1 p2) "PUB_DIM" nil nil 241)
(setq p (polar p2 pi (* 0.5 kh)))
)
(progn
(setq p1 (polar (car pp) pi kh) p2 (last pp))
(fy_lineformat (makeline p1 p2) "PUB_DIM" nil nil 241)
(setq p (polar p1 0 (* 0.5 kh)))
)
)
(if el1
(progn
(setq p (polar p pi2 d))
(entmod (emod (emod el1 10 p) 11 p))
)
)
(if el2
(progn
(setq p (polar p 3pi2 d))
(entmod (emod (emod el2 10 p) 11 p))
)
)
(setq s (last_ent e))
)
((or
(= (car bb) 3);左击
(equal bb '(2 32)) ;空格
(equal bb '(2 13)) ;回车
(equal bb' (11 0)) ;右击
)
(setq loop nil)
)
)
)
(mapcar 'eval e_lst)
)
;绘制箍筋
;;SLdesign V3.0Modify by 尘缘一生QQ:15290049
(defun c:hguj (/ oldos ss s pa pb e p0x p0y p0 b h pt sinalfa p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 hrein_r hrein_l hrein_d hrein_of nam1 nam2 nam3
nam4 div plis len0 len1 wzlst txt1)
(setq oldos (getvar "OSMODE"))
(setvar "OSMODE" 16383)
(setq pa (getpoint (slmsg "\n >>> 指定箍筋第一角点:" "\n >>> ﹚鉚惮材à翴:" "\n >>> Specify the first corner of the stirrup:")))
(if (null hrein_r) (setq hrein_r (* slbl 0.6)))
(if (null hrein_l) (setq hrein_l (* slbl 3.0)))
(if (null hrein_d) (setq hrein_d (* slbl 0.45)))
(if (null hrein_of) (setq hrein_of (* slbl -0.6)))
(setq pb (getcorner pa (slmsg "\n >>> 指定箍筋第二角点:" "\n >>> ﹚鉚惮材à翴:" "\n >>> Specify the secend corner of the stirrup:")))
(setvar "OSMODE" oldos)
(princ (slmsg "\n >>>指定箍筋弯头位置:" "\n >>>﹚鉚惮舠繷竚:" "\n >>>>>>Specify the position of stirrup elbow:"))
(setq p0x (* (+ (car pa) (car pb)) 0.5))
(setq p0y (* (+ (cadr pa) (cadr pb)) 0.5))
(setq b (+ (* (abs (- (car pa) (car pb))) 0.5) hrein_of))
(setq h (+ (* (abs (- (cadr pa) (cadr pb))) 0.5) hrein_of))
(setq p0 (list p0x p0y))
(setq sinalfa (sin pi4))
(setq p1 (list (+ p0x b) (+ p0y h (- hrein_r)))
p2 (list (+ p0x b) (+ p0y (- h) hrein_r))
p3 (list (+ p0x b (- hrein_r)) (- p0y h))
p4 (list (+ p0x (- b) hrein_r) (- p0y h))
p5 (list (+ p0x (- b)) (+ p0y (- h) hrein_r))
p6 (list (+ p0x (- b)) (+ p0y h (- hrein_r)))
p7 (list (+ p0x (- b) hrein_r) (+ p0y h))
p8 (list (+ p0x b (- hrein_r)) (+ p0y h))
p9 (list (+ p0x b (- hrein_r) (- hrein_d)) (+ p0y h))
p10 (list (+ p0x b (- hrein_r) (- hrein_d) (- (* hrein_l sinalfa))) (+ p0y h (- (* hrein_l sinalfa))))
p11 (list (+ p0x b) (+ p0y h (- hrein_r) (- hrein_d)))
p12 (list (+ p0x b (- (* hrein_l sinalfa))) (+ p0y h (- hrein_r) (- hrein_d) (- (* hrein_l sinalfa))))
ss (ssadd)
)
(command "DOUGHNUT" 0 SLBL (polar (sl:mid p2 p3) (- (angle p2 p3) pi2) (* 0.5 SLBL)) "") ;右下
(setq nam1 (entlast))
(ssadd nam1 ss)
(command "DOUGHNUT" 0 SLBL (polar (sl:mid p4 p5) (- (angle p4 p5) pi2) (* 0.5 SLBL)) "") ;左下
(setq nam2 (entlast))
(ssadd nam2 ss)
(command "DOUGHNUT" 0 SLBL (polar (sl:mid p6 p7) (- (angle p6 p7) pi2) (* 0.5 SLBL)) "") ;左上
(setq nam3 (entlast))
(ssadd nam3 ss)
(command "DOUGHNUT" 0 SLBL (polar (sl:mid p1 p8) (+ (angle p1 p8) pi2) (* 0.5 SLBL)) "") ;右上
(setq nam4 (entlast))
(ssadd nam4 ss)
(chss2lay ss (slmsg "钢筋" "葵惮" "steelbar")) ;调取移层函数,把4个角点钢筋点,移到钢筋图层去
(setq e (entlast))
(slgujk p12 p11 p2 p3 p4 p5 p6 p7 p9 p10 p9 p8 p1 p11)
(setq s (last_ent e))
(while (and (setq pt (grread 5)) (= (car pt) 5))
(if s (sl:erase s))
(redraw)
(setq pt (cadr pt))
(if (= 1 (sl-4p p0 pt))
(progn
(setq p9 (list (+ p0x b (- hrein_r) (- hrein_d)) (+ p0y h))
p10 (list (+ p0x b (- hrein_r) (- hrein_d) (- (* hrein_l sinalfa))) (+ p0y h (- (* hrein_l sinalfa))))
p11 (list (+ p0x b) (+ p0y h (- hrein_r) (- hrein_d)))
p12 (list (+ p0x b (- (* hrein_l sinalfa))) (+ p0y h (- hrein_r) (- hrein_d) (- (* hrein_l sinalfa))))
)
(slgujk p12 p11 p2 p3 p4 p5 p6 p7 p9 p10 p9 p8 p1 p11)
)
(if (= 2 (sl-4p p0 pt))
(progn
(setq p9 (list (+ p0x (- b)) (+ p0y h (- hrein_r) (- hrein_d)))
p10 (list (+ p0x (- b) (+ (* hrein_l sinalfa))) (+ p0y h (- hrein_r) (- hrein_d) (- (* hrein_l sinalfa))))
p11 (list (+ p0x (- b) hrein_r hrein_d) (+ p0y h))
p12 (list (+ p0x (- b) hrein_r hrein_d (+ (* hrein_l sinalfa))) (+ p0y h (- (* hrein_l sinalfa))))
)
(slgujk p12 p11 p8 p1 p2 p3 p4 p5 p9 p10 p9 p6 p7 p11)
)
(if (= 3 (sl-4p p0 pt))
(progn
(setq p9 (list (+ p0x (- b) hrein_r hrein_d) (- p0y h))
p10 (list (+ p0x (- b) hrein_r hrein_d (+ (* hrein_l sinalfa))) (+ p0y (- h) (+ (* hrein_l sinalfa))))
p11 (list (+ p0x (- b)) (+ p0y (- h) hrein_r hrein_d))
p12 (list (+ p0x (- b) (+ (* hrein_l sinalfa))) (+ p0y (- h) hrein_r hrein_d (+ (* hrein_l sinalfa))))
)
(slgujk p12 p11 p6 p7 p8 p1 p2 p3 p9 p10 p9 p4 p5 p11)
)
(progn
(setq p9 (list (+ p0x b) (+ p0y (- h) hrein_r hrein_d))
p10 (list (+ p0x b (- (* hrein_l sinalfa))) (+ p0y (- h) hrein_r hrein_d (+ (* hrein_l sinalfa))))
p11 (list (+ p0x b (- hrein_r) (- hrein_d)) (- p0y h))
p12 (list (+ p0x b (- hrein_r) (- hrein_d) (- (* hrein_l sinalfa))) (+ p0y (- h) (+ (* hrein_l sinalfa))))
)
(slgujk p12 p11 p4 p5 p6 p7 p8 p1 p9 p10 p9 p2 p3 p11)
)
)
)
)
(setq s (last_ent e))
);while
(setq $stj (gjjb) len0 (p2uu 88) len1 (* 0.26 5 len0)) ;$stj 为SLdesign 钢筋级别全局变量
(setq div (atoi (inputbox-1 (slmsg "上部钢筋根数:?" "场葵惮计:?" "Number of Upper steel bars:?") (slmsg "输入>2" "块>2" "Input>2")"3" "25")))
(setq plis (sl:djbz nam3 nam3 nam4 div))
(setq div (rtos div 2 0) wzlst
(list
(strcat div $stj "4") (strcat div $stj "6") (strcat div $stj "8") (strcat div $stj "10") (strcat div $stj "12") (strcat div $stj "14") (strcat div $stj "16")
(strcat div $stj "18") (strcat div $stj "20") (strcat div $stj "22") (strcat div $stj "25") (strcat div $stj "28") (strcat div $stj "30") (strcat div $stj "32")
)
)
(setq txt1 (cadr (sl:yjcaidan (last plis) len0 len1 wzlst nil)))
(sl:dd-pliang plis txt1 nil 0 (* SLBL 3.0))
;----------
(setq div (atoi (inputbox-1 (slmsg "下部钢筋根数:?" "场葵惮计:?" "Number of Lower steel bars:?") (slmsg "输入>2" "块>2" "Input>2")"3" "25")))
(setq plis (sl:djbz nam2 nam2 nam1 div))
(setq div (rtos div 2 0) wzlst
(list
(strcat div $stj "4") (strcat div $stj "6") (strcat div $stj "8") (strcat div $stj "10") (strcat div $stj "12") (strcat div $stj "14") (strcat div $stj "16")
(strcat div $stj "18") (strcat div $stj "20") (strcat div $stj "22") (strcat div $stj "25") (strcat div $stj "28") (strcat div $stj "30") (strcat div $stj "32")
)
)
(setq txt1 (cadr (sl:yjcaidan (last plis) len0 len1 wzlst nil))) ;调用右键菜单选钢筋
(sl:dd-pliang plis txt1 nil 0 (* SLBL 3.0))
)
;;14点箍筋框------(一级)-----
;;SLdesign V3.0Modify by 尘缘一生QQ:15290049
(defun slgujk (p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 / d)
(setq d (* SLBL 0.45)) ;slbl 为SLdesign 绘图比例全局变量
(entmake
(list
(cons 0 "LWPOLYLINE") (cons 100 "AcDbEntity")
(cons 8 (slmsg "钢筋" "葵惮" "steelbar"))
(cons 62 1) (cons 100 "AcDbPolyline")
(cons 90 14)
(cons 70 0)
(cons 10 p1) (cons 40 d) (cons 41 d)
(cons 10 p2) (cons 40 d) (cons 41 d)
(cons 10 p3) (cons 40 d) (cons 41 d) (cons 42 -0.414214)
(cons 10 p4) (cons 40 d) (cons 41 d)
(cons 10 p5) (cons 40 d) (cons 41 d) (cons 42 -0.414214)
(cons 10 p6) (cons 40 d) (cons 41 d)
(cons 10 p7) (cons 40 d) (cons 41 d) (cons 42 -0.414214)
(cons 10 p8) (cons 40 d) (cons 41 d)
(cons 10 p9) (cons 40 d) (cons 41 d)
(cons 10 p10) (cons 40 d) (cons 41 d)
(cons 10 p11) (cons 40 d) (cons 41 d)
(cons 10 p12) (cons 40 d) (cons 41 d) (cons 42 -0.414214)
(cons 10 p13) (cons 40 d) (cons 41 d)
(cons 10 p14) (cons 40 d) (cons 41 d)
)
)
) 哥,左右呢~ 想法很不错,不过柱子一般都需要对称配筋,对边配筋应该一致不需要分别标注。 有些专业,配筋图是软件自动出图的。但是我们专门,还处于石器时代,只能手画,这个功能还是很实用的。 建议写一个画截面的,尺寸,配筋一起画上
根据标注生成钢筋表
这个是画钢筋的利器,希望大佬继续完善 希望大佬继续完善 这个功能还是很实用的
页:
[1]