forked from nophead/NopSCADlib
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBOM.scad
More file actions
107 lines (86 loc) · 2.79 KB
/
BOM.scad
File metadata and controls
107 lines (86 loc) · 2.79 KB
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
//
// NopSCADlib Copyright Chris Palmer 2018
// nop.head@gmail.com
// hydraraptor.blogspot.com
//
// This file is part of NopSCADlib.
//
// NopSCADlib is free software: you can redistribute it and/or modify it under the terms of the
// GNU General Public License as published by the Free Software Foundation, either version 3 of
// the License, or (at your option) any later version.
//
// NopSCADlib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along with NopSCADlib.
// If not, see <https://www.gnu.org/licenses/>.
//
//
//! BOM and assembly demonstration
//
include <../core.scad>
include <../vitamins/sheets.scad>
use <../vitamins/insert.scad>
$explode = 1; // Normally set on the command line when generating assembly views with views.py
screw = M3_cap_screw;
sheet = PMMA3;
height = 10;
insert = screw_insert(screw);
washer = screw_washer(screw);
module widget(thickness) {
vitamin(str("widget(", thickness, "): Rivit like thing for ", thickness, "mm sheets"));
t = 1;
color("silver") {
cylinder(d = 3, h = thickness + 2 * eps, center = true);
for(end = [-1, 1])
translate_z(end * (thickness / 2 + t / 2 + eps))
cylinder(d = 4, h = t, center = true);
}
}
module widgit_stl() {
stl("widget");
union() {
rounded_rectangle([30, 30, 3], 2);
render() insert_boss(insert, height, 2.2);
}
}
module widgit_dxf() {
dxf("widget");
difference() {
sheet_2D(sheet, 20, 20, 1);
drill(screw_clearance_radius(screw), 0);
}
}
//! * Push the insert into the base with a soldering iron heated to 200°C
module widgit_base_assembly()
assembly("widgit_base") {
color(pp1_colour)
widgit_stl();
translate_z(height)
insert(insert);
}
//! * Magically insert the widget into the acrylic sheet
module widget_top_assembly()
assembly("widget_top") {
translate([-5, 5])
widget(sheet_thickness(sheet));
render_2D_sheet(sheet) // Must be last because it is transparent
widgit_dxf();
}
//! * Screw the two assemblies together
module widgit_assembly()
assembly("wigdit") {
widgit_base_assembly(); // Note this is not exloded because it is sub-assembly
translate_z(height) {
translate_z(sheet_thickness(sheet))
screw_and_washer(screw, screw_longer_than(sheet_thickness(sheet) + 2 * washer_thickness(washer) + 3), true);
explode(5)
translate_z(sheet_thickness(sheet) / 2 + eps)
widget_top_assembly();
}
}
module boms() {
widgit_assembly();
}
boms();