forked from mrWheel/YAPP_Box
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathYAPP_buttonTest_v20.scad
349 lines (304 loc) · 10.8 KB
/
YAPP_buttonTest_v20.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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
//-----------------------------------------------------------------------
// Yet Another Parameterized Projectbox generator
//
// This is a YAPP_StandSmall_v20 test box
//
// Version 2.0 (23-05-2023)
//
// This design is parameterized based on the size of a PCB.
//
// for many or complex cutoutGrills you might need to adjust
// the number of elements:
//
// Preferences->Advanced->Turn of rendering at 100000 elements
// ^^^^^^
//
//-----------------------------------------------------------------------
//-- Bambu Lab X1C 0.4mm Nizzle PLA
//insertDiam = 3.8 + 0.4;
//screwDiam = 2.5 + 0.4;
//-- Bambu Lab X1C 0.4mm Nizzle XT-Copolyester
insertDiam = 3.8 + 0.5;
screwDiam = 2.5 + 0.5;
include <../YAPP_Box/library/YAPPgenerator_v20.scad>
// Note: length/lengte refers to X axis,
// width/breedte to Y,
// height/hoogte to Z
/*
padding-back>|<---- pcb length ---->|<padding-front
RIGHT
0 X-ax --->
+----------------------------------------+ ---
| | ^
| | padding-right
^ | | v
| | -5,y +----------------------+ | ---
B Y | | 0,y x,y | | ^ F
A - | | | | | R
C a | | | | | pcb width O
K x | | | | | N
| | 0,0 x,0 | | v T
| -5,0 +----------------------+ | ---
| | padding-left
0 +----------------------------------------+ ---
0 X-ax --->
LEFT
*/
//-- which part(s) do you want to print?
printBaseShell = false;
printLidShell = true;
printSwitchExtenders = true;
//-- pcb dimensions -- very important!!!
pcbLength = 30;
pcbWidth = 40;
pcbThickness = 1.6;
//-- padding between pcb and inside wall
paddingFront = 2;
paddingBack = 1;
paddingRight = 1;
paddingLeft = 1;
//-- Edit these parameters for your own box dimensions
wallThickness = 2.0;
basePlaneThickness = 1.5;
lidPlaneThickness = 1.0;
//-- Total height of box = basePlaneThickness + lidPlaneThickness
//-- + baseWallHeight + lidWallHeight
//-- space between pcb and lidPlane :=
//-- (bottonWallHeight+lidWallHeight) - (standoffHeight+pcbThickness)
baseWallHeight = 10;
lidWallHeight = 8;
//-- ridge where base and lid off box can overlap
//-- Make sure this isn't less than lidWallHeight
ridgeHeight = 3.0;
ridgeSlack = 0.2;
roundRadius = 2.0;
//-- How much the PCB needs to be raised from the base
//-- to leave room for solderings and whatnot
standoffHeight = 3.0; //-- only used for showPCB
standoffPinDiameter = 2.4;
standoffHoleSlack = 0.4;
standoffDiameter = 6;
//-- D E B U G -----------------//-> Default ---------
showSideBySide = true; //-> true
onLidGap = 0;
shiftLid = 1;
hideLidWalls = false; //-> false
hideBaseWalls = false; //-> false
showOrientation = true;
showPCB = true;
showSwitches = false;
showPCBmarkers = false;
showShellZero = false;
showCenterMarkers = false;
inspectX = 0; //-> 0=none (>0 from front, <0 from back)
inspectY = 0; //-> 0=none (>0 from left, <0 from right)
inspectLightTubes = false;
inspectButtons = false;
//-- D E B U G ---------------------------------------
//-- pcb_standoffs -- origin is pcb[0,0,0]
// (0) = posx
// (1) = posy
// (2) = standoffHeight
// (3) = flangeHeight
// (4) = flangeDiam
// (5) = { yappBoth | yappLidOnly | yappBaseOnly }
// (6) = { yappHole, YappPin }
// (7) = { yappAllCorners | yappFrontLeft | yappFrondRight | yappBackLeft | yappBackRight }
pcbStands = [
[5, 5, 3, 4, 9, yappBoth, yappFrontLeft]
, [5, 5, 3, 4, 9, yappBoth, yappBackRight]
, [5, 5, 3, 4, 9, yappBaseOnly, yappFrontRight]
, [5, 5, 3, 4, 9, yappBaseOnly, yappBackLeft]
];
//-- Lid plane -- origin is pcb[0,0,0]
// (0) = posx
// (1) = posy
// (2) = width
// (3) = length
// (4) = angle
// (5) = { yappRectangle | yappCircle }
// (6) = { yappCenter }
cutoutsLid = [
// [20, 20, 10, 20, 10, yappRectangle]
// , [20, 50, 10, 20, 0, yappRectangle, yappCenter]
// , [50, 50, 10, 2, 0, yappCircle]
// , [pcbLength-10, 20, 15, 0, 0, yappCircle]
// , [50, pcbWidth, 5, 7, 0, yappRectangle, yappCenter]
];
//-- base plane -- origin is pcb[0,0,0]
// (0) = posx
// (1) = posy
// (2) = width
// (3) = length
// (4) = angle
// (5) = { yappRectangle | yappCircle }
// (6) = { yappCenter }
cutoutsBase = [
// [10, 10, 20, 10, 45, yappRectangle]
// , [30, 10, 15, 10, 45, yappRectangle, yappCenter]
// , [20, pcbWidth-20, 15, 0, 0, yappCircle]
// , [pcbLength-15, 5, 10, 2, 0, yappCircle]
];
//-- front plane -- origin is pcb[0,0,0]
// (0) = posy
// (1) = posz
// (2) = width
// (3) = height
// (4) = angle
// (5) = { yappRectangle | yappCircle }
// (6) = { yappCenter }
cutoutsFront = [
[2,(baseWallHeight-5.5)*-1,pcbWidth-4, lidWallHeight+baseWallHeight, 0, yappRectangle]
];
//-- back plane -- origin is pcb[0,0,0]
// (0) = posy
// (1) = posz
// (2) = width
// (3) = height
// (4) = angle
// (5) = { yappRectangle | yappCircle }
// (6) = { yappCenter }
cutoutsBack = [
[2,(baseWallHeight-5.5)*-1,pcbWidth-4, lidWallHeight+baseWallHeight, 0, yappRectangle]
];
//-- left plane -- origin is pcb[0,0,0]
// (0) = posx
// (1) = posz
// (2) = width
// (3) = height
// (4) = angle
// (5) = { yappRectangle | yappCircle }
// (6) = { yappCenter }
cutoutsLeft = [
];
//-- right plane -- origin is pcb[0,0,0]
// (0) = posx
// (1) = posz
// (2) = width
// (3) = height
// (4) = angle
// (5) = { yappRectangle | yappCircle }
// (6) = { yappCenter }
cutoutsRight = [
];
//-- cutoutGrills -- origin is pcb[x0,y0, zx]
// (0) = xPos
// (1) = yPos
// (2) = grillWidth
// (3) = grillLength
// (4) = gWidth
// (5) = gSpace
// (6) = gAngle
// (7) = plane {"base" | "lid" }
// (8) = {polygon points}}
cutoutsGrill = [
];
//-- connectors
//-- normal : origen = box[0,0,0]
//-- yappConnWithPCB: origen = pcb[0,0,0]
// (0) = posx
// (1) = posy
// (2) = pcbStandHeight
// (3) = screwDiameter
// (4) = screwHeadDiameter
// (5) = insertDiameter
// (6) = outsideDiameter
// (7) = flangeHeight
// (8) = flangeDiam
// (9) = { yappConnWithPCB }
// (10) = { yappAllCorners | yappFrontLeft | yappFrondRight | yappBackLeft | yappBackRight }
connectors = [
// [ 8, 8, 4, screwDiam, screwDiam*2, insertDiam, 7, 5, 15, yappFrontLeft]
// , [ 5, 5, 5, screwDiam, screwDiam*2, insertDiam, 7, 5, 15, yappConnWithPCB, yappFrontRight]
// , [ 5, 5, 6, screwDiam, screwDiam*2, insertDiam, 7, 5, 15, yappConnWithPCB, yappBackLeft]
// , [ 8, 8, 7, screwDiam, screwDiam*2, insertDiam, 7, 5, 15, yappBackRight]
// [ 5, 5, 8, screwDiam, screwDiam*2, insertDiam, 7, 5, 15, yappConnWithPCB, yappAllCorners]
];
//-- base mounts -- origen = box[x0,y0]
// (0) = posx | posy
// (1) = screwDiameter
// (2) = width
// (3) = height
// (4..7) = yappLeft / yappRight / yappFront / yappBack (one or more)
// (5) = { yappCenter }
baseMounts = [
];
//-- snap Joins -- origen = box[x0,y0]
// (0) = posx | posy
// (1) = width
// (2..5) = yappLeft / yappRight / yappFront / yappBack (one or more)
// (n) = { yappSymmetric }
snapJoins = [
[(pcbLength/2)+1.5, 3, yappLeft, yappRight]
// [5, 10, yappLeft]
// , [shellLength-2, 10, yappLeft]
// , [30, 10, yappFront, yappBack]
// , [2.5, 3, 5, yappBack, yappFront, yappSymmetric]
];
//-- lightTubes -- origin is pcb[0,0,0]
// (0) = posx
// (1) = posy
// (2) = tubeLength
// (3) = tubeWidth
// (4) = tubeWall
// (5) = abovePcb
// (6) = througLid {yappThroughLid}
// (7) = tubeType {yappCircle|yappRectangle}
lightTubes = [
//--- 0, 1, 2, 3, 4, 5, 6
// [15, 30, 5, 5, 1, 2, yappRectangle]
];
//-- pushButtons -- origin is pcb[0,0,0]
// (0) = posx
// (1) = posy
// (2) = capLength
// (3) = capWidth
// (4) = capAboveLid
// (5) = switchHeight
// (6) = switchTrafel
// (7) = poleDiameter
// (8) = buttonType {yappCircle|yappRectangle}
pushButtons = [
//-- 0, 1, 2, 3, 4, 5, 6, 7, 8
[15, 30, 8, 8, 0, 2, 1, 3.5, yappCircle]
, [15, 10, 8, 6, 3, 3.5, 1, 3.5, yappRectangle]
];
//-- origin of labels is box [0,0,0]
// (0) = posx
// (1) = posy/z
// (2) = orientation
// (3) = plane {lid | base | left | right | front | back }
// (4) = font
// (5) = size
// (6) = "label text"
labelsPlane = [
// [10, 10, 0, 1, "lid", "Liberation Mono:style=bold", 7, "YAPP" ]
// , [100, 90, 180, 1, "base", "Liberation Mono:style=bold", 7, "Base" ]
// , [8, 8, 0, 1, "left", "Liberation Mono:style=bold", 7, "Left" ]
// , [10, 5, 0, 1, "right", "Liberation Mono:style=bold", 7, "Right" ]
// , [40, 23, 0, 1, "front", "Liberation Mono:style=bold", 7, "Front" ]
// , [5, 5, 0, 1, "back", "Liberation Mono:style=bold", 7, "Back" ]
];
//========= MAIN CALL's ===========================================================
//===========================================================
module lidHookInside()
{
//echo("lidHookInside(original) ..");
} // lidHookInside(dummy)
//===========================================================
module lidHookOutside()
{
//echo("lidHookOutside(original) ..");
} // lidHookOutside(dummy)
//===========================================================
module baseHookInside()
{
//echo("baseHookInside(original) ..");
} // baseHookInside(dummy)
//===========================================================
module baseHookOutside()
{
//echo("baseHookOutside(original) ..");
} // baseHookOutside(dummy)
//---- This is where the magic happens ----
YAPPgenerate();