-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathned_bait_holder.scad
126 lines (94 loc) · 3.41 KB
/
ned_bait_holder.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
/********************************************************
* Ned Bait Holder - vsergeev
* https://github.com/vsergeev/3d-ned-bait-holder
* CC-BY-4.0
*
* Release Notes
* * v1.1 - 03/12/2021
* * Add corner radius to box.
* * v1.0 - 11/01/2020
* * Initial release.
********************************************************/
/* [Basic] */
// in mm
slot_widths = [10, 10, 15, 15];
// in mm
slot_height = 65;
// in mm
slot_depth = 10;
// in mm
wall_thickness = 1.5;
/* [Advanced] */
// in mm
drainage_hole_diameter = 5;
// fraction from 0 to 1
cutout_relative_diameter = 0.55;
// fraction from 0 to 1
cutout_relative_offset = 0.15;
// in mm
corner_radius = 1.5 * wall_thickness;
/* [Hidden] */
$fn = 70;
fudge_factor = 0.1;
/******************************************************************************/
/* Helper Functions */
/******************************************************************************/
function sum(v, i = 0) = (i < len(v)) ? v[i] + sum(v, i + 1) : 0;
function cumsum(v, i) = (i < 0) ? 0 : v[i] + cumsum(v, i - 1);
/******************************************************************************/
/* Derived Parameters */
/******************************************************************************/
width = sum(slot_widths) + (len(slot_widths) + 1) * wall_thickness;
/******************************************************************************/
/* 2D Profiles */
/******************************************************************************/
module ned_bait_profile_box() {
offset(r=corner_radius)
offset(delta=-corner_radius)
square([width, slot_depth + 2 * wall_thickness], center=true);
}
module ned_bait_profile_slot(i) {
square([slot_widths[i], slot_depth], center=true);
}
module ned_bait_profile_cutout(i) {
cutout_width = cutout_relative_diameter * slot_widths[i];
union() {
translate([0, cutout_width / 2])
circle(d = cutout_width);
translate([-cutout_width / 2, cutout_width / 2])
square([cutout_width, slot_height]);
}
}
module ned_bait_profile_drainage_hole() {
circle(d = drainage_hole_diameter);
}
/******************************************************************************/
/* 3D Extrusions */
/******************************************************************************/
module ned_bait_holder() {
slot_centers = [
for (i = [0 : len(slot_widths) - 1])
(-width / 2 + wall_thickness + slot_widths[i] / 2) + (wall_thickness * i + cumsum(slot_widths, i - 1))
];
difference() {
/* Base */
linear_extrude(slot_height + wall_thickness)
ned_bait_profile_box();
for (i = [0 : len(slot_widths) - 1]) {
/* Slot */
translate([slot_centers[i], 0, wall_thickness])
linear_extrude(slot_height + fudge_factor)
ned_bait_profile_slot(i);
/* Slot Cutout */
translate([slot_centers[i], -(slot_depth - fudge_factor) / 2, cutout_relative_offset * slot_height + wall_thickness])
rotate([90, 0, 0])
linear_extrude(wall_thickness + fudge_factor)
ned_bait_profile_cutout(i);
/* Drainage Hole */
translate([slot_centers[i], 0, -fudge_factor/2])
linear_extrude(wall_thickness + fudge_factor)
ned_bait_profile_drainage_hole();
}
}
}
ned_bait_holder();