3 # This script is used to generate print profiles for lulzbot printers
4 # based off of the lulzbot_profiles directory which contains common
5 # profiles for multiple toolheads.
6 # To generate profiles or update them, make sure there are no existing profiles
7 # by doing a rm -rf resources/quickprint/lulzbot_mini* resources/quickprint/lulzbot_TAZ*
8 # then run the script from the root Cura directory with ./scripts/create_lulzbot_profiles.py
17 CURA_QUICKPRINT_DIR="resources/quickprint/"
18 PROFILES_DIR="lulzbot_profiles"
21 'Mini_single_extruder_v2': ('lulzbot_mini',),
22 'Mini_flexystruder_v2': ('lulzbot_mini_flexystruder',),
23 'TAZ_single_extruder_0.35nozzle': ('lulzbot_TAZ_4_SingleV1',
24 'lulzbot_TAZ_5_SingleV1',
25 'lulzbot_TAZ_4_035nozzle',
26 'lulzbot_TAZ_5_035nozzle'),
27 'TAZ_single_extruder_0.5nozzle': ('lulzbot_TAZ_4_05nozzle',
28 'lulzbot_TAZ_5_05nozzle'),
29 'TAZ_dual_extruder_v1': ('lulzbot_TAZ_4_DualV1',
30 'lulzbot_TAZ_5_DualV1'),
31 'TAZ_dual_extruder_v2': ('lulzbot_TAZ_4_DualV2',
32 'lulzbot_TAZ_5_DualV2'),
33 'TAZ_flexystruder_v1': ('lulzbot_TAZ_4_FlexystruderV1',
34 'lulzbot_TAZ_5_FlexystruderV1'),
35 'TAZ_flexystruder_v2': ('lulzbot_TAZ_4_FlexystruderV2',
36 'lulzbot_TAZ_5_FlexystruderV2'),
37 'TAZ_flexy_dually_v1': ('lulzbot_TAZ_4_FlexyDuallyV1',
38 'lulzbot_TAZ_5_FlexyDuallyV1'),
39 'TAZ_flexy_dually_v2': ('lulzbot_TAZ_4_FlexyDuallyV2',
40 'lulzbot_TAZ_5_FlexyDuallyV2'),
47 'ninjaflex': 'NinjaFlex',
48 'semiflex': 'SemiFlex',
49 'ABS_ninjaflex': 'ABS & NinjaFlex',
50 'ABS_semiflex': 'ABS & SemiFlex',
51 'PLA_PVA': 'PLA & PVA',
52 'ABS_dual_color': 'ABS & ABS',
53 'PLA_dual_color': 'PLA & PLA',
54 'PLA_PVA_support': 'PLA & PVA',
72 'medium-quality': 'Standard',
73 'high-speed': 'High Speed',
74 'high-quality': 'High Detail',
86 'PET': ('High', 'Low', 'Normal', 'Ulti'),
87 'PLA': ('High', 'Low', 'Normal', 'Ulti'),
88 'ABS': ('High', 'Low', 'Normal', 'Ulti')
91 def split_profile(filename):
94 for m in material_map.keys():
95 if filename.startswith(m):
97 for p in profile_map.keys():
98 if filename.startswith(m + "_" + p):
100 return (material, profile)
102 return (material, profile)
104 def create_machine_type(machine_type, path, dir):
105 files = glob.glob(os.path.join(path, "*.ini"))
106 path = os.path.join(CURA_QUICKPRINT_DIR, machine_type)
108 filename = os.path.basename(file)
109 (material, profile) = split_profile(filename)
110 if material is None or profile is None:
112 profile_file = os.path.join("..", "..", "..", PROFILES_DIR, dir, filename)
113 if not os.path.exists(os.path.join(path, material, profile)):
114 os.makedirs(os.path.join(path, material, profile))
115 with open(os.path.join(path, material, 'material.ini'), 'w') as f:
117 f.write("name = %s\n" % material_map[material])
118 f.write("order = %d\n" % material_order[material])
119 with open(os.path.join(path, material, profile, 'profile.ini'), 'w') as f:
121 f.write("name = %s\n" % profile_map[profile])
122 f.write("order = %d\n" % profile_order[profile])
123 f.write("profile_file = %s\n" % profile_file)
124 for material in disable_materials.keys():
125 if os.path.exists(os.path.join(path, material)):
126 for profile in disable_materials[material]:
127 if not os.path.exists(os.path.join(path, material, profile)):
128 os.makedirs(os.path.join(path, material, profile))
129 with open(os.path.join(path, material, profile, 'profile.ini'), 'w') as f:
131 f.write("disabled = true\n")
133 os.makedirs(os.path.join(path, material))
134 with open(os.path.join(path, material, 'material.ini'), 'w') as f:
136 f.write("disabled = true\n")
140 if not os.path.exists(CURA_QUICKPRINT_DIR):
141 print "Cura path is wrong"
144 dirs = glob.glob(os.path.join(CURA_QUICKPRINT_DIR, PROFILES_DIR, "*"))
147 dir = os.path.basename(d)
148 if dir_map.has_key(dir):
149 for machine_type in dir_map[dir]:
150 create_machine_type(machine_type, d, dir)
153 if __name__ == '__main__':