-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbeams.scad
129 lines (96 loc) · 3.07 KB
/
beams.scad
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/*
Subsection: beams
Derived from https://github.com/Cantareus/Stemfie_OpenSCAD
Modules:
BU_cube() basic cube in block units
beam_block() beam with holes
beam_cross() 'V', 'L', 'T' and 'X' beam shapes
History:
231011 uprava posunu pri center=false pre baam_block
*/
/*
Module: BU_cube()
BU_cube_rounded()
Usage:
BU_cube(size = [1,1,1]);
Description:
Create a cube of given size in block units.
Arguments:
size = vector, size of cube
Example(3D):
BU_cube();
BU_cube([3,1,1]);
*/
module BU_cube(size = [1,1,1], x=undef, y=undef, z=undef, center=false)
{
x = (x==undef? size: x);
cube(x[0] == undef?[x*BU, y?y*BU:x*BU, y?(z?z*BU:1*BU):x*BU]:x*BU, center=center);
}
module BU_cube_rounded(size = [1,1,1], x=undef, y=undef, z=undef, r=0.1, center=false)
{
x = (x==undef? size: x);
cube_rounded(x[0] == undef?[x*BU, y?y*BU:x*BU, y?(z?z*BU:1*BU):x*BU]:x*BU, r*BU, center=center);
}
/*
Module: beam_block()
Usage:
beam_block(size, <holes = [true, true, true]>, <center = false>);
Description:
Creates a Stemfie beam with holes.
Arguments:
size = vector, size of block to create in block units.
holes = Array of booleans in xyz order for which directions to create holes
or a single boolean for all directions.
Example(3D): Standard Stemfie beam
beam_block(3);
Example(3D): Stemfie beam with vertical holes only.
beam_block(3, holes = [false, false, true], center = false);
Example(3D): Stemfie 3D "beam"
beam_block([3, 2, 2]);
*/
module beam_block(size = [4,1,1], holes = [true, true, true], center = false)
{
size = is_list(size)?size:[size,1, 1];
holes = is_list(holes)?holes:[holes,holes,holes];
faceRotate = [[0,90,0],[90,0,0],[0,0,90]];
T(center?0:((size - [1,1,1]) * BU / 2 + [1/2, 1/2, 1/2]*BU))
D()
{
BU_cube(size, center=true);
for(i = [0:2])
{
if(holes[i])
R(faceRotate[i])
hole_grid(size = [size[(i + 2) % 3], size[(i + 1) % 3]], l = size[i] );
}
}
}
/*
Module: beam_cross()
Usage:
beam_cross(lengths, <h=1>, <holes = [true, true, true]> );
beam_cross(lengths, <h=1>, <holes = true> );
Description:
Overlaps two Stemfie beams. It can be used to create 'V', 'L', 'T' and 'X' shapes.
Arguments:
lengths = Array of 2, 3 or 4 integers. Lengths extending from intersection block
with clockwise ordering.
Example(3D): 'V' beam
beam_cross([3,3]);
Example(3D): 'L' beam
beam_cross([5,3]);
Example(3D): 'T' beam
beam_cross([2,3,2]);
Example(3D): 'X' beam
beam_cross([2,2,2,2]);
*/
module beam_cross(lengths = [2,2], h=1, holes = [true, true, true])
{
holes = is_list(holes) ? holes : [holes,holes,holes];
for(i = [0: len(lengths)-1])
{
Rz(90 * i)
BU_Tx(lengths[i]/2)
beam_block([lengths[i] + 1, 1, h], holes, center = true);
}
}