def accessories(machine, assembly=None): assemblies = [ "raspberry_pi_assembly", "raspberry_pi_camera_assembly", "light_strip_assembly", "z_limit_switch_assembly" ] # # Make the target directory # target_dir = machine + "/stls/accessories" if os.path.isdir(target_dir): if not assembly: shutil.rmtree( target_dir) #if making all of them clear the directory first os.makedirs(target_dir) else: os.makedirs(target_dir) if assembly: assemblies = [assembly] for assembly in assemblies: print(assembly) bom.boms(machine, assembly) stl_list = stls.bom_to_stls(machine, assembly) stls.stls(machine, stl_list) # # Move all the stls that are not in the plates to the plates directory # for file in stl_list: src = machine + "/stls/" + file if os.path.isfile(src): shutil.move(src, target_dir + "/" + file) else: print("can't find %s to move" % src)
def make_machine(machine): print("boms.py:") boms(machine) print("sheets.py:") sheets(machine) print("stls.py:") stls(machine)
def accessories(machine, assembly = None): assemblies = ["raspberry_pi_assembly", "raspberry_pi_camera_assembly", "light_strip_assembly" ] # # Make the target directory # target_dir = machine + "/stls/accessories" if os.path.isdir(target_dir): if not assembly: shutil.rmtree(target_dir) #if making all of them clear the directory first os.makedirs(target_dir) else: os.makedirs(target_dir) if assembly: assemblies = [ assembly ] for assembly in assemblies: print(assembly) bom.boms(machine, assembly) stl_list = stls.bom_to_stls(machine, assembly) stls.stls(machine, stl_list) # # Move all the stls that are not in the plates to the plates directory # for file in stl_list: src = machine + "/stls/"+ file if os.path.isfile(src): shutil.move(src, target_dir + "/" + file) else: print("can't find %s to move" % src)
def plates(machine): # # Make the target directory # target_dir = machine + "/stls/printed" if os.path.isdir(target_dir): shutil.rmtree(target_dir) os.makedirs(target_dir) # # Make the stls in the list # if machine == "dibond" or machine == "huxley": plate_list.remove("cable_clips.stl"); used = stls(machine, plate_list) # # Move them to the plates directory # for file in plate_list: shutil.move(machine + "/stls/"+ file, target_dir + "/" + file) # # Copy 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.copy(path, target_dir + "/" + file) else: print("can't find %s to copy" % path)
def plates(machine): # # Make the target directory # target_dir = machine + "/stls/printed" if os.path.isdir(target_dir): shutil.rmtree(target_dir) os.makedirs(target_dir) # # Make the stls in the list # if machine == "dibond": plate_list.remove("cable_clips.stl") used = stls(machine, plate_list) # # Move them to the plates directory # for file in plate_list: shutil.move(machine + "/stls/" + file, target_dir + "/" + file) # # Copy 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.copy(path, target_dir + "/" + file) else: print "can't find %s to copy" % path
def plates(machine): # # Make the target directory # target_dir = machine + "/stls/printed" if os.path.isdir(target_dir): shutil.rmtree(target_dir) os.makedirs(target_dir) # # Make the stls in the list # if not machine in ["sturdy", "mendel"]: plate_list.remove("cable_clips.stl") if machine == "huxley": plate_list.remove("atx_brackets.stl") plate_list.remove("wades_extruder.stl") plate_list.append("direct_extruder.stl") used = stls(machine, plate_list) # # Move them to the plates directory # for file in plate_list: shutil.move(machine + "/stls/"+ file, target_dir + "/" + file) # # Copy 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.copy(path, target_dir + "/" + file) else: print("can't find %s to copy" % path)
def plates(machine): plate_list = [ "cal.stl", "atx_brackets.stl", "bar_clamps.stl", "cable_clips.stl", "d_motor_brackets.stl", "fixing_blocks.stl", "ribbon_clamps.stl", "small_bits.stl", "spool_holder_brackets.stl", "wades_extruder.stl", "x_carriage_parts.stl", "y_bearing_mounts.stl", "y_belt_anchors.stl", "z_motor_brackets.stl" ] # # Make the target directory # target_dir = machine + "/stls/printed" if os.path.isdir(target_dir): shutil.rmtree(target_dir) sleep(0.1) os.makedirs(target_dir) # # Make the stls in the list # if not machine in ["sturdy", "sturdy_E3D", "mendel"]: plate_list.remove("cable_clips.stl") if machine == "huxley": plate_list.remove("atx_brackets.stl") plate_list.remove("wades_extruder.stl") plate_list.append("direct_extruder.stl") used = stls(machine, plate_list) # # Move them to the plates directory # for file in plate_list: shutil.move(machine + "/stls/"+ file, target_dir + "/" + file) # # Copy 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.copy(path, target_dir + "/" + file) else: print("can't find %s to copy" % path)
def plates(machine): plate_list = [ "cal.stl", "atx_brackets.stl", "bar_clamps.stl", "cable_clips.stl", "d_motor_brackets.stl", "fixing_blocks.stl", "ribbon_clamps.stl", "small_bits.stl", "spool_holder_brackets.stl", "wades_extruder.stl", "x_carriage_parts.stl", "y_bearing_mounts.stl", "y_belt_anchors.stl", "z_motor_brackets.stl" ] # # Make the target directory # target_dir = machine + "/stls/printed" if os.path.isdir(target_dir): shutil.rmtree(target_dir) sleep(0.1) os.makedirs(target_dir) # # Make the stls in the list # if not machine in ["sturdy", "sturdy_E3D", "mendel"]: plate_list.remove("cable_clips.stl") if machine == "huxley": plate_list.remove("atx_brackets.stl") plate_list.remove("wades_extruder.stl") plate_list.append("direct_extruder.stl") used = stls(machine, plate_list) # # Move them to the plates directory # for file in plate_list: shutil.move(machine + "/stls/" + file, target_dir + "/" + file) # # Copy 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.copy(path, target_dir + "/" + file) else: print("can't find %s to copy" % path)
def make_machine(machine): boms(machine) sheets(machine) stls(machine) plates(machine)
def make_machine(machine): boms(machine) sheets(machine) stls(machine) accessories(machine) plates(machine)
# Add the files on the BOM to the used list for plates.py # for line in open("openscad.log"): if line[:7] == 'ECHO: "' and line[-6:] == '.stl"\n': used.append(line[7:-2]) # # List the ones we didn't find # for module in targets: print "Could not find", module return used if __name__ == '__main__': if len(sys.argv) > 1: stls(sys.argv[1], sys.argv[2:]) else: print "usage: stls [mendel|sturdy|your_machine] [part.stl ...]" sys.exit(1) ########NEW FILE######## __FILENAME__ = svg ## {{{ http://code.activestate.com/recipes/325823/ (r1) #!/usr/bin/env python """\ SVG.py - Construct/display SVG scenes. The following code is a lightweight wrapper around SVG files. The metaphor is to construct a scene, add objects to it, and then write it to a file to display it. """
# # Add the files on the BOM to the used list for plates.py # for line in open("openscad.log"): if line[:7] == 'ECHO: "' and line[-6:] == '.stl"\n': used.append(line[7:-2]) # # List the ones we didn't find # for module in targets: print "Could not find", module return used if __name__ == '__main__': if len(sys.argv) > 1: stls(sys.argv[1], sys.argv[2:]) else: print "usage: stls [mendel|sturdy|your_machine] [part.stl ...]" sys.exit(1) ########NEW FILE######## __FILENAME__ = svg ## {{{ http://code.activestate.com/recipes/325823/ (r1) #!/usr/bin/env python """\ SVG.py - Construct/display SVG scenes. The following code is a lightweight wrapper around SVG files. The metaphor is to construct a scene, add objects to it, and then write it to a file to display it. """