diff --git a/CHANGELOG.md b/CHANGELOG.md index 7050396f..d2823691 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,11 @@ CHANGELOG for FlatCAM Evo beta ================================================= +13.03.2023 + +- in Tcl Commands: export_dxf and export_gerber, fixed a mistake in declaring a wrong name of a required option +- in Tcl Command set_path added an optional parameter which allows to create a directory where path is to be set, if the directory does not exist + 6.03.2023 - fixed some possible issues due of changes in version 2.0 of Shapely diff --git a/tclCommands/TclCommand.py b/tclCommands/TclCommand.py index e016d783..84424f37 100644 --- a/tclCommands/TclCommand.py +++ b/tclCommands/TclCommand.py @@ -1,6 +1,6 @@ import sys import re -import appMain + import abc import collections from PyQt6 import QtCore diff --git a/tclCommands/TclCommandExportDXF.py b/tclCommands/TclCommandExportDXF.py index 4e20a7d7..0282bc9a 100644 --- a/tclCommands/TclCommandExportDXF.py +++ b/tclCommands/TclCommandExportDXF.py @@ -19,7 +19,7 @@ class TclCommandExportDXF(TclCommand): export_dxf path/my_geometry filename """ - # List of all command aliases, to be able use old names for backward compatibility (add_poly, add_polygon) + # List of all command aliases, to be able to use old names for backward compatibility (add_poly, add_polygon) aliases = ['export_dxf', 'edxf'] description = '%s %s' % ("--", "Export a Geometry object as a DXF File.") @@ -35,7 +35,7 @@ class TclCommandExportDXF(TclCommand): ]) # array of mandatory options for current Tcl command: required = ['name','outname'] - required = ['obj_name'] + required = ['name'] # structured help for current command, args needs to be ordered help = { diff --git a/tclCommands/TclCommandExportGerber.py b/tclCommands/TclCommandExportGerber.py index de219ebe..b2e04d24 100644 --- a/tclCommands/TclCommandExportGerber.py +++ b/tclCommands/TclCommandExportGerber.py @@ -27,7 +27,7 @@ class TclCommandExportGerber(TclCommand): ]) # array of mandatory options for current Tcl command: required = ['name','outname'] - required = ['obj_name'] + required = ['name'] # structured help for current command, args needs to be ordered help = { diff --git a/tclCommands/TclCommandExportSVG.py b/tclCommands/TclCommandExportSVG.py index 3c2d9ef4..c6f30d96 100644 --- a/tclCommands/TclCommandExportSVG.py +++ b/tclCommands/TclCommandExportSVG.py @@ -11,7 +11,7 @@ class TclCommandExportSVG(TclCommand): export_svg my_geometry filename """ - # List of all command aliases, to be able use old names for backward compatibility (add_poly, add_polygon) + # List of all command aliases, to be able to use old names for backward compatibility (add_poly, add_polygon) aliases = ['export_svg'] description = '%s %s' % ("--", "Export a Geometry object as a SVG File.") diff --git a/tclCommands/TclCommandSetPath.py b/tclCommands/TclCommandSetPath.py index c30f2d84..ca124d7b 100644 --- a/tclCommands/TclCommandSetPath.py +++ b/tclCommands/TclCommandSetPath.py @@ -29,7 +29,7 @@ class TclCommandSetPath(TclCommand): """ - # List of all command aliases, to be able use old names for backward compatibility (add_poly, add_polygon) + # List of all command aliases, to be able to use old names for backward compatibility (add_poly, add_polygon) aliases = ['set_path'] description = '%s %s' % ("--", "Set the folder path to the specified path.") @@ -41,6 +41,7 @@ class TclCommandSetPath(TclCommand): # Dictionary of types from Tcl command, needs to be ordered , this is for options like -optionname value option_types = collections.OrderedDict([ + ('create', str), ]) # array of mandatory options for current Tcl command: required = {'name','outname'} @@ -53,6 +54,7 @@ class TclCommandSetPath(TclCommand): 'args': collections.OrderedDict([ ('path', 'A folder path to where the user is supposed to have the file that he will work with.\n' 'WARNING: No spaces allowed. Use quotes around the path if it contains spaces.'), + ('create', 'If set to True, if the folder does not exist it will create it.'), ]), 'examples': ['set_path D:\\Project_storage_path'] } @@ -81,6 +83,20 @@ class TclCommandSetPath(TclCommand): "is a path to file and not a directory as expected.") self.app.inform_shell.emit(msg) return "Failed. The Tcl command set_path was used but it was not a directory." + + if 'create' in args: + option = args['create'].capitalize() + try: + eval_option = eval(option) + except NameError: + eval_option = False + + if eval_option: + self.app.inform_shell.emit("Path not found, let's create it.") + os.mkdir(path) + else: + return "Failed. The Tcl command set_path has options but could not be recognized: -create %s." % \ + str(args['create']) else: msg = '[ERROR] %s: %s, %s' % ( "The provided path", str(path), "do not exist. Check for typos.")