Work in progress of adding Makefile to build all OpenSCAD models for printing. Based off work in intval2 project with a slightly more automated approach. Hopefully can massage the parseVars.sh script into a single command within the Makefile.

This commit is contained in:
Matt McWilliams 2022-10-09 16:10:27 -04:00
parent ca9ff6b621
commit 561bfd784c
7 changed files with 111 additions and 40 deletions

View File

@ -1,6 +1,6 @@
MIT License MIT License
Copyright (c) 2020 Matt McWilliams Copyright (c) 2020-2022 Matt McWilliams
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

54
hardware/Makefile Normal file
View File

@ -0,0 +1,54 @@
###################
#
# intval3 OpenSCAD Makefile
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
###################
PREFIX=intval3
OPENSCAD=openscad
OPENSCAD_OPTIONS=-D VERBOSE=false
STL=./stl
DXF=./dxf
MODELS=$(shell bash ./parseVars.sh MODEL)
LASER=$(shell bash ./parseVars.sh LASER)
all: directories models
directories:
mkdir -p $(STL) $(DXF)
models: directories $(MODELS) $(LASER)
clean:
rm -f $(STL)/$(PREFIX)_*
cleanall:
rm -rf $(STL)
# Dependencies for models
$(MODELS) : $(STL)/$(PREFIX)_%.stl : $(PREFIX).scad
$(OPENSCAD) $(OPENSCAD_OPTIONS) -o $@ -D MODEL=\"$(subst $(PREFIX)_,,$(subst .stl,,$(@F)))\" $<
$(LASER) : $(DXF)/$(PREFIX)_%.dxf : $(PREFIX).scad
$(OPENSCAD) $(OPENSCAD_OPTIONS) -o $@ -D LASER=\"$(subst $(PREFIX)_,,$(subst .dxf,,$(@F)))\" $<

View File

@ -125,13 +125,3 @@ module reference_projector_shaft () {
bearing_laser(hole=false); bearing_laser(hole=false);
} }
} }
difference() {
union () {
//reference_projector_shaft();
translate([0, 0, 17.5]) color("red")rotate([180, 0, 0]) motor_key_bottom();
}
//translate([30, 0, 0]) cube([60, 60, 60], center = true);
}
//translate([0, 0, 7]) motor_key_120();

View File

@ -30,7 +30,7 @@ module intval_panel_laser () {
difference () { difference () {
translate ([0, 0, 8.5]) { translate ([0, 0, 8.5]) {
union () { union () {
translate([12 - 10, , 0]) { translate([12 - 10, 0]) {
rotate([0, 0, -13]) { rotate([0, 0, -13]) {
rounded_cube([panel_2_x + 20 + 20, panel_2_y, 25.4/8], d = 20, center = true); rounded_cube([panel_2_x + 20 + 20, panel_2_y, 25.4/8], d = 20, center = true);
} }

View File

@ -1,6 +1,8 @@
include <./case.scad> include <./case.scad>
include <./mount.scad> include <./mount.scad>
include <./plunger.scad> include <./plunger.scad>
//include <./anyeye_revere.scad>
/* /*
INTVAL 3 INTVAL 3
@ -36,29 +38,43 @@ module exploded_view () {
translate([0, 0, -10]) intval_laser_standoffs_alt(); translate([0, 0, -10]) intval_laser_standoffs_alt();
} }
//exploded_view();
MODEL = "stl_plate";
if (MODEL == "stl_plate") {
stl_plate();
} else if (MODEL == "plunger_plate") {
plunger_plate();
} else if (MODEL == "standoffs_plate") {
intval_laser_standoffs_plate();
} else if (MODEL == "standoff") {
bolex_pin_laser(0, 0);
} else if (MODEL == "electronics_mount") {
intval_electronics_mount();
} else if (MODEL == "motor_mount_bottom") {
motor_mount_bottom();
} else if (MODEL == "motor_mount_120") {
geared_motor_mount_120();
} else if (MODEL == "motor_key_120") {
motor_key_120();
}
//motor_key_120_reinforced ()
//motor_key_120_reinforced_roller ()
//bolex_pin_laser(0, 0);
//intval_laser_standoffs_plate();
//intval_electronics_mount();
//motor_mount_bottom();
//projection () intval_panel_laser();
//intval_laser_panel_cover(true, ALL_RED=true);
//rotate([0, 0, 13]) intval_panel_laser();
//rotate([0, 0, 13]) intval_laser_panel_cover();
//rotate([0, 180, 0]) key_cap(); //rotate([0, 180, 0]) key_cap();
//geared_motor_mount_120();
//motor_key_120();
//plunger_plate();
//plunger(); //plunger();
//rotate([0, 180, 0]) plunger_top(); //plunger_top();
//motor_cap(false); //motor_cap(false);
//rotate([0, 180, 0]) motor_cap_120(false); //rotate([0, 180, 0]) motor_cap_120(false);
//translate([0, 0, 39 / 2 + 5.75]) bolt_guide(); //translate([0, 0, 39 / 2 + 5.75]) bolt_guide();
//motor_key_120_reinforced();
motor_key_120_reinforced_roller();
//intval_laser_standoffs_alt(); //intval_laser_standoffs_alt();
//intval_laser_standoffs_plate_alt(); //intval_laser_standoffs_plate_alt();
//exploded_view(); LASER = "dxf_plate";
//stl_plate(); if (LASER == "laser_plate") {
//dxf_plate(); dxf_plate();
} else if (LASER == "panel") {
intval_panel_laser();
} else if (LASER == "panel_cover") {
intval_laser_panel_cover(true, ALL_RED=true);
}

View File

@ -89,7 +89,7 @@ module motor_key_120_reinforced_roller () {
} }
hobbled_rod_120(40); hobbled_rod_120(40);
//nut //nut
translate([5, 0, 0]) cube([2.5, 5.25, 42], center = true); translate([5, 0, 0]) cube([2.5 + .5, 5.25 + .5, 42], center = true);
//half //half
//translate([0, 50, 0]) cube([100, 100, 100], center = true); //translate([0, 50, 0]) cube([100, 100, 100], center = true);
} }
@ -205,8 +205,8 @@ module motor_mount_bottom () {
translate([2.5, 19.5, 0]) cylinder(r=10/2, h = 60, center=true); // hole for panel bolt translate([2.5, 19.5, 0]) cylinder(r=10/2, h = 60, center=true); // hole for panel bolt
translate([22.5, 19.5, 0]) cube([40, 40, 60], center = true); //remove front entirely translate([22.5, 19.5, 0]) cube([40, 40, 60], center = true); //remove front entirely
translate([-6.5, 0, 7.5]) { translate([-6.5, 0, 7.5]) {
translate([0, screw_distance/2, 0]) sphere(r=screw_d, center = true); translate([0, screw_distance/2, 0]) sphere(r=screw_d);
translate([0, -screw_distance/2, 0]) sphere(r=screw_d, center = true); translate([0, -screw_distance/2, 0]) sphere(r=screw_d);
} }
} }
translate ([-one_to_one_x, -one_to_one_y, 0]) bolt_holder([mm_x[0], mm_y[0], -shelf_h / 2], mm_r[0], height - shelf_h, mm_l[0], tight = 0.2); //Bottom bolt holder translate ([-one_to_one_x, -one_to_one_y, 0]) bolt_holder([mm_x[0], mm_y[0], -shelf_h / 2], mm_r[0], height - shelf_h, mm_l[0], tight = 0.2); //Bottom bolt holder
@ -255,14 +255,8 @@ module motor_mount_bottom () {
microswitch_holder(); microswitch_holder();
bolt_holder([mm_x[2], mm_y[2], ((height - shelf_h)/ 2) + 3.75], 0, height - shelf_h - 4, 6); //bottom left mount bolt_holder([mm_x[2], mm_y[2], ((height - shelf_h)/ 2) + 3.75], 0, height - shelf_h - 4, 6); //bottom left mount
bolt_holder([mm_x[3], mm_y[3], ((height - shelf_h)/ 2) + 3.75], 180, height - shelf_h - 4, 6); //bottom right mount bolt_holder([mm_x[3], mm_y[3], ((height - shelf_h)/ 2) + 3.75], 180, height - shelf_h - 4, 6); //bottom right mount
if (DECOYS) {
difference () {
translate([35, 0 , 0]) decoys(44, 8, 6);
}
translate([0, 0, 8]) cube([4, 4, 4], center = true);
translate([40, 55, 8]) cube([4, 4, 4], center = true);
}
} }
module bolt_holder (position = [0, 0, 0], rotate_z = 0, h = 17, length = 4.5, hole = true, tight = 0) { module bolt_holder (position = [0, 0, 0], rotate_z = 0, h = 17, length = 4.5, hole = true, tight = 0) {
bolt_r = 6; bolt_r = 6;

17
hardware/parseVars.sh Normal file
View File

@ -0,0 +1,17 @@
#!/bin/bash
STOPWORD="${1}"
FILE=$(mktemp)
TMPFILE=$(mktemp)
cat intval3.scad | grep -e "${STOPWORD} ==" | awk -F'== "' '{print $2}' | awk -F'"' '{print $1}' > ${TMPFILE}
if [[ "${STOPWORD}" == "MODEL" ]]; then
cat ${TMPFILE} | sed 's/^/.\/stl\/intval3_/' | sed 's/$/.stl/' > ${FILE}
elif [[ "${STOPWORD}" == "LASER" ]]; then
cat ${TMPFILE} | sed 's/^/.\/dxf\/intval3_/' | sed 's/$/.dxf/' > ${FILE}
fi
rm -f ${TMPFILE}
cat ${FILE} | tr '\n' ' '
rm -f ${FILE}