Cleaning up - Update python script and readme

This commit is contained in:
zhao
2023-05-21 13:41:41 -04:00
parent 40dc26ef51
commit 3474acbec5
22 changed files with 216434 additions and 12856 deletions

View File

@ -33,6 +33,16 @@ TODO
- 2 dowel pins - 2 dowel pins
- 8 magnets - 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 ## Configuring + Generating STLs

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.8 KiB

View File

@ -1,7 +0,0 @@
include <./assemblyGuide.scad>
features();
module features() {
}

View File

@ -1,4 +1,4 @@
include <../stackConnector.scad> include <../stackEnds.scad>
// Oriented for 3d printing. No supports required. // Oriented for 3d printing. No supports required.
stackConnectorBottom(); stackConnectorBottom();

View File

@ -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. // 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. // Adding a brim will require some post-processing in the form of trimming the bottom.

View File

@ -1,3 +1,5 @@
include <./config.scad>
// Main rail variables: // 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 /* Small horizontal planes at the top and bottom of the main rails. Used so we can fasten the rail to the frame

View File

@ -1,6 +1,7 @@
include <../helper/halfspace.scad> include <../helper/halfspace.scad>
include <../helper/slack.scad> include <../helper/slack.scad>
include <./sharedVariables.scad> include <./sharedVariables.scad>
include <./connector/connectors.scad>
// Distance from midpoint of stack connectors to each other // Distance from midpoint of stack connectors to each other
stackConnectorDx = rackTotalWidth - 2*(connectorXEdgeToYBarXEdge + connectorRectWidth/2); stackConnectorDx = rackTotalWidth - 2*(connectorXEdgeToYBarXEdge + connectorRectWidth/2);

138
rbuild.py
View File

@ -1,13 +1,139 @@
#!/usr/bin/env python3
import argparse import argparse
import subprocess
import os
import sys
# For actual dimensions, please see profiles.scad.
class BuildSizeConfig:
MINI = 'mini'
MICRO = 'micro'
DEFAULT = 'default'
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( parser = argparse.ArgumentParser(
prog='rbuild', prog='rbuild',
description='CLI-based helper utility to build project items', description='CLI-based helper utility to build project items. '
epilog='That\'s all folks!') 'This includes both the rack and also rack-mount items',
epilog='That\'s all folks!'
)
parser.add_argument('build') parser.add_argument(
#parser.add_argument('-c', '--count') # option that takes a value '-b',
#parser.add_argument('-v', '--verbose', action='store_true') # on/off flag 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() args = parser.parse_args()
print(args.build)
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

4482
stl/rack/hingeModule_P1.stl Normal file

File diff suppressed because it is too large Load Diff

5630
stl/rack/magnetModule_P1.stl Normal file

File diff suppressed because it is too large Load Diff

5630
stl/rack/magnetModule_P2.stl Normal file

File diff suppressed because it is too large Load Diff

56086
stl/rack/mainRail_P.stl Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

16354
stl/rack/sideWallLeft_P.stl Normal file

File diff suppressed because it is too large Load Diff

16354
stl/rack/sideWallRight_P.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

18118
stl/rack/xBar_P.stl Normal file

File diff suppressed because it is too large Load Diff

13470
stl/rack/xyPlate_P.stl Normal file

File diff suppressed because it is too large Load Diff

49450
stl/rack/yBar_P.stl Normal file

File diff suppressed because it is too large Load Diff