-
Notifications
You must be signed in to change notification settings - Fork 0
/
cover.scad
140 lines (127 loc) · 3.22 KB
/
cover.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
129
130
131
132
133
134
135
136
137
138
139
140
/*
Project: Cover for Logidule
File: cover.scad
Version: 0.2
Create by: Rom1 <rom1@canel.ch> - CANEL - https://www.canel.ch
Date: 25/10/2018
Licence: GNU GENERAL PUBLIC LICENSE v3
Language: OpenSCAF
Description
*/
include <config.scad>
module drilling(param)
{
for(i_drill = [0:len(param)-1])
translate([param[i_drill][1], param[i_drill][2], 0])
cylinder(h = cover_thinkness, d = param[i_drill][0], $fn=60);
}
module holder(param)
{
thinkness = 1.6;
for( i_holder = [0:len(param)-1] )
{
h = param[i_holder][3];
dia = param[i_holder][0];
translate([param[i_holder][1], param[i_holder][2], thinkness])
difference()
{
cylinder(h = h, d = dia+2*thinkness, $fn=60);
cylinder(h = h, d = dia, $fn=60);
}
}
}
module create_cover()
{
cube([cover_side[0]*logidule_size[0], cover_side[1]*logidule_size[1], cover_thinkness]);
}
module create_opening_cover()
{
/* Create two sides */
for(b = [0:1])
{
/* For X */
for(i = [0:logidule_size[0]*2])
translate([cover_open_start+cover_open_inter*i,
b*((logidule_size[1]*cover_side[0])-cover_open[0]),
0])
cube([cover_open[1], cover_open[0], cover_thinkness]);
/* For Y */
for(i = [0:logidule_size[1]*2])
translate([b*((logidule_size[0]*cover_side[0])-cover_open[0]),
cover_open_start+cover_open_inter*i,
0])
cube([cover_open[0], cover_open[1], cover_thinkness]);
}
}
module create_clips()
{
module clip(sens)
{
module _clip()
{
cube([clip_holder_v[0], clip_holder_v[1], clip_holder_v[2]]);
translate([clip_holder_v[0], 0, clip_holder_v[2]-clip_holder_v[0]])
rotate([90, 0, 0])
translate([0,0,-clip_holder_v[1]])
linear_extrude(height = clip_holder_v[1])
polygon([[0,0], [0.5,0], [0,clip_holder_v[0]]], [[0,1,2]]);
}
if(sens == 3)
translate([0, 0, 0])
_clip();
if(sens == 2)
rotate([0, 0, 90])
translate([0, -clip_holder_v[1], 0])
_clip();
if(sens == 1)
rotate([0, 0, 180])
translate([-clip_holder_v[0], -clip_holder_v[1], 0])
_clip();
if(sens == 0)
rotate([0, 0, 270])
translate([-clip_holder_v[0], 0,0])
_clip();
}
translate([clip_pos[1],
clip_pos[0],
0])
clip(0);
translate([cover_side[1]*logidule_size[0]-clip_holder_v[1]-clip_pos[1],
clip_pos[0],
0])
clip(0);
translate([clip_pos[0],
clip_pos[1],
0])
clip(1);
translate([clip_pos[0],
cover_side[0]*logidule_size[1]-clip_holder_v[1]-clip_pos[1],
0])
clip(1);
translate([clip_pos[1],
cover_side[0]*logidule_size[1]-clip_holder_v[0]-clip_pos[0],
0])
clip(2);
translate([cover_side[1]*logidule_size[0]-clip_holder_v[1]-clip_pos[1],
cover_side[0]*logidule_size[1]-clip_holder_v[0]-clip_pos[0],
0])
clip(2);
translate([cover_side[0]*logidule_size[0]-clip_holder_v[0]-clip_pos[0],
clip_pos[1],
0])
clip(3);
translate([cover_side[0]*logidule_size[0]-clip_holder_v[0]-clip_pos[0],
cover_side[0]*logidule_size[1]-clip_holder_v[1]-clip_pos[1],
0])
clip(3);
}
/* Main code */
difference()
{
create_cover(logidule_size);
create_opening_cover(logidule_size);
drilling(drilling_plane);
}
holder(holder_plane);
if(with_clip) create_clips();
// vim: ft=openscad tw=100 noet ts=4 sw=4