Move common modules to separate file

This commit is contained in:
Przemek Grondek 2021-08-21 21:00:36 +02:00
parent 2d97c3f31c
commit 35b762d385
3 changed files with 25 additions and 22 deletions

View file

@ -1,3 +1,5 @@
include <../lib/common.scad>;
thickness = 6;
width = 75;
depth = 64;
@ -55,14 +57,6 @@ module belt_holes() {
}
module block_with_fillet(width, depth, height, fillet) {
minkowski() {
cube([width - (fillet * 2), depth - (fillet * 2), height / 2]);
translate([fillet, fillet, 0])
cylinder(r = fillet, h = height / 2);
}
}
module mount() {
translate([(width - 30) / 2, 0]) {
// cube([30,thickness,30]);

View file

@ -1,3 +1,5 @@
include <../lib/common.scad>;
$fn = 100;
part = "cover";
@ -128,17 +130,3 @@ module screw_mounts() {
rotate([90, 0, 0])
screw_mount(length = 20, nut_size = 6, screw_size = 3, nut = "none");
}
module screw_mount(length, nut_size, screw_size, nut = "none") {
translate([screw_size / 2, screw_size / 2, 0]) {
cylinder(d = screw_size + 3, h = screw_size);
cylinder(d = screw_size, h = length);
if (nut == "hexagon") {
translate([0, 0, length - 3])
cylinder(d = nut_size, h = 3, $fn = 6);
} else if (nut == "square") {
translate([- nut_size / 2, - nut_size / 2, length - 3])
cube([nut_size, nut_size, 3]);
}
}
}

21
lib/common.scad Normal file
View file

@ -0,0 +1,21 @@
module screw_mount(length, nut_size, screw_size, nut = "none") {
translate([screw_size / 2, screw_size / 2, 0]) {
cylinder(d = screw_size + 3, h = screw_size);
cylinder(d = screw_size, h = length);
if (nut == "hexagon") {
translate([0, 0, length - 3])
cylinder(d = nut_size, h = 3, $fn = 6);
} else if (nut == "square") {
translate([- nut_size / 2, - nut_size / 2, length - 3])
cube([nut_size, nut_size, 3]);
}
}
}
module block_with_fillet(width, depth, height, fillet) {
minkowski() {
cube([width - (fillet * 2), depth - (fillet * 2), height / 2]);
translate([fillet, fillet, 0])
cylinder(r = fillet, h = height / 2);
}
}