diff options
author | Nino van Hooff <ninovanhooff@gmail.com> | 2020-05-08 16:58:51 +0300 |
---|---|---|
committer | Nino van Hooff <ninovanhooff@gmail.com> | 2020-05-08 16:58:51 +0300 |
commit | 40327c42593e943ce91a2459eb331933cd376dbd (patch) | |
tree | f1fcd7786938ffa3c247806ea9dfe18d74624fc2 /plugins/GCodeReader | |
parent | 6ca9b4678e7a2bb6bb6f0122b71e32e81f6884a3 (diff) |
Convert doxygen to rst for GcodeReader, GcodeGzReader/Writer,
GCodeProfileReader
Diffstat (limited to 'plugins/GCodeReader')
-rw-r--r-- | plugins/GCodeReader/FlavorParser.py | 22 | ||||
-rw-r--r-- | plugins/GCodeReader/RepRapFlavorParser.py | 20 |
2 files changed, 27 insertions, 15 deletions
diff --git a/plugins/GCodeReader/FlavorParser.py b/plugins/GCodeReader/FlavorParser.py index 7b19fdb160..bcb7efc816 100644 --- a/plugins/GCodeReader/FlavorParser.py +++ b/plugins/GCodeReader/FlavorParser.py @@ -28,9 +28,8 @@ PositionOptional = NamedTuple("Position", [("x", Optional[float]), ("y", Optiona Position = NamedTuple("Position", [("x", float), ("y", float), ("z", float), ("f", float), ("e", List[float])]) -## This parser is intended to interpret the common firmware codes among all the -# different flavors class FlavorParser: + """This parser is intended to interpret the common firmware codes among all the different flavors""" def __init__(self) -> None: CuraApplication.getInstance().hideMessageSignal.connect(self._onHideMessage) @@ -212,8 +211,9 @@ class FlavorParser: # G0 and G1 should be handled exactly the same. _gCode1 = _gCode0 - ## Home the head. def _gCode28(self, position: Position, params: PositionOptional, path: List[List[Union[float, int]]]) -> Position: + """Home the head.""" + return self._position( params.x if params.x is not None else position.x, params.y if params.y is not None else position.y, @@ -221,21 +221,26 @@ class FlavorParser: position.f, position.e) - ## Set the absolute positioning def _gCode90(self, position: Position, params: PositionOptional, path: List[List[Union[float, int]]]) -> Position: + """Set the absolute positioning""" + self._is_absolute_positioning = True self._is_absolute_extrusion = True return position - ## Set the relative positioning def _gCode91(self, position: Position, params: PositionOptional, path: List[List[Union[float, int]]]) -> Position: + """Set the relative positioning""" + self._is_absolute_positioning = False self._is_absolute_extrusion = False return position - ## Reset the current position to the values specified. - # For example: G92 X10 will set the X to 10 without any physical motion. def _gCode92(self, position: Position, params: PositionOptional, path: List[List[Union[float, int]]]) -> Position: + """Reset the current position to the values specified. + + For example: G92 X10 will set the X to 10 without any physical motion. + """ + if params.e is not None: # Sometimes a G92 E0 is introduced in the middle of the GCode so we need to keep those offsets for calculate the line_width self._extrusion_length_offset[self._extruder_number] = position.e[self._extruder_number] - params.e @@ -291,8 +296,9 @@ class FlavorParser: _type_keyword = ";TYPE:" _layer_keyword = ";LAYER:" - ## For showing correct x, y offsets for each extruder def _extruderOffsets(self) -> Dict[int, List[float]]: + """For showing correct x, y offsets for each extruder""" + result = {} for extruder in ExtruderManager.getInstance().getActiveExtruderStacks(): result[int(extruder.getMetaData().get("position", "0"))] = [ diff --git a/plugins/GCodeReader/RepRapFlavorParser.py b/plugins/GCodeReader/RepRapFlavorParser.py index 2a24d16add..05f86beab0 100644 --- a/plugins/GCodeReader/RepRapFlavorParser.py +++ b/plugins/GCodeReader/RepRapFlavorParser.py @@ -3,8 +3,10 @@ from . import FlavorParser -## This parser is intended to interpret the RepRap Firmware g-code flavor. + class RepRapFlavorParser(FlavorParser.FlavorParser): + """This parser is intended to interpret the RepRap Firmware g-code flavor.""" + def __init__(self): super().__init__() @@ -17,16 +19,20 @@ class RepRapFlavorParser(FlavorParser.FlavorParser): # Set relative extrusion mode self._is_absolute_extrusion = False - ## Set the absolute positioning - # RepRapFlavor code G90 sets position of X, Y, Z to absolute - # For absolute E, M82 is used def _gCode90(self, position, params, path): + """Set the absolute positioning + + RepRapFlavor code G90 sets position of X, Y, Z to absolute + For absolute E, M82 is used + """ self._is_absolute_positioning = True return position - ## Set the relative positioning - # RepRapFlavor code G91 sets position of X, Y, Z to relative - # For relative E, M83 is used def _gCode91(self, position, params, path): + """Set the relative positioning + + RepRapFlavor code G91 sets position of X, Y, Z to relative + For relative E, M83 is used + """ self._is_absolute_positioning = False return position
\ No newline at end of file |