fix readme and type hints
This commit is contained in:
@@ -42,11 +42,11 @@ class GcodeFileAnalyzer:
|
||||
f.write('\n'.join(lines))
|
||||
|
||||
def __init__(self, lines):
|
||||
self.curaVersion: tuple(int) = None
|
||||
self.lines: list(str) = lines
|
||||
self.header: list(str) = []
|
||||
self.footer: list(str) = []
|
||||
self.layers: list('Layer') = []
|
||||
self.curaVersion: tuple[int] = None
|
||||
self.lines: list[str] = lines
|
||||
self.header: list[str] = []
|
||||
self.footer: list[str] = []
|
||||
self.layers: list['Layer'] = []
|
||||
self.layerCount: int = 0
|
||||
self.fanSpeedCode: str = ''
|
||||
self.__AnalyzeGcode()
|
||||
@@ -58,7 +58,7 @@ class GcodeFileAnalyzer:
|
||||
versionMatch = RE_ENGINE_VERSION.search(fullCode)
|
||||
if versionMatch:
|
||||
self.curaVersion = tuple(int(v) for v in versionMatch.group(1).split('.'))
|
||||
logging.info('Cura version {self.curaVersion}')
|
||||
logging.info(f'Cura version {self.curaVersion}')
|
||||
else:
|
||||
v5engineMatch = RE_ENGINE_V5.search(fullCode)
|
||||
if v5engineMatch:
|
||||
@@ -148,7 +148,7 @@ class GcodeFileAnalyzer:
|
||||
# Add default header
|
||||
lines = list(self.header)
|
||||
logging.info('Exporting Layers {} ({} mm) ... {} ({} mm)'
|
||||
.format(startLayer.number + 1, startLayer.zHeight,
|
||||
.format(startLayer.number + 1, startLayer.zHeight,
|
||||
endLayer.number + 1, endLayer.zHeight))
|
||||
|
||||
if startLayer.number != 0:
|
||||
@@ -242,18 +242,4 @@ class Layer:
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
# GcodeFileAnalyzer.SplitFileAtLayers('test/BigL.gcode', ['2.8001mm', 300])
|
||||
# GcodeFileAnalyzer.SplitFileAtLayers(r"Q:\DIY\3Dprint\Models\Thingiverse\Murmelbahnen\The_Cyclone_triple_lift_triple_track_marble_machine\files\gcode\Marble_machine.gcode",
|
||||
# ['97.3mm', 405, 480])
|
||||
# GcodeFileAnalyzer.SplitFileAtLayers(r"Q:\DIY\3Dprint\Models\Thingiverse\Shuttle\Shuttle100.gcode",
|
||||
# ['87.60mm'])
|
||||
# GcodeFileAnalyzer.SplitFileAtLayers(r"Q:\DIY\3Dprint\Models\Geschenke\Nudossi\NudossiDeckel_Yakup.gcode",
|
||||
# [124])
|
||||
# GcodeFileAnalyzer.SplitFileAtLayers(r"Q:\DIY\3Dprint\Models\Geschenke\Nudossi\NudossiDeckel_Harun.gcode",
|
||||
# [124])
|
||||
# GcodeFileAnalyzer.SplitFileAtLayers(r"Q:\DIY\3Dprint\Models\Thingiverse\MoonLamp\gcode\moon5inches.gcode",
|
||||
# [100, 200, 400, 600, 700])
|
||||
# GcodeFileAnalyzer.SplitFileAtLayers(r"Q:\DIY\3Dprint\Models\Benjamin\Vier_Cura5.1.1.gcode",
|
||||
# [42])
|
||||
GcodeFileAnalyzer.SplitFileAtLayers(r"Q:\DIY\3Dprint\Models\Geschenke\Mama\Herz\MarkusTinaHerz.gcode",
|
||||
[31])
|
||||
GcodeFileAnalyzer.SplitFileAtLayers('test/BigL.gcode', ['2.8mm', 300])
|
||||
@@ -13,7 +13,7 @@ Tested with GCode files from
|
||||
|
||||
## Requirements
|
||||
|
||||
* Python 3.7
|
||||
* Python >=3.9
|
||||
|
||||
## Usage
|
||||
|
||||
@@ -25,6 +25,6 @@ GcodeFileAnalyzer.SplitFileAtLayers(
|
||||
)
|
||||
```
|
||||
|
||||
* The Z position where to split the file can be given in layer number (starting with 0) or in millimeters (value must match an actual layer z position in the gcode file)
|
||||
* The Z position where to split the file can be given in layer number (starting with 1) or in millimeters (value must match an actual layer z position in the gcode file)
|
||||
* Execute `GcodeFileSplitter.py`
|
||||
* E.g.: `python GcodeFileSplitter.py`
|
||||
|
||||
Reference in New Issue
Block a user