-
Notifications
You must be signed in to change notification settings - Fork 5
/
shape-profiles.scad
101 lines (91 loc) · 3.12 KB
/
shape-profiles.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
include <definitions.scad>
function make_column_slots_profile(
u=1,
include_switch_cutout=false,
include_switch_nub=false,
switch_base_intersection_height=100,
switch_nub_intersection_height=100
) = (
let(slot_offset = column_support_center_offset * u)
let(right_slot = [
[slot_offset + slot_width/2 +slot_padding, 0, slot_height*2],
[slot_offset + slot_width/2, 0, slot_height*2],
[slot_offset + slot_width/2, 0, slot_height],
[slot_offset - slot_width/2, 0, slot_height],
[slot_offset - slot_width/2, 0, slot_height*2],
[slot_offset - slot_width/2 -slot_padding, 0, slot_height*2],
])
let(switch_base = min([slot_height*2, switch_base_intersection_height]))
let(switch_nub = min([slot_height*2, switch_nub_intersection_height]))
let(switch_cutout = [
[keyhole_length/2, 0, slot_height*2],
[keyhole_length/2, 0, switch_base],
[3, 0, switch_base],
[3, 0, switch_nub],
[-3, 0, switch_nub],
[-3, 0, switch_base],
[-keyhole_length/2, 0, switch_base],
[-keyhole_length/2, 0, slot_height*2],
])
let(left_slot = reverse([
for (v=right_slot)
[-v.x, v.y, v.z]
]))
concat(right_slot, switch_cutout, left_slot)
);
function plate (w=1, h=1, align=0) = (
let(width = plate_width * w)
let(height = plate_height * h)
let(center_offset = column_support_center_offset)
let(plate_top = height/2)
let(plate_right = width/2)
let(slot_right = center_offset*w + slot_width/2)
let(slot_left = center_offset*w - slot_width/2)
let(slot_bottom = plate_top - column_support_thickness/2)
let(slot_distance_from_edge = width/2 - (center_offset*w + column_support_thickness/2))
let(corner_profile = [
[ plate_right, slot_distance_from_edge > 0.2 ? plate_top : slot_bottom],
[ slot_right, slot_distance_from_edge > 0.2 ? plate_top : slot_bottom],
[ slot_right, slot_bottom],
[ slot_left, slot_bottom],
[ slot_left, plate_top],
])
let(outer_points = flatten([
corner_profile,
reverse([for(v=corner_profile) [-v.x, v.y]]),
[for(v=corner_profile) [-v.x, -v.y]],
reverse([for(v=corner_profile) [v.x, -v.y]])
]))
let(alignment = align * (w - 1) * plate_width/2)
let(inner_points = [
[ keyhole_length/2 + alignment, keyhole_length/2],
[-keyhole_length/2 + alignment, keyhole_length/2],
[-keyhole_length/2 + alignment, -keyhole_length/2],
[ keyhole_length/2 + alignment, -keyhole_length/2]
])
let(points = concat(outer_points, inner_points))
let(paths = [
[for(i=[0:len(outer_points)-1]) i],
[for(i=[0:len(inner_points)-1]) len(outer_points)+i]
])
[outer_points, inner_points]
);
function make_column_profile_row_plate_cavity(h=1) = (
let(length = plate_height * h)
[
[ length/2, 0],
[ length/2 - slot_width/2, 0],
[ length/2 - slot_width/2, -plate_thickness],
[-(length/2 - slot_width/2), -plate_thickness],
[-(length/2 - slot_width/2), 0],
[-(length/2), 0]
]
);
column_profile_slot = [
[0, slot_width/2 + slot_padding, 0],
[0, slot_width/2, 0],
[0, slot_width/2, slot_height],
[0, -slot_width/2, slot_height],
[0, -slot_width/2, 0],
[0, -slot_width/2 - slot_padding, 0],
];