-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbases-hex.scad
More file actions
executable file
·81 lines (66 loc) · 2.71 KB
/
bases-hex.scad
File metadata and controls
executable file
·81 lines (66 loc) · 2.71 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
/* [Base Tile Size] */
// How long is a side
size = 3; //[1,2,3,4,5,6,7,8]
// How tall is the tile in mm on the Z axis
HEIGHT = 6; // 6 is default
/* [Square Basis] */
// What is the size in mm of a square?
SQUARE_BASIS = "inch"; // [25mm:25mm - Dwarven Forge/Hirstarts, inch:inch (25.4) - OpenLOCK/Dragonlock/Dungeonworks, wyloch:1 1/4 inch (31.75) - Wyloch, drc:1 1/2 inch (38.1) - Dragon's Rest]
/* [Lock] */
// Dragonlock - connector between squares, pips on either side for stacking
// InfinityLock - connector between squares and in the middle of squares
// OpenLOCK - connector between squares
// OpenLOCK Triplex - connector between squares and in the middle of squares
// OpenLOCK Topless - openlock, but without a top
// Select the type of clip lock
LOCK = "openlock";// [openlock,triplex,infinitylock,dragonlock,none]
// If OpenLock remove top of openlock bays
TOPLESS = "true"; // [true, false]
// If OpenLock, do we want supports?
SUPPORTS = "true"; // [true, false]
/* [Magnets] */
// Use magnets or not.
MAGNETS = "flex_magnetic"; // [magnetic,flex_magnetic,none]
// Size of hole for magnet. 6 works well for 5mm buckyball style magnets. 0 to eliminate.
MAGNET_HOLE = 6;
/* [Priority] */
// Do you want lock or magnets to win when the two conflict
PRIORITY = "lock"; // [lock,magnets]
/* [Center Options] */
// Sets the center to be fully filled in
CENTER = "false"; // [true, false]
include <impl_hex.scad>
/*
* Top Level Function
*/
module base_hex(size,square_basis) {
tmp_edge_width = MAGNET_HOLE >= 5.55 ? MAGNET_HOLE + 1 : 6.55;
edge_width = (PRIORITY == "lock" && (size == 1)) || LOCK == "triplex" || LOCK == "openlock" && MAGNETS == "none" || LOCK == "openlock_topless" && MAGNETS == "none" ? tmp_edge_width : square_basis/2 ;
difference() {
union() {
plain_hex(size,square_basis,edge_width);
connector_positive_hex(size,square_basis,edge_width) ;
}
connector_negative_hex(size,square_basis,edge_width) ;
}
}
function keyLookup (data, key) = search(key, data, num_returns_per_match=1)[0];
basis = [
["25mm", 25],
["inch", 25.4],
["wyloch", 31.75],
["drc", 38.1]
];
square_basis_number = basis[keyLookup(basis, [SQUARE_BASIS])][1];
wall_width = 10.2*square_basis_number/25;
// Compatability
valid_dragonlock_basis = (SQUARE_BASIS == "inch");
valid_infinitylock_basis = (SQUARE_BASIS == "inch");
if (LOCK == "dragonlock" && !valid_dragonlock_basis) {
echo("ERROR: dragonlock is only compatible with inch basis");
} else if (LOCK == "infinitylock" && !valid_infinitylock_basis) {
echo("ERROR: infinitylock is only compatible with inch basis");
} else {
color("Grey") base_hex(size,square_basis_number);
}
//plain_hex(s,square_basis_number,shape,7);