Cleaning up - Update python script and readme
This commit is contained in:
@@ -33,6 +33,16 @@ TODO
|
||||
- 2 dowel pins
|
||||
- 8 magnets
|
||||
|
||||
| Item | Quantity | Comment |
|
||||
|-----------------------------|--------------|-------------------------------------------------------|
|
||||
| M3x5 FHCS | left-aligned | |
|
||||
| M3x8 FHCS | centered | |
|
||||
| M3 hex nut | 4 | |
|
||||
| M3 Brass Heatset Insert () | 32 | |
|
||||
| 3x10mm steel dowel pin | 4 | Not strict: dimensions can be changed. Please see ... |
|
||||
| 6x2mm neodymium disc magnet | 8 | 6mm diameter, 2mm height |
|
||||
| | | |
|
||||
|
||||
|
||||
## Configuring + Generating STLs
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 7.8 KiB |
@@ -1,7 +0,0 @@
|
||||
include <./assemblyGuide.scad>
|
||||
|
||||
features();
|
||||
|
||||
module features() {
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
include <../stackConnector.scad>
|
||||
include <../stackEnds.scad>
|
||||
|
||||
// Oriented for 3d printing. No supports required.
|
||||
stackConnectorBottom();
|
||||
@@ -1,4 +1,4 @@
|
||||
include <../stackConnector.scad>
|
||||
include <../stackEnds.scad>
|
||||
|
||||
// Oriented for 3d printing. No supports required, but it's reccommended to print this with a brim.
|
||||
// Adding a brim will require some post-processing in the form of trimming the bottom.
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
include <./config.scad>
|
||||
|
||||
// Main rail variables:
|
||||
|
||||
/* Small horizontal planes at the top and bottom of the main rails. Used so we can fasten the rail to the frame
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
include <../helper/halfspace.scad>
|
||||
include <../helper/slack.scad>
|
||||
include <./sharedVariables.scad>
|
||||
include <./connector/connectors.scad>
|
||||
|
||||
// Distance from midpoint of stack connectors to each other
|
||||
stackConnectorDx = rackTotalWidth - 2*(connectorXEdgeToYBarXEdge + connectorRectWidth/2);
|
||||
|
||||
@@ -1,13 +1,139 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import argparse
|
||||
import subprocess
|
||||
import os
|
||||
import sys
|
||||
|
||||
parser = argparse.ArgumentParser(
|
||||
prog='rbuild',
|
||||
description='CLI-based helper utility to build project items',
|
||||
epilog='That\'s all folks!')
|
||||
|
||||
parser.add_argument('build')
|
||||
#parser.add_argument('-c', '--count') # option that takes a value
|
||||
#parser.add_argument('-v', '--verbose', action='store_true') # on/off flag
|
||||
# For actual dimensions, please see profiles.scad.
|
||||
class BuildSizeConfig:
|
||||
MINI = 'mini'
|
||||
MICRO = 'micro'
|
||||
DEFAULT = 'default'
|
||||
|
||||
args = parser.parse_args()
|
||||
print(args.build)
|
||||
|
||||
RACK_BUILD_DIR = './rack/print'
|
||||
RACK_MOUNT_BUILD_DIR = './rack-mount/print'
|
||||
|
||||
RACK_BUILD_TARGET_DIR = './stl/rack'
|
||||
RACK_MOUNT_BUILD_TARGET_DIR = './stl/rack-mount'
|
||||
|
||||
|
||||
def main():
|
||||
if not assert_os():
|
||||
print("Linux Required for OpenSCAD CLI")
|
||||
return
|
||||
|
||||
parser = argparse.ArgumentParser(
|
||||
prog='rbuild',
|
||||
description='CLI-based helper utility to build project items. '
|
||||
'This includes both the rack and also rack-mount items',
|
||||
epilog='That\'s all folks!'
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
'-b',
|
||||
nargs='?',
|
||||
const='all',
|
||||
help='Build command. Optionally pass in a specific part name to only build that item. '
|
||||
'Defaults to building everything'
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
'-c',
|
||||
default='default',
|
||||
choices=[BuildSizeConfig.MINI, BuildSizeConfig.MICRO, BuildSizeConfig.DEFAULT],
|
||||
help='Build size config profile. This will determine the size of the rack you wish to generate. '
|
||||
'For actual dimensions, please see profiles.scad.'
|
||||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
build_var = args.b
|
||||
config_var = args.c
|
||||
|
||||
run_build(build_var, config_var)
|
||||
|
||||
|
||||
def run_build(build_var, config_var):
|
||||
if build_var == 'all':
|
||||
for dir_file in os.listdir(RACK_BUILD_DIR):
|
||||
build_single(RACK_BUILD_DIR, RACK_BUILD_TARGET_DIR, dir_file, config_var)
|
||||
|
||||
for dir_file in os.listdir(RACK_MOUNT_BUILD_DIR):
|
||||
build_single(RACK_MOUNT_BUILD_DIR, RACK_MOUNT_BUILD_TARGET_DIR, dir_file, config_var)
|
||||
|
||||
return
|
||||
|
||||
filename_rack = find_rack(build_var)
|
||||
filename_rack_mount = find_rack_mount(build_var)
|
||||
|
||||
if not (filename_rack or filename_rack_mount):
|
||||
print('File:', build_var, 'not found!')
|
||||
return
|
||||
|
||||
if filename_rack:
|
||||
build_single(RACK_BUILD_DIR, RACK_BUILD_TARGET_DIR, filename_rack, config_var)
|
||||
|
||||
if filename_rack_mount:
|
||||
build_single(RACK_MOUNT_BUILD_DIR, RACK_MOUNT_BUILD_TARGET_DIR, filename_rack, config_var)
|
||||
|
||||
|
||||
def build_single(build_dir, target_dir, filename, config):
|
||||
print('Building:', filename, 'from', build_dir, 'to', target_dir)
|
||||
run_openscad(construct_openscad_args(build_dir, target_dir, filename, config))
|
||||
|
||||
|
||||
def construct_openscad_args(build_dir, target_dir, filename, config):
|
||||
source = os.path.join(build_dir, filename)
|
||||
target = os.path.join(target_dir, os.path.splitext(filename)[0] + '.stl')
|
||||
|
||||
return ['-o', target, source]
|
||||
|
||||
|
||||
def find_rack(filename):
|
||||
return find_scad_file(RACK_BUILD_DIR, filename)
|
||||
|
||||
|
||||
def find_rack_mount(filename):
|
||||
return find_scad_file(RACK_MOUNT_BUILD_DIR, filename)
|
||||
|
||||
|
||||
def find_scad_file(directory, filename):
|
||||
for dir_file in os.listdir(directory):
|
||||
dir_file_normalized = dir_file.lower()
|
||||
filename_normalized = filename.lower()
|
||||
|
||||
if dir_file_normalized.endswith("_p.scad"):
|
||||
dir_file_normalized = dir_file_normalized[:-7]
|
||||
|
||||
if filename_normalized.endswith("_p.scad"):
|
||||
filename_normalized = filename_normalized[:-7]
|
||||
|
||||
if dir_file_normalized == filename_normalized \
|
||||
or os.path.splitext(dir_file_normalized)[0] == filename_normalized:
|
||||
return dir_file
|
||||
return None
|
||||
|
||||
|
||||
def run_openscad(options=['-h']):
|
||||
command = ['openscad', '-q'] + options
|
||||
try:
|
||||
subprocess.check_output(command, universal_newlines=True, stderr=subprocess.DEVNULL)
|
||||
|
||||
except FileNotFoundError:
|
||||
print('OpenSCAD command not found! '
|
||||
'Please make sure that you have OpenSCAD installed and can run OpenSCAD CLI commands. '
|
||||
'(Currently need Linux for this)')
|
||||
|
||||
|
||||
def assert_os():
|
||||
if sys.platform == 'linux':
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
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
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+56086
File diff suppressed because it is too large
Load Diff
+12838
-12838
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
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+18118
File diff suppressed because it is too large
Load Diff
+13470
File diff suppressed because it is too large
Load Diff
+49450
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user