gcode_reader.emulate.machine_options

Attributes

Classes

BAAMOptions

A generic machine options base class

CEADOptions

A generic machine options base class

ElectroImpactOptions

A generic machine options base class

HendrickOptions

A generic machine options base class

IngersollOptions

A generic machine options base class

JuggerbotOptions

A generic machine options base class

MachineOptions

A generic machine options base class

RepRapOptions

A generic machine options base class

Module Contents

class gcode_reader.emulate.machine_options.BAAMOptions(**kwargs)[source]

Bases: MachineOptions

A generic machine options base class

Initialize the options for a machine.

Parameters:
  • flavor (dict, optional) – Syntax definition. Defaults to “default”.

  • offset (list, optional) – List of position data for machine initial position. Defaults to 0 for all location commands.

  • extrusion_type (string, optional) – Absolute or relative extrusion. Defaults to absolute.

  • units (string, optional) – Units of the print. Defaults to mm.

  • motion_profile (string, optional) – motion profile

  • g0_feed (float, optional) – Feedrate for G0 commands (if not specified in the command). Defaults to 0.0.

  • g1_feed (float, optional) – Feedrate for G1 commands (if not specified in the command). Defaults to 0.0.

  • max_feedrate (float, optional) – Feedrate limit. Defaults to None.

  • max_acceleration (float, optional) – Defaults to None.

  • max_jerk (float, optional) – Defaults to None.

load_config(filepath)[source]

Infers options from a config file. File should have extension “.config”, or “.ini”

Parameters:
  • filepath (str) – The path to the file to infer options from.

  • inplace (bool, Optional) – Defaults to True. When True, the data is saved to this MachineOptions before being returned.

  • ignore_extension (bool, Optional) – Defaults to False. When True, file extension is not checked

Raises:

ValueError – Unrecognized file extension and ignore_extension is false

Returns:

The options data parsed from the file

Return type:

dict

class gcode_reader.emulate.machine_options.CEADOptions(**kwargs)[source]

Bases: MachineOptions

A generic machine options base class

Initialize the options for a machine.

Parameters:
  • flavor (dict, optional) – Syntax definition. Defaults to “default”.

  • offset (list, optional) – List of position data for machine initial position. Defaults to 0 for all location commands.

  • extrusion_type (string, optional) – Absolute or relative extrusion. Defaults to absolute.

  • units (string, optional) – Units of the print. Defaults to mm.

  • motion_profile (string, optional) – motion profile

  • g0_feed (float, optional) – Feedrate for G0 commands (if not specified in the command). Defaults to 0.0.

  • g1_feed (float, optional) – Feedrate for G1 commands (if not specified in the command). Defaults to 0.0.

  • max_feedrate (float, optional) – Feedrate limit. Defaults to None.

  • max_acceleration (float, optional) – Defaults to None.

  • max_jerk (float, optional) – Defaults to None.

class gcode_reader.emulate.machine_options.ElectroImpactOptions(**kwargs)[source]

Bases: MachineOptions

A generic machine options base class

Initialize the options for a machine.

Parameters:
  • flavor (dict, optional) – Syntax definition. Defaults to “default”.

  • offset (list, optional) – List of position data for machine initial position. Defaults to 0 for all location commands.

  • extrusion_type (string, optional) – Absolute or relative extrusion. Defaults to absolute.

  • units (string, optional) – Units of the print. Defaults to mm.

  • motion_profile (string, optional) – motion profile

  • g0_feed (float, optional) – Feedrate for G0 commands (if not specified in the command). Defaults to 0.0.

  • g1_feed (float, optional) – Feedrate for G1 commands (if not specified in the command). Defaults to 0.0.

  • max_feedrate (float, optional) – Feedrate limit. Defaults to None.

  • max_acceleration (float, optional) – Defaults to None.

  • max_jerk (float, optional) – Defaults to None.

class gcode_reader.emulate.machine_options.HendrickOptions(**kwargs)[source]

Bases: MachineOptions

A generic machine options base class

Initialize the options for a machine.

Parameters:
  • flavor (dict, optional) – Syntax definition. Defaults to “default”.

  • offset (list, optional) – List of position data for machine initial position. Defaults to 0 for all location commands.

  • extrusion_type (string, optional) – Absolute or relative extrusion. Defaults to absolute.

  • units (string, optional) – Units of the print. Defaults to mm.

  • motion_profile (string, optional) – motion profile

  • g0_feed (float, optional) – Feedrate for G0 commands (if not specified in the command). Defaults to 0.0.

  • g1_feed (float, optional) – Feedrate for G1 commands (if not specified in the command). Defaults to 0.0.

  • max_feedrate (float, optional) – Feedrate limit. Defaults to None.

  • max_acceleration (float, optional) – Defaults to None.

  • max_jerk (float, optional) – Defaults to None.

class gcode_reader.emulate.machine_options.IngersollOptions(**kwargs)[source]

Bases: MachineOptions

A generic machine options base class

Initialize the options for a machine.

Parameters:
  • flavor (dict, optional) – Syntax definition. Defaults to “default”.

  • offset (list, optional) – List of position data for machine initial position. Defaults to 0 for all location commands.

  • extrusion_type (string, optional) – Absolute or relative extrusion. Defaults to absolute.

  • units (string, optional) – Units of the print. Defaults to mm.

  • motion_profile (string, optional) – motion profile

  • g0_feed (float, optional) – Feedrate for G0 commands (if not specified in the command). Defaults to 0.0.

  • g1_feed (float, optional) – Feedrate for G1 commands (if not specified in the command). Defaults to 0.0.

  • max_feedrate (float, optional) – Feedrate limit. Defaults to None.

  • max_acceleration (float, optional) – Defaults to None.

  • max_jerk (float, optional) – Defaults to None.

class gcode_reader.emulate.machine_options.JuggerbotOptions(**kwargs)[source]

Bases: MachineOptions

A generic machine options base class

Initialize the options for a machine.

Parameters:
  • flavor (dict, optional) – Syntax definition. Defaults to “default”.

  • offset (list, optional) – List of position data for machine initial position. Defaults to 0 for all location commands.

  • extrusion_type (string, optional) – Absolute or relative extrusion. Defaults to absolute.

  • units (string, optional) – Units of the print. Defaults to mm.

  • motion_profile (string, optional) – motion profile

  • g0_feed (float, optional) – Feedrate for G0 commands (if not specified in the command). Defaults to 0.0.

  • g1_feed (float, optional) – Feedrate for G1 commands (if not specified in the command). Defaults to 0.0.

  • max_feedrate (float, optional) – Feedrate limit. Defaults to None.

  • max_acceleration (float, optional) – Defaults to None.

  • max_jerk (float, optional) – Defaults to None.

class gcode_reader.emulate.machine_options.MachineOptions(flavor='default', offset=None, extrusion_type=ABS_EXTRUSION, units=None, motion_profile=None, g0_feed=0, g1_feed=0, max_feedrate=None, max_acceleration=None, max_jerk=None, **kwargs)[source]

A generic machine options base class

Initialize the options for a machine.

Parameters:
  • flavor (dict, optional) – Syntax definition. Defaults to “default”.

  • offset (list, optional) – List of position data for machine initial position. Defaults to 0 for all location commands.

  • extrusion_type (string, optional) – Absolute or relative extrusion. Defaults to absolute.

  • units (string, optional) – Units of the print. Defaults to mm.

  • motion_profile (string, optional) – motion profile

  • g0_feed (float, optional) – Feedrate for G0 commands (if not specified in the command). Defaults to 0.0.

  • g1_feed (float, optional) – Feedrate for G1 commands (if not specified in the command). Defaults to 0.0.

  • max_feedrate (float, optional) – Feedrate limit. Defaults to None.

  • max_acceleration (float, optional) – Defaults to None.

  • max_jerk (float, optional) – Defaults to None.

export(filepath, overwrite: bool = False)[source]

Exports options to a config or json file. File should have extension “.config”, “.ini”, “.json”, or “.s2c” Attempts to create a new file. If the file already exists, the export fails and returns None.

Parameters:
  • filepath (str) – The path to the file to export the options to.

  • overwrite (bool, optional) – Defaults to False. If False, nothing is written if the file exists. If True, the file’s contents will be overwritten if it exists.

Raises:

ValueError – Unrecognized file extension

Returns:

None

find_other_setting(property)[source]
load(filepath: str, file_type='', inplace=True)[source]

Determines which load function to use based on file extension Accepts files with extensions: “.nc”, “.mpf”, “.gcode”, “.ini”, “.config”, “.json”, “.s2c”

Parameters:
  • filepath (str) – The path to the file to infer options from.

  • file_type (str, Optional) – Defaults to “”. Accepts “gcode”, “config”, “json”, “3mf”. When set, ignore the file extension and parse the file using that format.

  • inplace (bool, Optional) – Defaults to True. When True, the data is saved to this MachineOptions before being returned.

load_3mf(filepath: str, inplace=True, ignore_extension=False)[source]

Infers options from a 3mf file. File should have extension “.3mf”

Parameters:
  • filepath (str) – The path to the file to infer options from.

  • inplace (bool, Optional) – Defaults to True. When True, the data is saved to this MachineOptions before being returned.

  • ignore_extension (bool, Optional) – Defaults to False. When True, file extension is not checked

Raises:

ValueError – Unrecognized file extension and ignore_extension is false

Returns:

The options data parsed from the file

Return type:

dict

load_config(filepath: str, inplace=True, ignore_extension=False)[source]

Infers options from a config file. File should have extension “.config”, or “.ini”

Parameters:
  • filepath (str) – The path to the file to infer options from.

  • inplace (bool, Optional) – Defaults to True. When True, the data is saved to this MachineOptions before being returned.

  • ignore_extension (bool, Optional) – Defaults to False. When True, file extension is not checked

Raises:

ValueError – Unrecognized file extension and ignore_extension is false

Returns:

The options data parsed from the file

Return type:

dict

load_gcode(filepath: str, inplace=True, ignore_extension=False, encoding='utf-8')[source]

Infers options from a gcode file. File should have extension “.nc”, “.mpf”, or “.gcode”

Parameters:
  • filepath (str) – The path to the file to infer options from.

  • inplace (bool, Optional) – Defaults to True. When True, the data is saved to this MachineOptions before being returned.

  • ignore_extension (bool, Optional) – Defaults to False. When True, file extension is not checked

  • encoding (str, optional) – File encoding. Defaults to ‘utf-8’.

Raises:

ValueError – Unrecognized file extension and ignore_extension is false

Returns:

The options data parsed from the file

Return type:

dict

load_json(filepath: str, inplace=True, ignore_extension=False)[source]

Infers options from a json file. File should have extension “.json”, or “.s2c”

Parameters:
  • filepath (str) – The path to the file to infer options from.

  • inplace (bool, Optional) – Defaults to True. When True, the data is saved to this MachineOptions before being returned.

  • ignore_extension (bool, Optional) – Defaults to False. When True, file extension is not checked

Raises:

ValueError – Unrecognized file extension and ignore_extension is false

Returns:

The options data parsed from the file

Return type:

dict

property all_options
property extrusion_type
property g0_feed
property g1_feed
gcode_options_syntax
property max_acceleration
property max_feedrate
property max_jerk
property motion_profile
property offset
syntax
property units
class gcode_reader.emulate.machine_options.RepRapOptions(**kwargs)[source]

Bases: MachineOptions

A generic machine options base class

Initialize the options for a machine.

Parameters:
  • flavor (dict, optional) – Syntax definition. Defaults to “default”.

  • offset (list, optional) – List of position data for machine initial position. Defaults to 0 for all location commands.

  • extrusion_type (string, optional) – Absolute or relative extrusion. Defaults to absolute.

  • units (string, optional) – Units of the print. Defaults to mm.

  • motion_profile (string, optional) – motion profile

  • g0_feed (float, optional) – Feedrate for G0 commands (if not specified in the command). Defaults to 0.0.

  • g1_feed (float, optional) – Feedrate for G1 commands (if not specified in the command). Defaults to 0.0.

  • max_feedrate (float, optional) – Feedrate limit. Defaults to None.

  • max_acceleration (float, optional) – Defaults to None.

  • max_jerk (float, optional) – Defaults to None.

gcode_reader.emulate.machine_options.ABS_EXTRUSION = 'absolute'
gcode_reader.emulate.machine_options.BOTH_EXTRUDER = 'both'
gcode_reader.emulate.machine_options.CONFIG_FILES = ('.ini', '.config')
gcode_reader.emulate.machine_options.DEFAULT_GCODE_SYNTAX
gcode_reader.emulate.machine_options.EXPECTED_UNITS = ('mm', 'cm', 'in')
gcode_reader.emulate.machine_options.FILAMENT_EXTRUDER = 'filament'
gcode_reader.emulate.machine_options.GCODE_FILES = ('.nc', '.mpf', '.gcode')
gcode_reader.emulate.machine_options.JSON_FILES = ('.json', '.s2c')
gcode_reader.emulate.machine_options.PELLET_EXTRUDER = 'pellet'
gcode_reader.emulate.machine_options.REL_EXTRUSION = 'relative'