8 CURA_QUICKPRINT_DIR="resources/quickprint/"
9 PROFILES_DIR="lulzbot_profiles"
12 'Mini_single_extruder_v2': ('lulzbot_mini',),
13 'Mini_flexystruder_v2': ('lulzbot_mini_flexystruder',),
14 'TAZ_single_extruder_0.35nozzle': ('lulzbot_TAZ_4_SingleV1',
15 'lulzbot_TAZ_5_SingleV1',
16 'lulzbot_TAZ_4_035nozzle',
17 'lulzbot_TAZ_5_035nozzle'),
18 'TAZ_single_extruder_0.5nozzle': ('lulzbot_TAZ_4_05nozzle',
19 'lulzbot_TAZ_5_05nozzle'),
20 'TAZ_dual_extruder_v1': ('lulzbot_TAZ_4_DualV1',
21 'lulzbot_TAZ_5_DualV1'),
22 'TAZ_dual_extruder_v2': ('lulzbot_TAZ_4_DualV2',
23 'lulzbot_TAZ_5_DualV2'),
24 'TAZ_flexystruder_v1': ('lulzbot_TAZ_4_FlexystruderV1',
25 'lulzbot_TAZ_5_FlexystruderV1'),
26 'TAZ_flexystruder_v2': ('lulzbot_TAZ_4_FlexystruderV2',
27 'lulzbot_TAZ_5_FlexystruderV2'),
28 'TAZ_flexy_dually_v1': ('lulzbot_TAZ_4_FlexyDuallyV1',
29 'lulzbot_TAZ_5_FlexyDuallyV1'),
30 'TAZ_flexy_dually_v2': ('lulzbot_TAZ_4_FlexyDuallyV2',
31 'lulzbot_TAZ_5_FlexyDuallyV2'),
38 'ninjaflex': 'NinjaFlex',
39 'semiflex': 'SemiFlex',
40 'ABS_ninjaflex': 'ABS & NinjaFlex',
41 'ABS_semiflex': 'ABS & SemiFlex',
42 'PLA_PVA': 'PLA & PVA',
43 'ABS_dual_color': 'ABS & ABS',
44 'PLA_dual_color': 'PLA & PLA',
45 'PLA_PVA_support': 'PLA & PVA',
63 'high-quality': 'Fine Quality',
64 'medium-quality': 'Standard Quality',
65 'high-speed': 'Fast Speed',
75 'PET': ('High', 'Low', 'Normal', 'Ulti'),
76 'PLA': ('High', 'Low', 'Normal', 'Ulti'),
77 'ABS': ('High', 'Low', 'Normal', 'Ulti')
80 def split_profile(filename):
83 for m in material_map.keys():
84 if filename.startswith(m):
86 for p in profile_map.keys():
87 if filename.startswith(m + "_" + p):
89 return (material, profile)
91 return (material, profile)
93 def create_machine_type(machine_type, path, dir):
94 files = glob.glob(os.path.join(path, "*.ini"))
95 path = os.path.join(CURA_QUICKPRINT_DIR, machine_type)
97 filename = os.path.basename(file)
98 (material, profile) = split_profile(filename)
99 if material is None or profile is None:
101 profile_file = os.path.join("..", "..", "..", PROFILES_DIR, dir, filename)
102 if not os.path.exists(os.path.join(path, material, profile)):
103 os.makedirs(os.path.join(path, material, profile))
104 with open(os.path.join(path, material, 'material.ini'), 'w') as f:
106 f.write("name = %s\n" % material_map[material])
107 f.write("order = %d\n" % material_order[material])
108 with open(os.path.join(path, material, profile, 'profile.ini'), 'w') as f:
110 f.write("name = %s\n" % profile_map[profile])
111 f.write("order = %d\n" % profile_order[profile])
112 f.write("profile_file = %s\n" % profile_file)
113 for material in disable_materials.keys():
114 if os.path.exists(os.path.join(path, material)):
115 for profile in disable_materials[material]:
116 if not os.path.exists(os.path.join(path, material, profile)):
117 os.makedirs(os.path.join(path, material, profile))
118 with open(os.path.join(path, material, profile, 'profile.ini'), 'w') as f:
120 f.write("disabled = true\n")
122 os.makedirs(os.path.join(path, material))
123 with open(os.path.join(path, material, 'material.ini'), 'w') as f:
125 f.write("disabled = true\n")
129 if not os.path.exists(CURA_QUICKPRINT_DIR):
130 print "Cura path is wrong"
133 dirs = glob.glob(os.path.join(CURA_QUICKPRINT_DIR, PROFILES_DIR, "*"))
136 dir = os.path.basename(d)
137 if dir_map.has_key(dir):
138 for machine_type in dir_map[dir]:
139 create_machine_type(machine_type, d, dir)
142 if __name__ == '__main__':