Build all STLs and images with new Makefile build process. Add common.scad from other projects and move geared motor module to that.

This commit is contained in:
Matt McWilliams 2022-10-10 13:05:22 -04:00
parent a08924bee4
commit 0cf6685eb9
16 changed files with 149143 additions and 55823 deletions

View File

@ -26,7 +26,7 @@ PREFIX=takeup
OPENSCAD=openscad
OPENSCAD_OPTIONS=-D VERBOSE=false
OPENSCAD_IMAGE_OPTIONS=--imgsize=1024,1024 --colorscheme=DeepOcean
OPENSCAD_IMAGE_OPTIONS=--imgsize=1024,1024 --colorscheme=DeepOcean --render
STL=./stl
IMG=./img
@ -35,9 +35,9 @@ MODELS=$(shell bash ./parseVars.sh PART)
all: directories models
directories:
mkdir -p $(STL)
mkdir -p $(STL) $(IMG)
models: directories $(MODELS) moveall
models: directories $(MODELS)
clean:
rm -f $(STL)/$(PREFIX)_*
@ -47,11 +47,9 @@ cleanall:
rm -rf $(STL)
rm -rf $(IMG)
moveall:
mv ./*.png ./img/
# Dependencies for models
$(MODELS) : $(STL)/$(PREFIX)_%.stl : $(PREFIX).scad
$(OPENSCAD) $(OPENSCAD_OPTIONS) -o $@ -D PART=\"$(subst $(PREFIX)_,,$(subst .stl,,$(@F)))\" $<
$(OPENSCAD) $(OPENSCAD_OPTIONS) $(OPENSCAD_IMAGE_OPTIONS) -o $(subst $(STL),$(IMG)},$(subst .stl,.png,$(@F))) -D PART=\"$(subst $(PREFIX)_,,$(subst .stl,,$(@F)))\" $<
$(OPENSCAD) $(OPENSCAD_OPTIONS) $(OPENSCAD_IMAGE_OPTIONS) -o $(IMG)/$(subst $(STL),$(IMG)},$(subst .stl,.png,$(@F))) -D PART=\"$(subst $(PREFIX)_,,$(subst .stl,,$(@F)))\" $<

115
common.scad Normal file
View File

@ -0,0 +1,115 @@
echo("common.scad - rounded_cube()");
module rounded_cube (cube_arr = [1, 1, 1], d = 0, center = false) {
off_x = 0;
off_y = 0;
r = d/2;
union () {
cube([cube_arr[0] - d, cube_arr[1], cube_arr[2]], center = center);
cube([cube_arr[0], cube_arr[1] - d, cube_arr[2]], center = center);
translate ([1 * (cube_arr[0] / 2) - r , 1 * (cube_arr[1] / 2)- r, 0]) cylinder(r = r, h = cube_arr[2], center = center);
translate ([-1 * (cube_arr[0] / 2) + r, -1 * (cube_arr[1] / 2) + r, 0]) cylinder(r = r, h = cube_arr[2], center = center);
translate ([1 * (cube_arr[0] / 2) - r, -1 * (cube_arr[1] / 2) + r, 0]) cylinder(r = r, h = cube_arr[2], center = center);
translate ([-1 * (cube_arr[0] / 2) + r, 1 * (cube_arr[1] / 2)- r, 0]) cylinder(r = r, h = cube_arr[2], center = center);
}
}
echo("common.scad - trap_cube()");
module trap_cube(height = 19, top_x = 30, top_y = 34, bottom_x = 45, bottom_y = 65, wall_thickness = 2) {
difference(){
hull(){
translate([0,0,height])
cube([top_x, top_y, 0.1], center=true);
cube([bottom_x, bottom_y, 0.1], center=true);
}
hull(){
translate([0,0,height])
cube([top_x - wall_thickness, top_y - wall_thickness, 0.1], center=true);
cube([bottom_x - wall_thickness, bottom_y - wall_thickness, 0.1], center=true);
}
}
}
echo("common.scad - R()");
function R (diameter) = diameter / 2.0;
echo("common.scad - m3_nut");
module m3_nut (H = 5) {
cylinder(r=R(6.6), h=H, center=true, $fn=6);
}
module opto_endstop(){
difference(){
union(){
// base PCB
color("green") cube([33.0,1.6,10.5]);
// add the switch module
translate([8.4,1.6,10.5/2-6.4/2]) optoswitch();
// connector
translate([0.2,-7,0]) color("white") cube([5.8,7,10.5]);
// led
translate([3.5,1.6,10.5/2-1.5/2]) color("red") cube([2,0.7,1.5]);
}
translate([8.4,0,10.5/2-6.4/2]) {
for ( hole = [2.75,24.5-2.75] ){
rotate([90,0,0]) translate([hole,6.4/2,-4]) cylinder(r=1.5, h=4.5,$fn=40);
}
}
}
}
// switch module
module optoswitch() {
difference(){
union (){
color("gray") cube([24.5,3.5,6.4]);
color("gray")translate([6.63,0,0]) cube([4.45,11.3,6.3]);
color("gray")translate([13.63,0,0]) cube([4.45,11.3,6.3]);
}
for ( hole = [2.75,24.5-2.75] ){
rotate([90,0,0]) translate([hole,6.4/2,-4]) cylinder(r=1.5, h=4.5,$fn=40);
}
}
}
module hex (diag = 10, h = 1) {
cylinder(r = diag / 2, h = h, center = true, $fn = 6);
}
//NEMA17 Stepper
module NEMA17 ( H = 33 ) { //alt = 47.5
difference () {
cube([42, 42, H], center = true);
for (i = [0 : 3]) {
rotate([0, 0, (i * 90) + 45]) translate([29.7, 0, 0]) cube([5.5, 5.5, H + 1], center = true);
}
translate([31/2, 31/2, (H/2)-1.9]) cylinder(r = R(3), h = 4, center = true, $fn=30);
translate([-31/2, 31/2, (H/2)-1.9]) cylinder(r = R(3), h = 4, center = true, $fn=30);
translate([31/2, -31/2, (H/2)-1.9]) cylinder(r = R(3), h = 4, center = true, $fn=30);
translate([-31/2, -31/2, (H/2)-1.9]) cylinder(r = R(3), h = 4, center = true, $fn=30);
}
//pad
translate([0, 0, (H/2) + (1.9/2)]) {
cylinder(r = R(22), h = 1.9, center = true, $fn = 100);
}
//shaft
translate([0, 0, (H/2) + (22.75/2)]) {
difference () {
cylinder(r = R(5), h = 22.75, center = true, $fn = 30);
translate([0, 4.5, 4.7]) cube([5, 5, 22.75], center = true);
}
}
}
//Geartisan Worm Gear Motor - JSX40-370
module geared_motor () {
cube([46, 32, 21], center = true);
translate([(46 / 2) + (30 / 2), 0, 1.5]) rotate([0, 90, 0]) cylinder(r = 24 / 2, h = 30, center = true, $fn = 80);
translate([-(46 / 2) + 14.5, 0, -18.5]) rotate([0, 0, 90]) motor_shaft();
//pad
translate([-(46 / 2) + 14.5, 0, -(1 / 2) - 10.5]) cylinder(r = 13 / 2, h = 1, center = true, $fn = 60);
//mount pads
translate([-0.5, 0, -(1.5 / 2) - 10.5]) motor_mounts();
}

BIN
debug.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 26 KiB

BIN
img/takeup_debug.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 22 KiB

File diff suppressed because it is too large Load Diff

64346
stl/takeup_debug.stl Normal file

File diff suppressed because it is too large Load Diff

18292
stl/takeup_magnetic_coupling.stl Executable file → Normal file

File diff suppressed because it is too large Load Diff

24530
stl/takeup_minimal_mount.stl Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,4 @@
include <common.scad>;
include <daylight_spool_mount.scad>;
COUPLING_D = 37;
@ -16,17 +17,6 @@ module hex (diag = 10, h = 1) {
cylinder(r = diag / 2, h = h, center = true, $fn = 6);
}
//Geartisan Worm Gear Motor - JSX40-370
module motor () {
cube([46, 32, 21], center = true);
translate([(46 / 2) + (30 / 2), 0, 1.5]) rotate([0, 90, 0]) cylinder(r = 24 / 2, h = 30, center = true, $fn = 80);
translate([-(46 / 2) + 14.5, 0, -18.5]) rotate([0, 0, 90]) motor_shaft();
//pad
translate([-(46 / 2) + 14.5, 0, -(1 / 2) - 10.5]) cylinder(r = 13 / 2, h = 1, center = true, $fn = 60);
//mount pads
translate([-0.5, 0, -(1.5 / 2) - 10.5]) motor_mounts();
}
module motor_shaft () {
difference () {
cylinder(r = MOTOR_SHAFT_D / 2, h = MOTOR_SHAFT_H, center = true, $fn = 60);
@ -154,12 +144,12 @@ module mount_plate () {
//motor void (centered)
translate([7, 0, 0]) {
translate([-(46 / 2) + 15 + 1, 0, 0]) cylinder(r = 15 / 2, h = 20, center = true, $fn = 60);
translate([MOTOR_MOUNT_X / 2, MOTOR_MOUNT_Y / 2, 0]) motor_mount_void(D, Z);
translate([-MOTOR_MOUNT_X / 2, MOTOR_MOUNT_Y / 2, 0]) motor_mount_void(D, Z);
translate([MOTOR_MOUNT_X / 2, -MOTOR_MOUNT_Y / 2, 0]) motor_mount_void(D, Z);
translate([-MOTOR_MOUNT_X / 2, -MOTOR_MOUNT_Y / 2, 0]) motor_mount_void(D, Z);
translate([(MOTOR_MOUNT_X / 2)+1, (MOTOR_MOUNT_Y / 2), 0]) motor_mount_void(D, Z);
translate([-(MOTOR_MOUNT_X / 2)+1, (MOTOR_MOUNT_Y / 2), 0]) motor_mount_void(D, Z);
translate([(MOTOR_MOUNT_X / 2)+1, -(MOTOR_MOUNT_Y / 2), 0]) motor_mount_void(D, Z);
translate([-(MOTOR_MOUNT_X / 2)+1, -(MOTOR_MOUNT_Y / 2), 0]) motor_mount_void(D, Z);
translate([-8 + 12.5, 0, 0]) cube([7.5, 17, Z], center = true);
translate([-8 + 12.5 + 1, 0, 0]) cube([7.5, 17, Z], center = true);
}
translate([MOUNT_X / 2, MOUNT_Y / 2, 0]) mount_plate_void();
@ -192,9 +182,9 @@ module minimal_mount () {
}
module debug_assembled () {
translate([(46 / 2) - 14.5, 0, 0]) rotate([180, 0, 0]) motor();
color("green") translate([1, 0, 11]) mount_plate();
color("blue") translate([0, 0, 23]) rotate([0, 0, -90]) magnetic_coupling();
translate([(46 / 2) - 14.5, 0, 0]) rotate([180, 0, 0]) geared_motor();
color("green") translate([0, 0, 11]) mount_plate();
color("blue") translate([0, 0, 23]) rotate([0, 0, -90]) //magnetic_coupling();
difference () {
translate([0, 0, 26.5]) slip_coupling();
translate([-50, 0, 0]) cube([100, 100, 150], center = true);
@ -202,18 +192,19 @@ module debug_assembled () {
color("red") translate([0, 0, 34]) daylight_spool_insert();
}
PART = "magnetic_coupling";
PART = "mount_plate";
if (PART == "slip_coupling") {
slip_coupling();
} else if (PART == "magnetic_coupling") {
magnetic_coupling();
} else if (PART == "mount_plate") {
//42x42 M4 mounting holes
mount_plate();
} else if (PART == "daylight_spool_insert") {
daylight_spool_insert();
} else if (PART == "debug") {
debug_assembled();
} else if (PART == "minimal_mount") {
minimal_mount();
} else if (PART == "debug") {
debug_assembled();
}