示例#1
0
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
示例#2
0
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)
示例#3
0
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 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)
示例#5
0
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)
示例#6
0
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)
示例#7
0
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)
示例#8
0
def stls(machine, parts=None):
    #
    # Make the target directory
    #
    target_dir = machine + "/stls"
    if os.path.isdir(target_dir):
        if not parts:
            shutil.rmtree(
                target_dir)  #if making the BOM clear the directory first
            os.makedirs(target_dir)
    else:
        os.makedirs(target_dir)

    #
    # Set the target machine
    #
    f = open("scad/conf/machine.scad", "wt")
    f.write("include <%s_config.scad>\n" % machine)
    f.close()

    #
    # Decide which files to make
    #
    if parts:
        targets = list(
            parts)  #copy the list so we dont modify the list passed in
    else:
        targets = bom_to_stls(machine)
    #
    # Find all the scad files
    #
    used = []
    for filename in os.listdir(source_dir):
        if filename[-5:] == ".scad":
            #
            # find any modules ending in _stl
            #
            for line in open(source_dir + "/" + filename, "r").readlines():
                words = line.split()
                if (len(words) and words[0] == "module"):
                    module = words[1].split('(')[0]
                    stl = module.replace("_stl", ".stl")
                    if stl in targets:
                        #
                        # make a file to use the module
                        #
                        stl_maker_name = source_dir + "/stl.scad"
                        f = open(stl_maker_name, "w")
                        f.write("use <%s>\n" % filename)
                        f.write("%s();\n" % module)
                        f.close()
                        #
                        # Run openscad on the created file
                        #
                        stl_name = target_dir + "/" + module[:-4] + ".stl"
                        openscad.run("-D$bom=1", "-o", stl_name,
                                     stl_maker_name)
                        c14n_stl.canonicalise(stl_name)
                        targets.remove(stl)
                        #
                        # 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
示例#9
0
def stls(machine, parts = None):
    #
    # Make the target directory
    #
    target_dir = machine + "/stls"
    if os.path.isdir(target_dir):
        if not parts:
            shutil.rmtree(target_dir)   #if making the BOM clear the directory first
            os.makedirs(target_dir)
    else:
        os.makedirs(target_dir)

    #
    # Set the target machine
    #
    f = open("scad/conf/machine.scad","wt")
    f. write("include <%s_config.scad>\n" % machine);
    f.close()

    #
    # Decide which files to make
    #
    if parts:
        targets = list(parts)           #copy the list so we dont modify the list passed in
    else:
        targets = bom_to_stls(machine)
    #
    # Find all the scad files
    #
    used = []
    for filename in os.listdir(source_dir):
        if filename[-5:] == ".scad":
            #
            # find any modules ending in _stl
            #
            for line in open(source_dir + "/" + filename, "r").readlines():
                words = line.split()
                if(len(words) and words[0] == "module"):
                    module = words[1].split('(')[0]
                    stl = module.replace("_stl", ".stl")
                    if stl in targets:
                        #
                        # make a file to use the module
                        #
                        stl_maker_name = source_dir + "/stl.scad"
                        f = open(stl_maker_name, "w")
                        f.write("use <%s>\n" % filename)
                        f.write("%s();\n" % module);
                        f.close()
                        #
                        # Run openscad on the created file
                        #
                        stl_name = target_dir + "/" + module[:-4] + ".stl"
                        openscad.run("-D$bom=1","-o", stl_name, stl_maker_name)
                        c14n_stl.canonicalise(stl_name)
                        targets.remove(stl)
                        #
                        # 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