Skip to content

PrusaSlicer gcode file compatibility #34

@aissak21

Description

@aissak21

The following code chunk worked well for a gcode file sliced in CURA but not in PrusaSlicer. Now I get error: word 'P' value invalid. Is there a way to go about this to parse this file with pygcode, perhaps if it's not a compatibility issue? There is a PyGcode extension for Prusa but it's for adding gcode into the file via python.

from pygcode import Line
    gcode_lines = []
    gcode_block = []
    gcode_params = []
    
    with open(test_file2, 'r') as test:
      for line_text in test.readlines():
          line = Line(line_text) # decode gcode line
          line.block.gcodes  # list of gcodes
          line.block.modal_params  # motion modal parameters
          
          gcode_lines.append(line)
          gcode_block.append(line.block.gcodes)
          gcode_params.append(line.block.modal_params)
    
    print(gcode_block, sep='\n') 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions