- 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
This commit is contained in:
@@ -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
|
6.03.2023
|
||||||
|
|
||||||
- fixed some possible issues due of changes in version 2.0 of Shapely
|
- fixed some possible issues due of changes in version 2.0 of Shapely
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import sys
|
import sys
|
||||||
import re
|
import re
|
||||||
import appMain
|
|
||||||
import abc
|
import abc
|
||||||
import collections
|
import collections
|
||||||
from PyQt6 import QtCore
|
from PyQt6 import QtCore
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ class TclCommandExportDXF(TclCommand):
|
|||||||
export_dxf path/my_geometry filename
|
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']
|
aliases = ['export_dxf', 'edxf']
|
||||||
|
|
||||||
description = '%s %s' % ("--", "Export a Geometry object as a DXF File.")
|
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']
|
# 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
|
# structured help for current command, args needs to be ordered
|
||||||
help = {
|
help = {
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ class TclCommandExportGerber(TclCommand):
|
|||||||
])
|
])
|
||||||
|
|
||||||
# array of mandatory options for current Tcl command: required = ['name','outname']
|
# 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
|
# structured help for current command, args needs to be ordered
|
||||||
help = {
|
help = {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class TclCommandExportSVG(TclCommand):
|
|||||||
export_svg my_geometry filename
|
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']
|
aliases = ['export_svg']
|
||||||
|
|
||||||
description = '%s %s' % ("--", "Export a Geometry object as a SVG File.")
|
description = '%s %s' % ("--", "Export a Geometry object as a SVG File.")
|
||||||
|
|||||||
@@ -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']
|
aliases = ['set_path']
|
||||||
|
|
||||||
description = '%s %s' % ("--", "Set the folder path to the specified 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
|
# Dictionary of types from Tcl command, needs to be ordered , this is for options like -optionname value
|
||||||
option_types = collections.OrderedDict([
|
option_types = collections.OrderedDict([
|
||||||
|
('create', str),
|
||||||
])
|
])
|
||||||
|
|
||||||
# array of mandatory options for current Tcl command: required = {'name','outname'}
|
# array of mandatory options for current Tcl command: required = {'name','outname'}
|
||||||
@@ -53,6 +54,7 @@ class TclCommandSetPath(TclCommand):
|
|||||||
'args': collections.OrderedDict([
|
'args': collections.OrderedDict([
|
||||||
('path', 'A folder path to where the user is supposed to have the file that he will work with.\n'
|
('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.'),
|
'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']
|
'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.")
|
"is a path to file and not a directory as expected.")
|
||||||
self.app.inform_shell.emit(msg)
|
self.app.inform_shell.emit(msg)
|
||||||
return "Failed. The Tcl command set_path was used but it was not a directory."
|
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:
|
else:
|
||||||
msg = '[ERROR] %s: %s, %s' % (
|
msg = '[ERROR] %s: %s, %s' % (
|
||||||
"The provided path", str(path), "do not exist. Check for typos.")
|
"The provided path", str(path), "do not exist. Check for typos.")
|
||||||
|
|||||||
Reference in New Issue
Block a user