update stls and build script with custom target
This commit is contained in:
6
.gitignore
vendored
6
.gitignore
vendored
@ -1,3 +1,9 @@
|
|||||||
*~
|
*~
|
||||||
[#]*
|
[#]*
|
||||||
.idea
|
.idea
|
||||||
|
|
||||||
|
|
||||||
|
stl/
|
||||||
|
!stl/mini/
|
||||||
|
!stl/micro/
|
||||||
|
!stl/nano/
|
||||||
|
|||||||
13
README.md
13
README.md
@ -14,7 +14,7 @@ See the [renders for difference parametric profiles here](media/renders)
|
|||||||
|
|
||||||
## Assembly
|
## Assembly
|
||||||
|
|
||||||
Pre-generated STLs for roughly 200mm^3 (mini), 170mm^3 (micro), and 100mm^3 (nano) rack frames can be found in [stl](stl).
|
Pre-generated STLs for roughly 200mm^3 (mini), 180mm^3 (micro), and 100mm^3 (nano) rack frames can be found in [stl](stl).
|
||||||
These STLs are generated from the files in [rack/print](rack/print), and [rack-mount/print](rack-mount/print) - further information about printing these parts
|
These STLs are generated from the files in [rack/print](rack/print), and [rack-mount/print](rack-mount/print) - further information about printing these parts
|
||||||
(supports, orientation) can be found in these files.
|
(supports, orientation) can be found in these files.
|
||||||
|
|
||||||
@ -54,13 +54,16 @@ Requirements:
|
|||||||
- `python3`
|
- `python3`
|
||||||
|
|
||||||
### Examples:
|
### Examples:
|
||||||
Generate all project files for the `mini` profile:
|
Generate all project files for the `micro` profile:
|
||||||
|
|
||||||
`python3 rbuild.py -b all -c micro`
|
`python3 rbuild.py -b all -c micro -t custom`
|
||||||
|
|
||||||
Generate specific part:
|
This will build all the required STLs for a micro rack in the `stl/custom/` directory.
|
||||||
|
|
||||||
`python3 rbuild.py -b yBar`
|
|
||||||
|
For generating a specific part:
|
||||||
|
|
||||||
|
`python3 rbuild.py -b yBar -c micro -t custom`
|
||||||
|
|
||||||
Generated stls are put into the `stl/` directories. The actual variable values for different profiles can be found in
|
Generated stls are put into the `stl/` directories. The actual variable values for different profiles can be found in
|
||||||
[rack/profiles.scad](rack/profiles.scad).
|
[rack/profiles.scad](rack/profiles.scad).
|
||||||
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
_profileConfigs = [
|
_profileConfigs = [
|
||||||
["default", [
|
["default", [
|
||||||
["maxUnitWidth", 170],
|
["maxUnitWidth", 180],
|
||||||
["maxUnitDepth", 180],
|
["maxUnitDepth", 180],
|
||||||
["numRailScrews", 18],
|
["numRailScrews", 18],
|
||||||
["screwDiff", 10],
|
["screwDiff", 10],
|
||||||
@ -27,7 +27,7 @@ _profileConfigs = [
|
|||||||
["numRailScrews", 10]
|
["numRailScrews", 10]
|
||||||
]],
|
]],
|
||||||
["micro", [
|
["micro", [
|
||||||
["maxUnitWidth", 170],
|
["maxUnitWidth", 180],
|
||||||
["maxUnitDepth", 180],
|
["maxUnitDepth", 180],
|
||||||
["numRailScrews", 18]
|
["numRailScrews", 18]
|
||||||
]],
|
]],
|
||||||
|
|||||||
59
rbuild.py
59
rbuild.py
@ -30,8 +30,7 @@ def main():
|
|||||||
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. '
|
||||||
'This includes both the rack and also rack-mount items',
|
'This includes both the rack and also rack-mount items'
|
||||||
epilog='That\'s all folks!'
|
|
||||||
)
|
)
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
@ -44,24 +43,43 @@ def main():
|
|||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-c',
|
'-c',
|
||||||
default=BuildSizeConfig.MINI,
|
default=BuildSizeConfig.MICRO,
|
||||||
choices=[BuildSizeConfig.NANO, BuildSizeConfig.MINI, BuildSizeConfig.MICRO],
|
choices=[BuildSizeConfig.NANO, BuildSizeConfig.MINI, BuildSizeConfig.MICRO],
|
||||||
help='Build size config profile. This will determine the size of the rack you wish to generate. '
|
help='Build size config profile. This will determine the size of the rack you wish to generate. '
|
||||||
'For actual dimensions, please see profiles.scad.'
|
'For actual dimensions, please see profiles.scad.'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
parser.add_argument(
|
||||||
|
'-t',
|
||||||
|
default="",
|
||||||
|
help='Target directory to build STLs in (is under the /stl directory). Default target directory is based on '
|
||||||
|
'the config.'
|
||||||
|
)
|
||||||
|
|
||||||
|
parser.add_argument(
|
||||||
|
'-dz',
|
||||||
|
default=0,
|
||||||
|
help='Override number of rail screws (ie override rail height). Defaults to profile settings.'
|
||||||
|
)
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
run_build(args)
|
||||||
|
|
||||||
|
|
||||||
|
def run_build(args):
|
||||||
|
|
||||||
build_var = args.b
|
build_var = args.b
|
||||||
config_var = args.c
|
config_var = args.c
|
||||||
|
target_var = args.t
|
||||||
|
dz = args.dz
|
||||||
|
|
||||||
run_build(build_var, config_var)
|
if target_var != "":
|
||||||
|
final_target_directory_name = target_var
|
||||||
|
else:
|
||||||
|
final_target_directory_name = config_var
|
||||||
|
|
||||||
|
rackBuildDirFull = os.path.join(BUILD_PARENT_DIR, final_target_directory_name, RACK_BUILD_TARGET_SUB_DIR)
|
||||||
def run_build(build_var, config_var):
|
rackMountBuildDirFull = os.path.join(BUILD_PARENT_DIR, final_target_directory_name, RACK_MOUNT_BUILD_TARGET_SUB_DIR)
|
||||||
|
|
||||||
rackBuildDirFull = os.path.join(BUILD_PARENT_DIR, config_var, RACK_BUILD_TARGET_SUB_DIR)
|
|
||||||
rackMountBuildDirFull = os.path.join(BUILD_PARENT_DIR, config_var, RACK_MOUNT_BUILD_TARGET_SUB_DIR)
|
|
||||||
|
|
||||||
if not os.path.exists(rackBuildDirFull):
|
if not os.path.exists(rackBuildDirFull):
|
||||||
os.makedirs(rackBuildDirFull)
|
os.makedirs(rackBuildDirFull)
|
||||||
@ -71,10 +89,10 @@ def run_build(build_var, config_var):
|
|||||||
|
|
||||||
if build_var == 'all':
|
if build_var == 'all':
|
||||||
for dir_file in os.listdir(RACK_BUILD_DIR):
|
for dir_file in os.listdir(RACK_BUILD_DIR):
|
||||||
build_single(RACK_BUILD_DIR, rackBuildDirFull, dir_file, config_var)
|
build_single(RACK_BUILD_DIR, rackBuildDirFull, dir_file, config_var, dz)
|
||||||
|
|
||||||
for dir_file in os.listdir(RACK_MOUNT_BUILD_DIR):
|
for dir_file in os.listdir(RACK_MOUNT_BUILD_DIR):
|
||||||
build_single(RACK_MOUNT_BUILD_DIR, rackMountBuildDirFull, dir_file, config_var)
|
build_single(RACK_MOUNT_BUILD_DIR, rackMountBuildDirFull, dir_file, config_var, dz)
|
||||||
return
|
return
|
||||||
|
|
||||||
filename_rack = find_rack(build_var)
|
filename_rack = find_rack(build_var)
|
||||||
@ -85,23 +103,30 @@ def run_build(build_var, config_var):
|
|||||||
return
|
return
|
||||||
|
|
||||||
if filename_rack:
|
if filename_rack:
|
||||||
build_single(RACK_BUILD_DIR, rackBuildDirFull, filename_rack, config_var)
|
build_single(RACK_BUILD_DIR, rackBuildDirFull, filename_rack, config_var, dz)
|
||||||
|
|
||||||
if filename_rack_mount:
|
if filename_rack_mount:
|
||||||
build_single(RACK_MOUNT_BUILD_DIR, rackMountBuildDirFull, filename_rack, config_var)
|
build_single(RACK_MOUNT_BUILD_DIR, rackMountBuildDirFull, filename_rack, config_var, dz)
|
||||||
|
|
||||||
|
|
||||||
def build_single(build_dir, target_dir, filename, config):
|
def build_single(build_dir, target_dir, filename, config, dz):
|
||||||
print('Building:', filename, 'from', build_dir, 'to', target_dir)
|
print('Building:', filename, 'from', build_dir, 'to', target_dir)
|
||||||
openscad_args = construct_openscad_args(build_dir, target_dir, filename, config)
|
openscad_args = construct_openscad_args(build_dir, target_dir, filename, config, dz)
|
||||||
run_openscad(openscad_args)
|
run_openscad(openscad_args)
|
||||||
|
|
||||||
|
|
||||||
def construct_openscad_args(build_dir, target_dir, filename, config):
|
def construct_openscad_args(build_dir, target_dir, filename, config, dz):
|
||||||
source = os.path.join(build_dir, filename)
|
source = os.path.join(build_dir, filename)
|
||||||
target = os.path.join(target_dir, os.path.splitext(filename)[0] + '.stl')
|
target = os.path.join(target_dir, os.path.splitext(filename)[0] + '.stl')
|
||||||
|
|
||||||
return ['-D', 'profileName=\"' + config + '\"', '-o', target, source]
|
openscad_args = ['-D', 'profileName=\"' + config + '\"']
|
||||||
|
|
||||||
|
if dz != 0:
|
||||||
|
openscad_args += ['-D', 'numRailScrews=' + dz]
|
||||||
|
|
||||||
|
openscad_args += ['-o', target, source]
|
||||||
|
|
||||||
|
return openscad_args
|
||||||
|
|
||||||
|
|
||||||
def find_rack(filename):
|
def find_rack(filename):
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user