120 lines
3.1 KiB
OpenSCAD
120 lines
3.1 KiB
OpenSCAD
// @see https://www.dakkadakka.com/wiki/en/Basing_Guidelines_for_Warhammer_40,000
|
|
|
|
// Old base: 28, primaris: 32, hero: 40, dreadnought: 65
|
|
diameter = 32.0;
|
|
|
|
// Should the base not have the same radius in the x and y axis?
|
|
oblong = false;
|
|
|
|
// Oblong diameter. A biker is on a 25x70 base, for eg.
|
|
oblong_diameter = 70;
|
|
|
|
// 3.5mm for older 28mm bases; newer bases are 4mm
|
|
base_height = 4;
|
|
|
|
// should a slot be added?
|
|
slotted = false;
|
|
|
|
// Width of the slot. 2.5 for 28mm bases
|
|
slot_width = 2.5;
|
|
|
|
// Length of the slot
|
|
slot_length = 24;
|
|
|
|
// Offset along the x axis
|
|
slot_offset_x = 3;
|
|
|
|
// Offset along the y axis
|
|
slot_offset_y = 0;
|
|
|
|
// Should a magnet holder be added underneath
|
|
magnet_holder = false;
|
|
|
|
// Diameter in mm
|
|
magnet_diameter = 6;
|
|
|
|
// Depth of the magnet holder walls in mm.
|
|
magnet_height = 2;
|
|
|
|
// Thickness of magnet wall in mm
|
|
magnet_wall_thickness = 2;
|
|
|
|
magnet_offset_x = 5;
|
|
magnet_offset_y = 0;
|
|
magnet_offset_z = 0;
|
|
magnet_offset = [magnet_offset_x, magnet_offset_y, magnet_offset_z];
|
|
slot_offset = [slot_offset_x, slot_offset_y, 0];
|
|
|
|
module magnet_holder(diameter, height, offset = [], thickness = 2) {
|
|
translate(offset) {
|
|
difference() {
|
|
cylinder(d = diameter + thickness, h = height, $fn = 360);
|
|
cylinder(d = diameter, h = height+0.01, $fn = 360);
|
|
}
|
|
}
|
|
}
|
|
|
|
module slot_cutout(width, length, height, offset) {
|
|
translate(offset) {
|
|
cube([width, length, height + 1], true);
|
|
}
|
|
}
|
|
|
|
module base(r1, r2, h, slot = false, slot_width = 0, slot_length = 0,
|
|
magnet = false, magnet_diameter = 0, magnet_height = 0, magnet_offset = [], t = 1, slot_offset = [],
|
|
magnet_wall_thickness = 2) {
|
|
|
|
difference() {
|
|
scale([r2/r1, 1]) {
|
|
difference() {
|
|
cylinder(r1 = r1, r2 = r1 - t, h = h, $fn = 360);
|
|
cylinder(r1 = r1 - t, r2 = r1 - (2*t), h = h - t, $fn = 360);
|
|
}
|
|
}
|
|
if (slot) {
|
|
translate([0, 0, h / 2]) {
|
|
slot_cutout(slot_width, slot_length, h, slot_offset);
|
|
};
|
|
}
|
|
}
|
|
|
|
if (magnet) {
|
|
// Move it up to abut against our top
|
|
if ((h - magnet_height) > 0) {
|
|
translate([0, 0, h - t]) {
|
|
cylinder(h - magnet_height, d = magnet_diameter + magnet_wall_thickness, center = true, $fn =360);
|
|
};
|
|
}
|
|
translate([0, 0, 0]) {
|
|
magnet_holder(magnet_diameter, magnet_height, magnet_offset, magnet_wall_thickness);
|
|
}
|
|
}
|
|
|
|
if (slot) {
|
|
translate([0, 0, h/2]) {
|
|
difference() {
|
|
translate(slot_offset) {cube([slot_width + (2*t), slot_length + (2*t), h], true); }
|
|
slot_cutout(slot_width, slot_length, h, slot_offset);
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
r1 = diameter / 2;
|
|
r2 = oblong ? oblong_diameter / 2 : r1;
|
|
base(
|
|
r1 = r1,
|
|
r2 = r2,
|
|
h = base_height,
|
|
slot = slotted,
|
|
slot_width = slot_width,
|
|
slot_length = slot_length,
|
|
magnet = magnet_holder,
|
|
magnet_diameter = magnet_diameter,
|
|
magnet_height = magnet_height,
|
|
magnet_offset = magnet_offset,
|
|
t = 1,
|
|
slot_offset = slot_offset,
|
|
magnet_wall_thickness = magnet_wall_thickness
|
|
); |