def generate_warninglist(): template = "O500 {} {} {} {} {} {}" result = [] hotswapID = 256 for tmp_value in v.m4c_late_warning: if len(tmp_value) > 0: source = "D{}{}{}".format( v.filament_color_code[tmp_value[1]].strip("\n"), find_nearest_colour( v.filament_color_code[tmp_value[1]].strip("\n")), v.filament_type[0].strip("\n")) target = "D{}{}{}".format( v.filament_color_code[tmp_value[2]].strip("\n"), find_nearest_colour( v.filament_color_code[tmp_value[2]].strip("\n")), v.filament_type[0].strip("\n")) result.append( template.format(fn.hexify_short(hotswapID), fn.hexify_byte(tmp_value[0]), source, target, fn.hexify_short(tmp_value[3]), fn.hexify_short(tmp_value[4]))) hotswapID += 1 return result
def header_generate_omega_paletteplus(): header = ["MSF1.4\n"] cu = "cu:" for i in range(4): if v.palette_inputs_used[i]: cu = cu + "{}{};".format( v.used_filament_types.index(v.filament_type[i]) + 1, find_nearest_colour(v.filament_color_code[i].strip("\n"))) else: cu = cu + "0;" header.append(cu + "\n") header.append("ppm:{}\n".format((hexify_float(v.palette_plus_ppm))[1:])) header.append("lo:{}\n".format( (hexify_short(v.palette_plus_loading_offset))[1:])) header.append("ns:{}\n".format( hexify_short(len(v.splice_extruder_position))[1:])) header.append("np:{}\n".format( hexify_short(len(v.ping_extruder_position))[1:])) header.append("nh:0000\n") header.append("na:{}\n".format( hexify_short(len(v.splice_algorithm_table))[1:])) for i in range(len(v.splice_extruder_position)): header.append("({},{})\n".format( hexify_byte(v.splice_used_tool[i])[1:], (hexify_float(v.splice_extruder_position[i])[1:]))) # make ping list for i in range(len(v.ping_extruder_position)): header.append("(64,{})\n".format( (hexify_float(v.ping_extruder_position[i])[1:]))) # insert algos for i in range(len(v.splice_algorithm_table)): header.append("{}\n".format(v.splice_algorithm_table[i])) summary = generatesummary() warnings = generatewarnings() return {'header': header, 'summary': summary, 'warnings': warnings}