线簧
/////////////////////////////////////////////////////////////////////////////////////Punchs :dialog{
label="LISAN制作";
spacer_1;
:row {
:radio_column {label = "弹簧类型";
:radio_button {label = " 线簧";key="PBA";}}
spacer_1;
/*:spacer{ width = 0.5; horizontal_margin = none; vertical_margin = none;}*/
:column{label = "示意图";
:image {height =2;width =20; allow_accept = true; key="PIC";}}
spacer_1;
:column{label = "数据输入";
:row {
:edit_box{label="线簧圈数<N>"; fixed_height= true; edit_width = 4; key="D";}
:popup_list{key= "pu-D"; width = 2;}
:spacer{ width = 1.5; horizontal_margin = none; vertical_margin = none;}}
:row {
:edit_box {label="弹簧线径<d>";edit_width = 4; key="L";}
:popup_list{key= "pu-L"; width = 2;}
:spacer{ width = 0.5; horizontal_margin = none; vertical_margin = none;}}
:row {
:edit_box{label="线簧外径<D>";edit_width = 4; key="P";}
:popup_list{key= "pu-P"; width = 2;}
:spacer{ width = 1; horizontal_margin = none; vertical_margin =
none;}}
:row{
:edit_box {label="线簧长度<L>";edit_width = 4; key="B";}
:popup_list{key= "pu-B"; width = 2;}
:spacer{ width = 1.5; horizontal_margin = none; vertical_margin = none;}}
}//row数据输入
}
spacer_1;
:row{
:toggle {label = "标注尺寸"; fixed_height= true; is_tab_stop = true;key="BZ";}
:spacer{ width = 2; horizontal_margin = none; vertical_margin = none;}
ok_cancel;
:spacer{ width = 6; horizontal_margin = none; vertical_margin = none;}
:toggle {label = "重复绘制"; fixed_height= true; is_tab_stop = true;key="REP";}
}
}
/////////////////////////////////////////////////////////////////////////////////////////
; =============================
; | 线簧绘制PC1 |
; | |
; =============================
(defun *error* (msg)
(setq msg "Function Cancel")
(princ msg)
(setvar "osmode" 135)
)
(defun Polist(key lists)
(start_list key)
(mapcar 'add_list lists)
(end_list))
(defun thasd(SLN)
(start_image "PIC")
(fill_image
0
0
(dimx_tile "PIC")
(dimy_tile "PIC")
0
)
(slide_image
0
0
(dimx_tile "PIC")
(dimy_tile "PIC")
SLN
)
(end_image)
)
(defun C:pc3(/ D_list P_list V_list B_list F_list L_list j2 j3 j4 j5 j6 int-point j10
s2 s3 j7 entlast-1 entlast-2R1 s4 s5 j8 j9 ent-arc et-pl1 et-pl2 D1 D2 D3 L1 B1 F1 cdate)
(vl-load-com)
(setvar "CMDECHO" 0)
(setq D_list '("10""15" "20" "25" "30" "35" "40" "50" "60" "70" "80")
;;;;;;;;;;;;;;;;;;;;;;;;;;
L_list '("0.5" "0.6" "0.8" "1.0" "1.2" "1.5" "2.0" "2.5" "3.0" "4.0" "5.0" "6.0")
;;;;;;;;;;;;;;;;;;;;;;;;;;
P_list '("5" "10""15" "20" "25" "30" "35" "40" "50" "60" "70" "80")
;;;;;;;;;;;;;;;;;;;;;;;;;;
B_list '("10""20" "30" "40" "50" "60" "70" "80" "90" "100" "120")
;;;;;;;;;;;;;;;;;;;;;;;;;;
)
(if (= d1k nil) (setq d1k "10")) ;
(if (= L1K nil) (setq L1K "0.5"));
(if (= d2K nil) (setq d2K "5")) ;
(if (= B1K nil) (setq B1K "10"));
(if (= REP nil) (setq REP "0"));重复绘制
(if (= BZ nil)(setq BZ "0"));标注尺寸
(setq dcl_id (load_dialog "pc3.DCL"))
(if (not (new_dialog "Punchs" dcl_id))(exit))
(cond
((= typs "PBA")(progn (set_tile "PBA" "1")(PBA-set)));弹簧类型
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(Polist "pu-D" D_list);
(Polist "pu-L" L_list);
(Polist "pu-P" P_list);
(Polist "pu-B" B_list);
(set_tile "D" d1k);
(set_tile "L" L1K);
(set_tile "P" D2K);
(set_tile "B" B1K);
(set_tile "REP" REP);重复绘制
(set_tile "BZ" BZ);标注尺寸
(action_tile "PBA""(PBA-set)");弹簧类型
(action_tile "pu-D""(set_tile \"D\" (nth (atoi (get_tile \"pu-D\"))D_list))");
(action_tile "pu-L""(set_tile \"L\" (nth (atoi (get_tile \"pu-L\"))L_list))");
(action_tile "pu-P""(set_tile \"P\" (nth (atoi (get_tile \"pu-P\"))P_list))");
(action_tile "pu-B""(set_tile \"B\" (nth (atoi (get_tile \"pu-B\"))B_list))");
(action_tile "accept" "(setq d1K(get_tile \"D\"));
(setq L1K(get_tile \"L\"));
(setq d2K(get_tile \"P\")) ;
(setq B1K(get_tile \"B\"));
(setq BZ (get_tile \"BZ\"));重复绘制
(setq REP(get_tile \"REP\"));标注尺寸
(done_dialog 1)")
(action_tile "cancel" "(done_dialog 0)")
(setq dd (start_dialog))
(if (= dd 1)
(PROGN
(setq d1 (atof d1k);
L1 (atof L1k);
d2 (atof d2k);
B1 (atof B1k);
)
(cond
((= TYP "PBA") (PBA-draw));弹簧类型
)
)
)
(setq TYPS TYP)
(unload_dialogdcl_id)
)
;;;;;;;;;;;;;;;显视
(defun PBA-set()
(setq TYP "PBA")
;;;(mode_tile "F" 1)
;;;(mode_tile "V" 1)
(mode_tile "P" 0)
(mode_tile "B" 0)
;;;(mode_tile "pu-F" 1)
;;;(mode_tile "pu-V" 1)
(mode_tile "pu-P" 0);线簧外径ok
(mode_tile "pu-B" 0);线簧长度ok
(thasd "BA-Pin.sld")
)
;;;;;;;;;;;;;;;;;;;绘弹簧
;;;;(defun PBA-draw()
;(setvar "osmode" 0)
;(setvar "osmode" 135)
;(if (= REP "1")(PH-draw))
;)
;;;(DEFUN C:pc5 ;;;
(defun PBA-draw
(/ L21 L2 L3 L4 L5 L6 L7 L8 L9 L11 L12 L13 L14 X1 X3 X4 X5 X6 X7 X11 X13 Y1 Y2 Y11 Y22 P1 P2 P3 P4 P5 P6 P7 P22 P33 P44 P55 P66 P77P11 P12 P13 P14 P15 R )
;(setvar "osmode" 0)
(SETQ C niL wd niL od niL L niL t niL)
;线簧圈数
(setq c d1);d1
;弹簧线径
(setq wd L1)
;线簧外径
(setq od d2)
;线簧长度
(setq L B1)
(setq t (/ (- L wd) (- c (/ 5.0 3.0))))
(setq t1 (* t (/ 2.0 3)))
(if (< od (* wd 2.5))
(progn
(alert "Spring can not establish. Input data error !!")
(exit)
)
)
(if (< t1 (+ wd (* wd 0.5)))
(progn
(setq t (/ (- L wd) ( - c 1)))
(setq t1 t)
)
)
(if (< t (/ (* 4 wd) 3))
(progn
(alert "Spring can not establish. Input data error !!")
(exit)
)
)
(setq p1 (getpoint "spring start point:")
)
(setq x1 (car p1))
(setq y1 (cadr p1))
(setq d (- od wd))
(setq o1 (* wd wd))
(setq o2 (/ o1 (* d d)))
(setq o3 (- 1 o2))
(setq o4 (/ o1 o3))
(setq o5 (sqrt o4))
(setq y2 (+ y1 d))
(setq x3 (+ x1 o5))
(setq x4 (+ x1 t1))
(setq x5 (+ x4 (/ t 2)))
(setq x6 (+ x4 t))
(setq x7 (+ x5 t))
(setq p2 (List x1 y2))
(setq p3 (List x3 y1))
(setq p4 (List x4 y2))
(setq p5 (List x5 y1))
(setq p6 (List x6 y2))
(setq p7 (List x7 y1))
(setq y11 (+ y1 (/ wd 2)))
(setq y22 (- y2 (/ wd 2)))
(setq p22 (List x1 y22))
(setq p33 (List x3 y11))
(setq p44 (List x4 y22))
(setq p55 (List x5 y11))
(setq p66 (List x6 y22))
(setq p77 (List x7 y11))
(setq ang3 (angLe p3 p2))
(setq ang33 (- ang3 (angLe p3 p4)))
(SETQ LLL (/ (/ wd 2) (sin ang33)))
(setq p333 (poLar p3 ang3 LLL))
(setq ang44 (- (angLe p5 p4) (angLe p3 p4)))
(setq L4 (/ (/ wd 2) (sin ang44)))
(setq ang4 (angLe p4 p5))
(setq p444 (poLar p4 ang4 L4))
(setq ang5 (angLe p5 p4))
(setq ang55 (- ang5 (angLe p5 p6)))
(setq L5 (/ (/ wd 2) (sin ang55)))
(setq p555 (poLar p5 ang5 L5))
(setq ang6 (angLe p6 p7))
(setq p666 (poLar p6 ang6 L5))
(setq xa (- x1 (* wd 3)))
(setq ya (- y1 (* wd 3)))
(setq pa (List xa ya))
(setq xb (+ x6 wd))
(setq yb (+ y2 wd))
(setq pb (List xb yb))
(setvar "cmdecho" 0)
(setq oldvar (getvar "pickbox"))
(setvar "pickbox" 0)
(command "zoom" pa pb)
(setq r (/ wd 2))
(command "circLe" p1 r)
(command "circLe" p2 r)
(setq c2 (ssget "L"))
(command "circLe" p3 r)
(setq c3 (ssget "L"))
(command "circLe" p4 r)
(setq c4 (ssget "L"))
(command "circLe" p5 r)
(setq c5 (ssget "L"))
(command "Line" p1 p2 p3 p4 p5 p6 p7 "")
(command "offset" r p1 pa "")
(command "erase" p1 "")
(command "offset" r p2 p1 "")
(setq L21 (ssget "L"))
(command "offset" r p2 p4 "")
(setq L2 (ssget "L"))
(command "erase" p2 "")
(command "offset" r p3 p2 "")
(setq L3 (ssget "L"))
(command "offset" r p3 p5 "")
(setq L4 (ssget "L"))
(command "erase" p3 "")
(command "offset" r p4 p2 "")
(setq L5 (ssget "L"))
(command "offset" r p4 p6 "")
(setq L6 (ssget "L"))
(command "erase" p4 "")
(command "offset" r p5 p3 "")
(setq L7 (ssget "L" ))
(command "offset" r p5 p7 "")
(setq L8 (ssget "L"))
(command "erase" p5 "")
(command "offset" r p6 p4 "")
(setq L9 (ssget "L"))
(command "erase" p6 "")
(SETQ X5555 (+ X5 (* WD 2)))
(SETQ Y5555 (+ Y1 (/ OD 2)))
(SETQ P5555 (LIST X5555 Y5555))
(SETQ X1111 (- X1 WD))
(SETQ Y1111 (+ Y1 (/ (- OD wd) 2)))
(SETQ P1111 (LIST X1111 Y1111))
(command "zoom" p1111 pB)
(command "trim" L21 L2 L5 L6 "" p22 p44 p444"")
(command "trim" L9 "" p666 "")
(command "erase" L9 "")
(COMMAND "ZOOM" PA P5555)
(command "trim" L21 L2 L5 L6 "" p33 p55 p333 p555 "")
(setq cc (- c 3))
(setq x11 (+ x1 (- L wd)))
(setq p11 (List x11 y1))
(setq p12 (List x11 y2))
(setq x13 (- x11 wd))
(setq p13 (List x13 y1))
(setq x14 (- x11 t1))
(setq p14 (List x14 y2))
(setq xc (+ x11 (* t 2)))
(setq yc (+ y2 (* t 2)))
(setq pc (List xc yc))
(COMMAND "ZOOM" PA Pc)
(command "array" c4 c5 L5 L6 L7 L8 """r" "" 7 t )
;;;;;;;;;;;;;;;;;;;;;;;;;;;;(command "array" c4 c5 L5 L6 L7 L8 """r" "" cc t )弹簧圈数此段代有误谁帮忙改一下;;;;;;;
(setq bbb (entlast))
(setq x11 (+ x1 (- L wd)))
(setq p11 (List x11 y1))
(setq p12 (List x11 y2))
(setq x13 (- x11 wd))
(setq p13 (List x13 y1))
(setq x14 (- x11 t1))
(setq p14 (List x14 y2))
(setq xc (+ x11 (* t 2)))
(setq yc (+ y2 (* t 2)))
(setq pc (List xc yc))
(setq xd (- x14 WD))
(setq yd (- y1 wd))
(setq pd (List xd yd))
(command "zoom" pc pd)
(command "circLe" p11 r)
(setq c11 (ssget "L"))
(command "circLe" p12 r)
(setq c12 (ssget "L"))
(command "circLe" p13 r)
(setq c13 (ssget "L"))
(command "circLe" p14 r)
(setq c14 (ssget "L"))
(COMMAND "LINE" P11 P12 P13 P14 "")
(COMMAND "OFFSET" R P11 PC "")
(SETQ L11 (SSGET "L"))
(COMMAND "OFFSET" R P11 PD "")
(SETQ L12 (SSGET "L"))
(COMMAND "ERASE" P11 "")
(COMMAND "OFFSET" R P12 P14 "")
(SETQ L13 (SSGET "L"))
(COMMAND "ERASE" P12 "")
(COMMAND "OFFSET" R P13 P12 "")
(SETQ L14 (SSGET "L"))
(COMMAND "OFFSET" R P13 PD "")
(SETQ L15 (SSGET "L"))
(COMMAND "ERASE" P13 "")
(SETQ P111 (LIST X11 Y11))
(SETQ P222 (LIST X11 Y22))
(SETQ P333 (LIST X13 Y11))
(SETQ P444 (LIST X14 Y22))
(SETQ X133 (- X13 R))
(SETQ P133 (LIST X133 Y1))
(COMMAND "TRIM" L11 L12 "" P111 P222 "")
(COMMAND "TRIM" L14 L15 "" P333 P444 p133 "")
(setq ang1312 (angle p13 p12))
(setq ang1314 (angle p13 p14))
(setq ang (- ang1314 ang1312))
(setq LLL (/ r (sin ang)))
(setq p133 (polar p13 ang1314 LLL))
(command "trim" L14 L15 "" p133 "")
(setq x1 (cdr (assoc 11 (entget bbb))))
(command "trim" L15 "" x1 "")
(command "zoom" pa pc)
(setvar "pickbox" 5)
;(setvar "cmdecho" 1)
(PRINC "\nFinish spring ")
(princ wd)
(princ "线径*")
(princ od)
(princ "直径*")
(princ l)
(princ "长度*")
(princ c)
(princ "圈数")
(princ " 弹簧规格!")
;(setvar "osmode" 135);
(if (= REP "1")(PBA-draw)) ;
(princ)
)
帮忙解决一下圈数问题 强烈支持,板凳顶上,
如果能天正楼梯那个弧形旋转线就很好哈 咋都是仅作者可见呢?! 很实用的东西哟 多谢楼主分享
页:
[1]