Skip to content

Commit

Permalink
Fix file naming
Browse files Browse the repository at this point in the history
  • Loading branch information
PadLex committed Jul 6, 2022
1 parent 34cba42 commit b26ffdd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
1 change: 0 additions & 1 deletion laser/laser.inx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
<spacer/>
<param name="directory" type="path" gui-text="Output Directory" mode="folder">-- Choose Output Directory --</param>
<param name="filename" type="string" gui-text="Filename">output.gcode</param>
<param name="filename_dynamic" type="bool" gui-text="Reuse SVG filename for output">false</param>
<param name="filename_suffix" type="bool" gui-text="Add Numeric Suffix to Filename">true</param>
</page>
<page name="advanced_settings" gui-text="Advanced Settings">
Expand Down
15 changes: 6 additions & 9 deletions laser/laser.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,17 @@ def effect(self):
TOLERANCES["approximation"] = float(self.options.approximation_tolerance.replace(',', '.'))

# Construct output path
# Construct output path
if self.options.filename_dynamic and self.document_path():
if self.options.filename:
output_path = os.path.join(self.options.directory, self.options.filename)
if '.' not in output_path:
output_path += ".gcode"
else:
filename, extension = self.document_path().split('.')
filename = filename.split('/')[-1] + '.gcode'
output_path = os.path.join(self.options.directory, filename)
else:
output_path = os.path.join(self.options.directory, self.options.filename)

if self.options.filename_suffix:
try:
filename, extension = output_path.split('.')
except:
self.msg("Error in output directory!")
exit(1)
filename, extension = output_path.split('.')

n = 1
while os.path.isfile(output_path):
Expand Down

0 comments on commit b26ffdd

Please sign in to comment.