Ejemplo n.º 1
0
def parse_gcode():
    cur_z = -999
    cur_tool = 0
    retract = 0.6
    layer = -1
    toolchange = 0
    emptygrid = 0

    v.block_classification = CLS_NORMAL
    v.previous_block_classification = CLS_NORMAL
    total_line_count = len(v.input_gcode)

    index = 0
    for line in v.input_gcode:

        gui.progress_string(4 + 46 * index // total_line_count)

        specifier = 0
        code = gcode.GCodeCommand(line)
        v.parsedgcode.append(code)

        classupdate = False

        if line.startswith(';'):

            ## P2PP SPECIFIC SETP COMMANDS
            ########################################################
            if line.startswith(";P2PP"):
                parameters.check_config_parameters(line)

            if line.startswith(";P2PP MATERIAL_"):
                algorithm_process_material_configuration(line[15:])

            ## LAYER DISCRIMINATION COMMANDS
            ########################################################

            if line.startswith(";LAYER"):
                layer = 0
                try:
                    layer = int(line[7:])
                except ValueError:
                    fields = line[7:].split(" ")
                    for field in fields:
                        try:
                            layer = int(field)
                            break
                        except ValueError:
                            pass

                v.parsedlayer = layer
                if layer > 0:
                    v.skippable_layer.append((emptygrid > 0)
                                             and (toolchange == 0))
                toolchange = 0
                emptygrid = 0

            ## Update block class from comments information
            #########################################################
            classupdate = update_class(line)
        #
        # if line.startswith('T'):
        #     classupdate = update_class(line)

        if classupdate:

            if v.block_classification == CLS_TOOL_START:
                toolchange += 1

            if v.block_classification == CLS_EMPTY:
                emptygrid += 1

        ## Z-HOPS detection
        ###################
        if code.has_E() and code.is_movement_command():

            to_z = code.get_parameter("Z", 0)
            delta = (to_z - cur_z)

            if abs(delta - retract) < 0.0001:
                specifier |= SPEC_HOPUP

                if v.block_classification == CLS_TONORMAL:
                    v.previous_block_classification = v.block_classification = CLS_NORMAL

            if abs(-delta - retract) < 0.0001:
                specifier |= SPEC_HOPDOWN

            cur_z = to_z

        ## retract detections
        #####################
        if code.is_retract_command():
            specifier |= SPEC_RETRACTS

        ## tool change detection
        ########################
        if code.Command == 'T':
            cur_tool = int(code.Command_value)
            retract = v.retract_lift[cur_tool]
            specifier |= SPEC_TOOLCHANGE

        if v.tower_measure:
            if code.is_movement_command():
                if code.X is not None:
                    v.wipe_tower_info['minx'] = min(v.wipe_tower_info['minx'],
                                                    code.X)
                    v.wipe_tower_info['maxx'] = max(v.wipe_tower_info['maxx'],
                                                    code.X)
                if code.Y is not None:
                    v.wipe_tower_info['miny'] = min(v.wipe_tower_info['miny'],
                                                    code.Y)
                    v.wipe_tower_info['maxy'] = max(v.wipe_tower_info['maxy'],
                                                    code.Y)

        ## Extend block backwards towards last hop up
        #############################################

        if v.block_classification in [
                CLS_TOOL_START, CLS_TOOL_UNLOAD, CLS_EMPTY, CLS_BRIM
        ]:  # and not v.full_purge_reduction:
            backpass(v.block_classification)

        if v.block_classification in [CLS_ENDGRID, CLS_ENDPURGE]:
            if code.fullcommand == "G1":
                if code.has_X() and code.has_Y():
                    specifier |= SPEC_INTOWER

        if CLS_ENDGRID:
            code = v.parsedgcode[-1]
            if code.has_X and code.has_Y():
                if not coordinate_in_tower(code.X, code.Y):
                    v.block_classification = CLS_NORMAL
            # if v.parsedgcode[-1].fullcommand == "G1" and v.parsedgcode[-1].Z:
            #     v.block_classification = CLS_NORMAL
        else:
            if flagset(specifier, SPEC_RETRACTS):
                v.block_classification = CLS_NORMAL

        ## Put obtained values in global variables
        ##########################################
        v.gcodeclass.append(v.block_classification)
        v.layernumber.append(layer)
        v.linetool.append(cur_tool)
        v.parsecomment.append(specifier)
        v.classupdates.append(
            v.block_classification != v.previous_block_classification)
        v.previous_block_classification = v.block_classification
        index = index + 1

        if v.block_classification == CLS_BRIM_END:
            v.block_classification = CLS_NORMAL
Ejemplo n.º 2
0
def parse_gcode():
    cur_tool = 0
    toolchange = 0
    emptygrid = 0

    v.block_classification = CLS_NORMAL
    v.previous_block_classification = CLS_NORMAL
    total_line_count = len(v.input_gcode)

    index = 0
    for line in v.input_gcode:

        gui.progress_string(4 + 46 * index // total_line_count)


        if line.startswith(';'):

            m = v.regex_p2pp.match(line)
            if m:
                parameters.check_config_parameters(m.group(1), m.group(2))


            if line.startswith(";P2PP MATERIAL_"):
                algorithm_process_material_configuration(line[15:])

            layer = -1
            # if not supports are printed or layers are synced, there is no need to look at the layerheight,
            # otherwise look at the layerheight to determine the layer progress

            lm = layer_regex.match(line)
            if lm is not None:
                llm = len(lm.group(1))
                lmv = float(lm.group(2))
                if v.synced_support or not v.prints_support:
                    if llm == 5:  # LAYER
                        layer = int(lmv)
                else:
                    if llm == 11:  # LAYERHEIGHT
                        layer = int((lmv - v.first_layer_height + 0.005) / v.layer_height)

            if layer == v.parsedlayer:
                layer = -1

            if layer >= 0:
                v.parsedlayer = layer

            if layer > 0:
                v.skippable_layer.append((emptygrid > 0) and (toolchange == 0))
                toolchange = 0
                emptygrid = 0

            update_class(line)

        code = gcode.GCodeCommand(line)

        if code.Command == 'T':
            cur_tool = int(code.Command_value)
            v.set_tool = cur_tool
            v.m4c_toolchanges.append(cur_tool)
            v.m4c_toolchange_source_positions.append(len(v.parsed_gcode))


        code.Tool = cur_tool
        code.Class = v.block_classification


        # code.add_comment("[{}]".format(v.classes[v.block_classification]))
        v.parsed_gcode.append(code)

        if v.block_classification != v.previous_block_classification:

            if v.block_classification == CLS_TOOL_START:
                toolchange += 1

            if v.block_classification == CLS_EMPTY:
                emptygrid += 1

            if v.block_classification == CLS_BRIM or v.block_classification == CLS_TOOL_START or v.block_classification == CLS_TOOL_UNLOAD or v.block_classification == CLS_EMPTY:
                backpass(v.block_classification)

        if v.tower_measure:
            calculate_tower(code.X, code.Y)

        if v.block_classification == CLS_ENDGRID or v.block_classification == CLS_ENDPURGE:
            if code.has_X() and code.has_Y():
                if not coordinate_in_tower(code.X, code.Y):
                    v.parsed_gcode[-1].Class = CLS_NORMAL
                    v.block_classification = CLS_NORMAL

        if v.block_classification == CLS_BRIM_END:
            v.block_classification = CLS_NORMAL

        index += 1
Ejemplo n.º 3
0
def gcode_parseline(gcode_full_line):

    __tower_remove = False

    if not gcode_full_line[0] == ";":
        gcode_full_line = gcode_full_line.split(';')[0]

    gcode_full_line = gcode_full_line.rstrip('\n')

    if gcode_full_line == "":
        v.processedGCode.append("\n")
        return

    if gcode_full_line.startswith('T'):
        new_tool = int(gcode_full_line[1])
        gcode_process_toolchange(new_tool, v.totalMaterialExtruded)
        v.allowFilamentInformationUpdate = True
        v.processedGCode.append(';--- P2PP removed ' + gcode_full_line + "\n")
        return

    if v.side_wipe:
        sidewipe.collect_wipetower_info(gcode_full_line)

        if v.side_wipe_skip:
            v.processedGCode.append(";--- P2PP sremoved " + gcode_full_line +
                                    "\n")
            return

        if moved_in_tower() and v.side_wipe and not v.side_wipe_skip:
            if not gcode_full_line[0] == ";":
                v.processedGCode.append(";--- P2PP  - Purge Tower - " +
                                        gcode_full_line + "\n")
            gcode_full_line = gcode_remove_params(gcode_full_line, ["X", "Y"])
            __tower_remove = True

    # Processing of extrusion speed commands
    # ############################################
    if gcode_full_line.startswith("M220"):
        new_feedrate = get_gcode_parameter(gcode_full_line, "S")
        if new_feedrate != "":
            v.currentprintFeedrate = new_feedrate / 100

    # Processing of extrusion multiplier commands
    # ############################################
    if gcode_full_line.startswith("M221"):
        new_multiplier = get_gcode_parameter(gcode_full_line, "S")
        if new_multiplier != "":
            v.extrusionMultiplier = new_multiplier / 100

    # Processing of print head movements
    #############################################

    if v.emptyGrid and (v.wipeFeedRate != 2000):
        gcode_full_line = gcode_remove_params(gcode_full_line, ["F"])

    if gcode_full_line.startswith(
            "G") and not gcode_full_line.startswith("G28"):
        to_x = get_gcode_parameter(gcode_full_line, "X")
        to_y = get_gcode_parameter(gcode_full_line, "Y")
        prev_x = v.currentPositionX
        prev_y = v.currentPositionY
        if to_x != "":
            v.currentPositionX = float(to_x)
        if to_y != "":
            v.currentPositionY = float(to_y)
        if not coordinate_on_bed(v.currentPositionX,
                                 v.currentPositionY) and coordinate_on_bed(
                                     prev_x, prev_y):
            gcode_full_line = ";" + gcode_full_line

    if gcode_full_line.startswith("G1"):
        extruder_movement = get_gcode_parameter(gcode_full_line, "E")
        if extruder_movement != "":
            extruder_movement = extruder_movement * v.extrusionMultiplier
            if v.within_tool_change_block and v.side_wipe:
                v.side_wipe_length += extruder_movement

            v.totalMaterialExtruded += extruder_movement

            if (v.totalMaterialExtruded - v.lastPingExtruderPosition) > v.pingIntervalLength and\
                    v.side_wipe_length == 0:
                v.pingIntervalLength = v.pingIntervalLength * v.pingLengthMultiplier
                v.pingIntervalLength = min(v.maxPingIntervalLength,
                                           v.pingIntervalLength)
                v.lastPingExtruderPosition = v.totalMaterialExtruded
                v.pingExtruderPosition.append(v.lastPingExtruderPosition)
                v.processedGCode.append(";Palette 2 - PING\n")
                v.processedGCode.append("G4 S0\n")
                v.processedGCode.append("O31 {}\n".format(
                    hexify_float(v.lastPingExtruderPosition)))

        if v.within_tool_change_block and v.side_wipe:
            if not __tower_remove:
                v.processedGCode.append(';--- P2PP removed ' +
                                        gcode_full_line + "\n")
            return

        if not v.within_tool_change_block and v.wipeRetracted:
            sidewipe.unretract()

    # Other configuration information
    # this information should be defined in your Slic3r printer settings, startup GCode
    ###################################################################################
    if gcode_full_line.startswith(";P2PP"):
        parameters.check_config_parameters(gcode_full_line)
        v.side_wipe = not coordinate_on_bed(v.wipetower_posx, v.wipetower_posy)

        if gcode_full_line.startswith(";P2PP MATERIAL_"):
            algorithm_process_material_configuration(gcode_full_line[15:])

    if gcode_full_line.startswith("M900"):
        k_factor = get_gcode_parameter(gcode_full_line, "K")
        if int(k_factor) > 0:
            sidewipe.create_side_wipe()
            v.within_tool_change_block = False
            v.mmu_unload_remove = False
        if v.reprap_compatible:
            v.processedGCode.append(';--- P2PP removed ' + gcode_full_line +
                                    "\n")
            return

    if gcode_full_line.startswith(";P2PP ENDPURGETOWER"):
        sidewipe.create_side_wipe()
        v.within_tool_change_block = False
        v.mmu_unload_remove = False

    # Next section(s) clean up the GCode generated for the MMU
    # specially the rather violent unload/reload required for the MMU2
    # special processing for side wipes is required in this section
    #################################################################

    if "CP EMPTY GRID START" in gcode_full_line and v.current_layer > "0":
        v.emptyGrid = True
        v.current_print_feed = v.wipeFeedRate / 60
        v.processedGCode.append(";P2PP Set wipe speed to {}mm/s\n".format(
            v.current_print_feed))
        v.processedGCode.append("G1 F{}\n".format(v.wipeFeedRate))

    if "CP EMPTY GRID END" in gcode_full_line:
        v.emptyGrid = False

    if "TOOLCHANGE START" in gcode_full_line:
        v.allowFilamentInformationUpdate = False
        v.within_tool_change_block = True
        sidewipe.sidewipe_toolchange_start()

    if ("TOOLCHANGE END" in gcode_full_line) and not v.side_wipe:
        v.within_tool_change_block = False
        v.mmu_unload_remove = False

    if "TOOLCHANGE UNLOAD" in gcode_full_line and not v.side_wipe:
        v.current_print_feed = v.wipeFeedRate / 60
        v.mmu_unload_remove = True
        if v.current_layer != "0":
            v.processedGCode.append(";P2PP Set wipe speed to {}mm/s\n".format(
                v.current_print_feed))
            v.processedGCode.append("G1 F{}\n".format(v.wipeFeedRate))
        else:
            v.processedGCode.append(";P2PP Set wipe speed to 33.3mm/s\n")
            v.processedGCode.append("G1 F2000\n")

    if "TOOLCHANGE WIPE" in gcode_full_line:
        v.mmu_unload_remove = False
        if coordinate_on_bed(v.currentPositionX, v.currentPositionY):
            v.processedGCode.append("G0 X{} Y{}\n".format(
                v.currentPositionX, v.currentPositionY))

        # Layer Information
    if gcode_full_line.startswith(";LAYER "):
        v.current_layer = gcode_full_line[7:]

    if v.mmu_unload_remove:
        v.processedGCode.append(
            gcode_filter_toolchange_block(gcode_full_line) + "\n")
        return

    if v.within_tool_change_block:
        v.processedGCode.append(
            gcode_filter_toolchange_block(gcode_full_line) + "\n")
        return

    # Catch All
    v.processedGCode.append(gcode_full_line + "\n")
Ejemplo n.º 4
0
def parse_config_parameters():

    # TODO - get this information from the environment parameters
    # TODO - need to find out as from what version of PS this is working

    for idx in range(len(v.input_gcode) - 1, -1, -1):

        gcode_line = v.input_gcode[idx]

        if gcode_line.startswith("; estimated printing time"):
            try:
                fields = gcode_line.split("=")
                fields = fields[-1].split(" ")
                for i in range(len(fields)):
                    fields[i] = "0" + fields[i].strip('hms')

                if len(fields) > 2:
                    h = int(fields[-3])
                else:
                    h = 0

                if len(fields) > 1:
                    m = int(fields[-2])
                else:
                    m = 0

                if len(fields) > 0:
                    s = int(fields[-1])
                else:
                    s = 0

                v.printing_time = h * 3600 + m * 60 + s

            except (ValueError, IndexError):
                pass
            return

        if gcode_line.startswith("; filament_settings_id"):
            v.filament_ids = split_csv_strings(gcode_line)

        if "generated by PrusaSlicer" in gcode_line:
            try:
                s1 = gcode_line.split("+")
                s2 = s1[0].split(" ")
                v.ps_version = s2[-1]
                gui.create_logitem(
                    "File was created with PS version:{}".format(v.ps_version))
                if v.ps_version < "2.2":
                    gui.create_logitem(
                        "<b>This version of P2PP is optimized to work with PS2.2 and higher!<b>"
                    )
            except (ValueError, IndexError):
                pass
            continue

        if gcode_line.startswith("; single_extruder_multi_material_priming"):
            parameter_start = gcode_line.find("=")
            if parameter_start != -1:
                try:
                    if int(gcode_line[parameter_start + 1:].strip()) == 1:
                        gui.log_warning(
                            "[Print Settings][Multiple Extruders][Wipe Tower]Prime all printing extruders MUST be turned off"
                        )
                        gui.log_warning("THIS FILE WILL NOT PRINT CORRECTLY")
                except (ValueError, IndexError):
                    pass
            continue

        if gcode_line.startswith("; wipe_tower_no_sparse_layers"):
            parameter_start = gcode_line.find("=")
            if parameter_start != -1:
                try:
                    v.wipe_remove_sparse_layers = (int(
                        gcode_line[parameter_start + 1:].strip()) == 1)
                except (ValueError, IndexError):
                    pass
            continue

        if gcode_line.startswith("; variable_layer_height"):
            parameter_start = gcode_line.find("=")
            if parameter_start != -1:
                v.variable_layer = int(gcode_line[parameter_start +
                                                  1:].strip()) == 1
            continue

        if gcode_line.startswith("; bed_shape") and not v.bed_shape_warning:
            get_bedshape(gcode_line)

        if gcode_line.startswith("; first_layer_temperature"):
            parameter_start = gcode_line.find("=")
            if parameter_start != -1:
                try:
                    temps = gcode_line[parameter_start + 1:].strip().split(",")
                    v.p3_printtemp = []
                    for i in range(len(temps)):
                        v.p3_printtemp.append(int(temps[i]))
                except (IndexError, ValueError):
                    v.p3_printtemp = [0, 0, 0, 0, 0, 0, 0, 0]

        if gcode_line.startswith("; first_layer_bed_temperature"):
            parameter_start = gcode_line.find("=")
            if parameter_start != -1:
                try:
                    temps = gcode_line[parameter_start + 1:].strip().split(",")
                    v.p3_bedtemp = []
                    for i in range(len(temps)):
                        v.p3_bedtemp.append(int(temps[i]))
                except (IndexError, ValueError):
                    v.p3_bedtemp = [0, 0, 0, 0, 0, 0, 0, 0]

        if gcode_line.startswith("; max_print_height"):

            parameter_start = gcode_line.find("=")
            if parameter_start != -1:
                v.z_maxheight = float(gcode_line[parameter_start + 1:].strip())
            continue

        if gcode_line.startswith("; wipe_tower_x"):
            parameter_start = gcode_line.find("=")
            if parameter_start != -1:
                v.wipe_tower_posx = float(gcode_line[parameter_start +
                                                     1:].strip())
            continue

        if gcode_line.startswith("; min_skirt_length"):
            parameter_start = gcode_line.find("=")
            if parameter_start != -1:
                v.skirtsize = float(gcode_line[parameter_start + 1:].strip())
            continue

        if gcode_line.startswith("; skirts"):
            parameter_start = gcode_line.find("=")
            if parameter_start != -1:
                v.skirts = float(gcode_line[parameter_start + 1:].strip())
            continue

        if gcode_line.startswith("; wipe_tower_width"):
            parameter_start = gcode_line.find("=")
            if parameter_start != -1:
                v.wipe_tower_width = float(gcode_line[parameter_start +
                                                      1:].strip())
            continue

        if gcode_line.startswith("; wipe_tower_y"):
            parameter_start = gcode_line.find("=")
            if parameter_start != -1:
                v.wipe_tower_posy = float(gcode_line[parameter_start +
                                                     1:].strip())
            continue

        if gcode_line.startswith("; extrusion_width"):
            parameter_start = gcode_line.find("=")
            if parameter_start != -1:
                parm = gcode_line[parameter_start + 1:].strip()

                if len(parm) == 0:
                    gui.log_warning(
                        "extrusion width parameter does not contain any values FULL PURGE REDUCTION will not work"
                    )
                    gui.log_warning(
                        "Please manually set the values for default extrusion (Print Settings/Advanced/Extrusion Width to resolve"
                    )
                    continue

                if parm[-1] == "%":
                    parm = parm.replace("%", "").strip()
                    tmpval = float(parm)
                    v.extrusion_width = v.nozzle_diameter * tmpval / 100.0
                else:
                    v.extrusion_width = float(gcode_line[parameter_start +
                                                         1:].strip())

                v.tx_offset = 2 + 4 * v.extrusion_width
                v.yy_offset = 2 + 8 * v.extrusion_width
            continue

        if gcode_line.startswith("; infill_speed"):
            parameter_start = gcode_line.find("=")
            if parameter_start != -1:
                v.infill_speed = float(
                    gcode_line[parameter_start + 1:].strip()) * 60
            continue

        if gcode_line.startswith("; layer_height"):
            parameter_start = gcode_line.find("=")
            if parameter_start != -1:
                v.layer_height = float(gcode_line[parameter_start +
                                                  1:].strip())
            continue

        # this next function assumes that the parameters are stored in alphabetical order
        # so layer_height is defined BEFORE first layer height when parsing back to front
        if gcode_line.startswith("; first_layer_height"):
            parameter_start = gcode_line.find("=")
            if parameter_start != -1:
                value = gcode_line[parameter_start + 1:].strip()
                if value[-1] == "%":
                    v.first_layer_height = float(
                        value[:-1]) / 100.0 * v.layer_height
                else:
                    v.first_layer_height = float(value)
            continue

        if gcode_line.startswith("; support_material_synchronize_layers"):
            parameter_start = gcode_line.find("=")
            if parameter_start != -1:
                tmp = float(gcode_line[parameter_start + 1:].strip())
                v.synced_support = tmp == 1
            continue

        if gcode_line.startswith("; support_material "):
            parameter_start = gcode_line.find("=")
            if parameter_start != -1:
                tmp = float(gcode_line[parameter_start + 1:].strip())
                v.support_material = tmp == 1
            continue

        if gcode_line.startswith("; nozzle_diameter "):
            parameter_start = gcode_line.find("=")
            if parameter_start != -1:
                tmp = gcode_line[parameter_start + 1:].strip().split(",")
                tmp = float(tmp[0])

                v.nozzle_diameter = tmp
            continue

        if gcode_line.startswith("; start_filament_gcode "):
            parameter_start = gcode_line.find("=")
            gcode_value = gcode_line[parameter_start + 2:].strip()
            fields = split_csv_strings(gcode_value)
            for i in range(len(fields)):
                lines = fields[0].split("\\n")
                for line in lines:
                    if line.startswith(";P2PP PROFILETYPEOVERRIDE="):
                        value = line[26:]
                        v.filament_type[i] = value
                        v.used_filament_types.append(v.filament_type[i])
                        v.used_filament_types = list(
                            dict.fromkeys(v.used_filament_types))
            continue

        if gcode_line.startswith("; start_gcode "):
            parameter_start = gcode_line.find("=")
            gcode_value = gcode_line[parameter_start + 2:].strip()
            lines = gcode_value.split("\\n")
            for line in lines:
                m = v.regex_p2pp.match(line)
                if m:
                    if m.group(1).startswith("MATERIAL"):
                        algorithm_process_material_configuration(
                            m.group(1)[9:])
                    else:
                        parameters.check_config_parameters(
                            m.group(1), m.group(2))

            if v.blobster_advanced:
                if len(v.blobster_advanced_speed) == 0:
                    gui.log_warning(
                        "BLOBSTER - Advanced mode required BLOBSTER_ADVANCED_SPEED parameter"
                    )
                if len(v.blobster_advanced_fan) == 0:
                    gui.log_warning(
                        "BLOBSTER - Advanced mode required BLOBSTER_ADVANCED_FAN parameter"
                    )
                if len(v.blobster_advanced_length) == 0:
                    gui.log_warning(
                        "BLOBSTER - Advanced mode required BLOBSTER_ADVANCED_LENGTH parameter"
                    )

                if len(v.blobster_advanced_speed) != len(
                        v.blobster_advanced_fan) or len(
                            v.blobster_advanced_speed) != len(
                                v.blobster_advanced_length):
                    gui.log_warning(
                        "BLOBSTER - Advanced mode - BLOBSTER_ADVANCED_LENGTH/FAN/SPEED parameter must have same number of parameters"
                    )

        if gcode_line.startswith("; extruder_colour") or gcode_line.startswith(
                "; filament_colour"):
            filament_colour = ''
            parameter_start = gcode_line.find("=")
            gcode_line = gcode_line[parameter_start + 1:].strip()
            parameter_start = gcode_line.find("#")
            if parameter_start != -1:
                filament_colour = gcode_line.split(";")
            v.filament_count = len(filament_colour)
            for i in range(v.filament_count):
                v.filament_color_code[i] = filament_colour[i][1:]

        if gcode_line.startswith("; filament_diameter"):
            parameter_start = gcode_line.find("=")
            if parameter_start != -1:
                filament_diameters = gcode_line[parameter_start +
                                                1:].strip(" ").split(",")
                v.filament_diameter = [1.75] * max(len(filament_diameters), 4)
                for i in range(len(filament_diameters)):
                    v.filament_diameter[i] = float(filament_diameters[i])
            continue

        if gcode_line.startswith("; filament_type"):
            parameter_start = gcode_line.find("=")
            if parameter_start != -1:
                filament_string = gcode_line[parameter_start +
                                             1:].strip(" ").split(";")
                for i in range(len(filament_string)):
                    if v.filament_type[i] != "":
                        filament_string[i] = v.filament_type[i]
                v.filament_type = filament_string
                v.used_filament_types = list(set(filament_string))
            continue

        if gcode_line.startswith("; retract_length = "):
            retract_error = False
            parameter_start = gcode_line.find("=")
            if parameter_start != -1:
                retracts = gcode_line[parameter_start +
                                      1:].strip(" ").split(",")
                v.retract_length = [0.8] * max(len(retracts), v.colors)
                for i in range(len(retracts)):
                    v.retract_length[i] = float(retracts[i]) - 0.02
                    if v.retract_length[i] < 0.0:
                        retract_error = True
                        gui.log_warning(
                            "[Printer Settings]->[Extruders 1 -> {}]->[Retraction Length] should not be set to zero."
                            .format(i))
                    if retract_error:
                        gui.log_warning(
                            "Generated file might not print correctly")
            continue

        if gcode_line.startswith("; gcode_flavor"):
            if "reprap" in gcode_line:
                v.isReprap_Mode = True
            continue

        if "use_firmware_retraction" in gcode_line:
            parameter_start = gcode_line.find("=")
            if parameter_start != -1:
                gcode_line = gcode_line[parameter_start + 1:].replace(";", "")
                if "1" in gcode_line:
                    gui.log_warning("Hardware retraction no longer supported")
            continue

        if "use_relative_e_distances" in gcode_line:
            parameter_start = gcode_line.find("=")
            if parameter_start != -1:
                gcode_line = gcode_line[parameter_start + 1:].replace(";", "")
                if "1" not in gcode_line:
                    gui.log_warning(
                        "P2PP requires input file with RELATIVE extrusion")
            continue

        if gcode_line.startswith("; wiping_volumes_matrix"):
            wiping_info = []
            _warning = False
            parameter_start = gcode_line.find("=")
            if parameter_start != -1:
                wiping_info = gcode_line[parameter_start +
                                         1:].strip(" ").split(",")
                _warning = True
                for i in range(len(wiping_info)):
                    if int(wiping_info[i]) != 140 and int(wiping_info[i]) != 0:
                        _warning = False
                    wiping_info[i] = float(wiping_info[i])

            v.max_wipe = max(wiping_info)
            v.bigbrain3d_matrix_blobs = v.max_wipe < 20
            if not v.bigbrain3d_matrix_blobs:
                map(filament_volume_to_length, wiping_info)
            else:
                gui.create_emptyline()
                gui.create_logitem("BigBrain3D BLOB transitions detected")
                color_table_size = int(math.sqrt(len(wiping_info)))
                header = "<table><tr><th>From\\To</th>"
                data = ""
                for i in range(color_table_size):
                    header = header + "<th>  Input {}  </th>".format(i)
                    data = data + "<tr><th>Input {}   </th>".format(i)
                    for j in range(color_table_size):
                        data = data + ("<td align=center>{}</td>".format(
                            int(wiping_info[j * color_table_size + i])))
                    data = data + "</tr>"

                header = header + "</tr>"
                data = data + "</table>"
                gui.create_logitem(header + data)

                gui.create_emptyline()

            v.wiping_info = wiping_info
            if _warning:
                gui.create_logitem(
                    "<b>All purge lenghths 70/70 OR 140.  Purge lengths may not have been set correctly.</b>"
                )
            continue