CascadeStudio_3D_Manual

Форк
0
/
tailored_level.js 
98 строк · 3.3 Кб
1
// test
2
function lever(r1, r2, d, h, t)
3
{
4
//  This function creates a lever between two bearings, 
5
//  the axles of the bearings are aligned
6

7
//  r1 = radius larger bearing
8
//  r2 = radois smaller bearing
9
//  d  = distance between two bearings
10
//  h  = height or width of the lever
11
//  t  = wallthickness around bearing and cutout
12

13
    let sinus_a = (r1 - r2) / d ;
14
    let a = Math.asin(sinus_a);
15

16
    // points of outer contour of the lever
17
    let p1 = [r1 * Math.sin(a), r1 * Math.cos(a)];
18
    let p2 = [d + r2 * Math.sin(a), r2 * Math.cos(a)];
19
    let p3 = [d + r2, 0];
20
    let p4 = [d + r2 * Math.sin(a), - r2 * Math.cos(a)];
21
    let p5 = [r1 * Math.sin(a), - r1 * Math.cos(a)];
22
    let p6 = [- r1, 0 ];
23
    
24
    // points of cutout of the lever (not used as cutout became too small)
25
    let c1 = [(r1-t) * Math.sin(a), (r1-t) * Math.cos(a)];
26
    let c2 = [d + (r2-t) * Math.sin(a), (r2-t) * Math.cos(a)]; ;
27
    let c3 = [d - r2 + t , 0];
28
    let c4 = [d + (r2-t) * Math.sin(a), - (r2-t) * Math.cos(a)]; 
29
    let c5 = [(r1-t) * Math.sin(a), - (r1-t) * Math.cos(a)];
30
    let c6 = [r1-t,0]; 
31

32
    let sketchLever = new Sketch(p1).
33
                    LineTo(p2).
34
                    ArcTo(p3,p4).
35
                    LineTo(p5).
36
                    ArcTo(p6,p1).
37
                    End(false).Face(true);
38
    
39
    let leverbody = Extrude(sketchLever,[0,0,h]);
40
     
41
    let big_hole = Cylinder((r1-t), 2* (h + 10), true);
42
    let small_hole =  Translate([d, 0,0 ], Cylinder((r2-t), 2* (h + 10), true));
43
    let rough_lever = Difference(leverbody,[big_hole, small_hole]);
44
   
45
    let cutout  = new Sketch(p1).
46
                    LineTo(p2).
47
                    ArcTo(c3,p4).
48
                    LineTo(p5).
49
                    ArcTo(c6,p1).
50
                    End(false).Face(true);
51

52
    let cutoutbody = Extrude(cutout,[0,0,h+10]);
53
    let cutoutsmaller = Offset(cutoutbody, (-1.5 * t));
54

55
    // ALTERNATIVE APPROACH FOR FILLETING
56
    // make shrunk version of cutout a bit smaller and then offset it again with
57
    // the filletradius
58
    let cutoutbigger = Offset(cutoutsmaller, (0.5 * t));
59
    let cutoutround = cutoutbigger;
60
    let cutout_top = Translate([0,0,(h + t)/2],cutoutround);
61
    let cutout_bot = Translate([0,0,(-h - t)/2 -10],cutoutround);
62

63
    let rough_lever2 = Difference(rough_lever, [cutout_top, cutout_bot]);
64
    return rough_lever2;
65
}
66

67

68
function sideviewblock(r1, r2, d, h, t)
69
{
70
//  r1 = radius larger bearing
71
//  r2 = radois smaller bearing
72
//  d  = distance between two bearings
73
//  h  = height or width of the lever
74
//  t  = wallthickness around bearing and cutout
75

76
    let sideview = new Sketch( [-r1-1,0]  )
77
    .LineTo([-r1-1,0.5*h])
78
    .LineTo([r1,0.5*h])
79
    .LineTo([d-r2,(0.1*h)+(1.2*t)])
80
    .LineTo([d+r2,(0.1*h)+(1.2*t)])
81
    .LineTo([d+r2,(-0.1*h)-(1.2*t)])
82
    .LineTo([d-r2,(-0.1*h)-(1.2*t)])
83
    .LineTo([r1,-0.5*h])
84
    .LineTo([-r1-1,-0.5*h])
85
    .LineTo([-r1-1,0])
86
    .End(false,false).Face();
87

88
    let block = Extrude(sideview, [0,0,(2*r1)+(2*t)]);
89

90
    let side1 = Rotate([1,0,0],90,block);
91
    let side2 = Translate([0, r1+1,0.5*h],side1);
92

93
    return side2;
94
}
95

96
let sidecut = sideviewblock(30,10,100,40,2);
97
let levershape = lever(30,10,100,40,2);
98
Intersection([levershape,sidecut]); 
99

100

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.