mirror of
https://github.com/nophead/Mendel90.git
synced 2025-08-19 11:31:23 +02:00
Now combines some STLs into single files and puts all the ones that need printing the the plates directory.
Added hash bangs for Linux users.
This commit is contained in:
52
plates.py
Normal file
52
plates.py
Normal file
@@ -0,0 +1,52 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
import os
|
||||
import shutil
|
||||
from stls import stls, bom_to_stls
|
||||
|
||||
plate_list = [
|
||||
"cal.stl",
|
||||
"bar_clamps.stl",
|
||||
"cable_clips.stl",
|
||||
"d_motor_brackets.stl",
|
||||
"ribbon_clamps.stl",
|
||||
"x_carriage_parts.stl",
|
||||
"y_bearing_mounts.stl",
|
||||
"y_belt_anchors.stl",
|
||||
"z_motor_brackets.stl"
|
||||
]
|
||||
|
||||
def plates(machine):
|
||||
#
|
||||
# Make the target directory
|
||||
#
|
||||
target_dir = machine + "/stls/plates"
|
||||
if os.path.isdir(target_dir):
|
||||
shutil.rmtree(target_dir)
|
||||
os.makedirs(target_dir)
|
||||
#
|
||||
# Make the stls in the list
|
||||
#
|
||||
used = stls(machine, plate_list)
|
||||
#
|
||||
# Move them to the plates directory
|
||||
for file in plate_list:
|
||||
shutil.move(machine + "/stls/"+ file, target_dir + "/" + file)
|
||||
#
|
||||
# Move all the stls that are not in the plates to the plates directory
|
||||
#
|
||||
for file in bom_to_stls(machine):
|
||||
path = machine + "/stls/"+ file
|
||||
if not file in used:
|
||||
if os.path.isfile(path):
|
||||
shutil.move(path, target_dir + "/" + file)
|
||||
else:
|
||||
print "can't find %s to move" % path
|
||||
|
||||
if __name__ == '__main__':
|
||||
if len(sys.argv) > 1:
|
||||
plates(sys.argv[1])
|
||||
else:
|
||||
print "usage: plates [mendel|sturdy|your_machine]"
|
||||
sys.exit(1)
|
Reference in New Issue
Block a user