From f1c216478c67f6262fc6336ce98dc946d9572996 Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Wed, 6 Jan 2021 21:57:17 +0200 Subject: [PATCH] - fixed the export_dxf and export_svg Tcl commands --- CHANGELOG.md | 1 + tclCommands/TclCommandExportDXF.py | 12 ++++++++++-- tclCommands/TclCommandExportSVG.py | 17 +++++++++++++++-- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 286dbc29..50daad06 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ CHANGELOG for FlatCAM beta - in NCC Tool fixed issue #486 where creating Area Selection shapes of type Square with Grid snap OFF will not use the first click position - fixed a bug in Paint Tool when doing Painting Area Selection and nothing is no polygon is in the selections to be painted - fixed Isolation, Paint and NCC Tools to use the Tool Type parameter from Preferences on adding new tools and also setting the 'type' key in tools dict correctly +- fixed the export_dxf and export_svg Tcl commands 5.01.2021 diff --git a/tclCommands/TclCommandExportDXF.py b/tclCommands/TclCommandExportDXF.py index 2a21f836..9b255473 100644 --- a/tclCommands/TclCommandExportDXF.py +++ b/tclCommands/TclCommandExportDXF.py @@ -55,6 +55,14 @@ class TclCommandExportDXF(TclCommand): :param unnamed_args: :return: """ + if 'name' not in args: + return "Failed. The Geometry object name to be exported was not provided." + + source_obj_name = args['name'] + if 'filename' not in args: - args['filename'] = self.app.defaults["global_last_save_folder"] + '/' + args['name'] - self.app.f_handlers.export_dxf(use_thread=False, local_use=None, **args) + filename = self.app.defaults["global_last_save_folder"] + '/' + args['name'] + else: + filename = args['filename'] + + self.app.f_handlers.export_dxf(obj_name=source_obj_name, filename=filename, local_use=None, use_thread=False) diff --git a/tclCommands/TclCommandExportSVG.py b/tclCommands/TclCommandExportSVG.py index e231472e..7e310c89 100644 --- a/tclCommands/TclCommandExportSVG.py +++ b/tclCommands/TclCommandExportSVG.py @@ -20,7 +20,6 @@ class TclCommandExportSVG(TclCommand): arg_names = collections.OrderedDict([ ('name', str), ('filename', str), - ('scale_stroke_factor', float) ]) # Dictionary of types from Tcl command, needs to be ordered , this is for options like -optionname value @@ -51,4 +50,18 @@ class TclCommandExportSVG(TclCommand): :return: """ - self.app.f_handlers.export_svg(**args) + if 'name' not in args: + return "Failed. The Geometry object name to be exported was not provided." + + source_obj_name = args['name'] + + if 'filename' not in args: + filename = self.app.defaults["global_last_save_folder"] + '/' + args['name'] + else: + filename = args['filename'] + + if 'scale_stroke_factor' in args and args['scale_stroke_factor'] != 0.0: + str_factor = args['scale_stroke_factor'] + else: + str_factor = 0.0 + self.app.f_handlers.export_svg(obj_name=source_obj_name, filename=filename, scale_stroke_factor=str_factor)