- fixed imports in all TclCommands

This commit is contained in:
Marius Stanciu 2019-10-25 02:10:52 +03:00 committed by Marius
parent 7181d55368
commit d0e5b6c83a
57 changed files with 206 additions and 90 deletions

View File

@ -14,13 +14,14 @@ CAD program, and create G-Code for Isolation routing.
- QRCode Tool: added ability to add negative QRCodes (perhaps they can be isolated on copper?); added a clear area surrounding the QRCode in case it is dropped on a copper pour (region); fixed the Gerber export - QRCode Tool: added ability to add negative QRCodes (perhaps they can be isolated on copper?); added a clear area surrounding the QRCode in case it is dropped on a copper pour (region); fixed the Gerber export
- QRCode Tool: all parameters are hard-coded for now - QRCode Tool: all parameters are hard-coded for now
- small update - small update
- fixed imports in all TclCommands
24.10.2019 24.10.2019
- added some placeholder texts in the TextBoxes. - added some placeholder texts in the TextBoxes.
- working on QRCode Tool; added the utility geometry and intial functional layout - working on QRCode Tool; added the utility geometry and initial functional layout
- working on QRCode Tool; finished adding the QRCode geometry to the selected Gerber object and also finished adding the 'follow' geometry needed when exporting the Gerber object as a Gerber file in addition to the 'solid' geometry in the obj.apertures - working on QRCode Tool; finished adding the QRCode geometry to the selected Gerber object and also finished adding the 'follow' geometry needed when exporting the Gerber object as a Gerber file in addition to the 'solid' geometry in the obj.apertures
- working on QRCode Tool; finished offseting the geometry both in apertures and in solid_geometry; updated the source_file of the source object - working on QRCode Tool; finished offsetting the geometry both in apertures and in solid_geometry; updated the source_file of the source object
23.10.2019 23.10.2019

View File

@ -1,4 +1,4 @@
from ObjectCollection import * import collections
from tclCommands.TclCommand import TclCommand from tclCommands.TclCommand import TclCommand
@ -56,7 +56,7 @@ class TclCommandAddCircle(TclCommand):
try: try:
obj = self.app.collection.get_by_name(str(obj_name)) obj = self.app.collection.get_by_name(str(obj_name))
except: except Exception as e:
return "Could not retrieve object: %s" % obj_name return "Could not retrieve object: %s" % obj_name
if obj is None: if obj is None:
return "Object not found: %s" % obj_name return "Object not found: %s" % obj_name

View File

@ -1,4 +1,4 @@
from ObjectCollection import * from camlib import Geometry
from tclCommands.TclCommand import * from tclCommands.TclCommand import *

View File

@ -1,4 +1,5 @@
from ObjectCollection import * from camlib import Geometry
import collections
from tclCommands.TclCommand import TclCommandSignaled from tclCommands.TclCommand import TclCommandSignaled

View File

@ -1,4 +1,4 @@
from ObjectCollection import * import collections
from tclCommands.TclCommand import TclCommandSignaled from tclCommands.TclCommand import TclCommandSignaled
@ -58,7 +58,7 @@ class TclCommandAddRectangle(TclCommandSignaled):
try: try:
obj = self.app.collection.get_by_name(str(obj_name)) obj = self.app.collection.get_by_name(str(obj_name))
except: except Exception as e:
return "Could not retrieve object: %s" % obj_name return "Could not retrieve object: %s" % obj_name
if obj is None: if obj is None:
return "Object not found: %s" % obj_name return "Object not found: %s" % obj_name

View File

@ -1,5 +1,9 @@
from ObjectCollection import * import collections
from tclCommands.TclCommand import TclCommandSignaled from tclCommands.TclCommand import TclCommandSignaled
from FlatCAMObj import FlatCAMGeometry, FlatCAMGerber, FlatCAMExcellon
from shapely.geometry import Point
import shapely.affinity as affinity
class TclCommandAlignDrill(TclCommandSignaled): class TclCommandAlignDrill(TclCommandSignaled):

View File

@ -1,6 +1,7 @@
from ObjectCollection import * import collections
from tclCommands.TclCommand import TclCommandSignaled from tclCommands.TclCommand import TclCommandSignaled
from shapely.geometry import Point
class TclCommandAlignDrillGrid(TclCommandSignaled): class TclCommandAlignDrillGrid(TclCommandSignaled):
""" """

View File

@ -1,5 +1,9 @@
from ObjectCollection import * import collections
from tclCommands.TclCommand import TclCommand from tclCommands.TclCommand import TclCommand
from FlatCAMObj import FlatCAMGeometry, FlatCAMGerber
from shapely.ops import cascaded_union
import gettext import gettext
import FlatCAMTranslation as fcTranslate import FlatCAMTranslation as fcTranslate
import builtins import builtins

View File

@ -1,7 +1,6 @@
from tclCommands.TclCommand import TclCommand from tclCommands.TclCommand import TclCommand
from ObjectCollection import * import collections
import logging
from camlib import get_bounds
import gettext import gettext
import FlatCAMTranslation as fcTranslate import FlatCAMTranslation as fcTranslate
@ -11,6 +10,7 @@ fcTranslate.apply_language('strings')
if '_' not in builtins.__dict__: if '_' not in builtins.__dict__:
_ = gettext.gettext _ = gettext.gettext
log = logging.getLogger('base')
class TclCommandBounds(TclCommand): class TclCommandBounds(TclCommand):
""" """

View File

@ -6,7 +6,7 @@
# ########################################################## # ##########################################################
from tclCommands.TclCommand import TclCommand from tclCommands.TclCommand import TclCommand
from ObjectCollection import * import collections
class TclCommandClearShell(TclCommand): class TclCommandClearShell(TclCommand):

View File

@ -1,5 +1,8 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled from tclCommands.TclCommand import TclCommandSignaled
from FlatCAMObj import FlatCAMGeometry
import collections
from copy import deepcopy
class TclCommandCncjob(TclCommandSignaled): class TclCommandCncjob(TclCommandSignaled):

View File

@ -1,6 +1,8 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommand from tclCommands.TclCommand import TclCommand
import collections
import logging
import gettext import gettext
import FlatCAMTranslation as fcTranslate import FlatCAMTranslation as fcTranslate
import builtins import builtins
@ -9,6 +11,8 @@ fcTranslate.apply_language('strings')
if '_' not in builtins.__dict__: if '_' not in builtins.__dict__:
_ = gettext.gettext _ = gettext.gettext
log = logging.getLogger('base')
class TclCommandCopperClear(TclCommand): class TclCommandCopperClear(TclCommand):
""" """

View File

@ -1,8 +1,13 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommand from tclCommands.TclCommand import TclCommand
import collections
import logging
from shapely.ops import cascaded_union from shapely.ops import cascaded_union
from shapely.geometry import LineString from shapely.geometry import LineString
log = logging.getLogger('base')
class TclCommandCutout(TclCommand): class TclCommandCutout(TclCommand):
""" """

View File

@ -1,6 +1,7 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommand from tclCommands.TclCommand import TclCommand
import collections
class TclCommandDelete(TclCommand): class TclCommandDelete(TclCommand):
""" """

View File

@ -1,5 +1,8 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled from tclCommands.TclCommand import TclCommandSignaled
from FlatCAMObj import FlatCAMExcellon
import collections
import math
class TclCommandDrillcncjob(TclCommandSignaled): class TclCommandDrillcncjob(TclCommandSignaled):

View File

@ -1,5 +1,7 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled from tclCommands.TclCommand import TclCommandSignaled
from camlib import CNCjob
import collections
class TclCommandExportGcode(TclCommandSignaled): class TclCommandExportGcode(TclCommandSignaled):

View File

@ -1,6 +1,7 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommand from tclCommands.TclCommand import TclCommand
import collections
class TclCommandExportSVG(TclCommand): class TclCommandExportSVG(TclCommand):
""" """
@ -47,6 +48,4 @@ class TclCommandExportSVG(TclCommand):
:return: :return:
""" """
name = args['name']
self.app.export_svg(**args) self.app.export_svg(**args)

View File

@ -1,5 +1,7 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled from tclCommands.TclCommand import TclCommandSignaled
from camlib import Geometry
import collections
class TclCommandExteriors(TclCommandSignaled): class TclCommandExteriors(TclCommandSignaled):

View File

@ -1,5 +1,7 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled from tclCommands.TclCommand import TclCommandSignaled
from FlatCAMObj import FlatCAMGerber
import collections
class TclCommandFollow(TclCommandSignaled): class TclCommandFollow(TclCommandSignaled):

View File

@ -1,9 +1,14 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled from tclCommands.TclCommand import TclCommandSignaled
from FlatCAMObj import FlatCAMGerber, FlatCAMGeometry
import logging
import collections
from copy import deepcopy from copy import deepcopy
from shapely.ops import cascaded_union from shapely.ops import cascaded_union
from shapely.geometry import Polygon, LineString, LinearRing from shapely.geometry import Polygon, LineString, LinearRing
log = logging.getLogger('base')
class TclCommandGeoCutout(TclCommandSignaled): class TclCommandGeoCutout(TclCommandSignaled):
""" """

View File

@ -1,6 +1,7 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommand from tclCommands.TclCommand import TclCommand
import collections
class TclCommandGeoUnion(TclCommand): class TclCommandGeoUnion(TclCommand):
""" """
@ -50,7 +51,7 @@ class TclCommandGeoUnion(TclCommand):
obj_name = args['name'] obj_name = args['name']
try: try:
obj = self.collection.get_by_name(str(obj_name)) obj = self.app.collection.get_by_name(str(obj_name))
except: except:
return "Could not retrieve object: %s" % obj_name return "Could not retrieve object: %s" % obj_name
if obj is None: if obj is None:

View File

@ -1,6 +1,7 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommand from tclCommands.TclCommand import TclCommand
import collections
class TclCommandGetNames(TclCommand): class TclCommandGetNames(TclCommand):
""" """

View File

@ -5,9 +5,10 @@
# MIT Licence # # MIT Licence #
# ########################################################## # ##########################################################
from ObjectCollection import *
from tclCommands.TclCommand import TclCommand from tclCommands.TclCommand import TclCommand
import collections
class TclCommandGetSys(TclCommand): class TclCommandGetSys(TclCommand):
""" """
@ -54,4 +55,3 @@ class TclCommandGetSys(TclCommand):
if name in self.app.defaults: if name in self.app.defaults:
return self.app.defaults[name] return self.app.defaults[name]

View File

@ -1,6 +1,8 @@
from camlib import *
from tclCommands.TclCommand import TclCommandSignaled from tclCommands.TclCommand import TclCommandSignaled
import collections
from camlib import Geometry
class TclCommandImportSvg(TclCommandSignaled): class TclCommandImportSvg(TclCommandSignaled):
""" """
@ -78,4 +80,3 @@ class TclCommandImportSvg(TclCommandSignaled):
# GUI feedback # GUI feedback
self.app.inform.emit("Opened: " + filename) self.app.inform.emit("Opened: " + filename)

View File

@ -1,5 +1,7 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled from tclCommands.TclCommand import TclCommandSignaled
from camlib import Geometry
import collections
class TclCommandInteriors(TclCommandSignaled): class TclCommandInteriors(TclCommandSignaled):

View File

@ -1,6 +1,7 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled from tclCommands.TclCommand import TclCommandSignaled
from FlatCAMObj import FlatCAMGerber
import collections
class TclCommandIsolate(TclCommandSignaled): class TclCommandIsolate(TclCommandSignaled):
""" """
@ -69,10 +70,10 @@ class TclCommandIsolate(TclCommandSignaled):
if 'outname' not in args: if 'outname' not in args:
args['outname'] = name + "_iso" args['outname'] = name + "_iso"
if 'timeout' in args: # if 'timeout' in args:
timeout = args['timeout'] # timeout = args['timeout']
else: # else:
timeout = 10000 # timeout = 10000
if 'follow' not in args: if 'follow' not in args:
args['follow'] = None args['follow'] = None

View File

@ -1,5 +1,7 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommand from tclCommands.TclCommand import TclCommand
from FlatCAMObj import FlatCAMExcellon
import collections
class TclCommandJoinExcellon(TclCommand): class TclCommandJoinExcellon(TclCommand):

View File

@ -1,5 +1,7 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommand from tclCommands.TclCommand import TclCommand
from FlatCAMObj import FlatCAMGeometry
import collections
class TclCommandJoinGeometry(TclCommand): class TclCommandJoinGeometry(TclCommand):

View File

@ -5,9 +5,11 @@
# MIT Licence # # MIT Licence #
# ########################################################## # ##########################################################
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled from tclCommands.TclCommand import TclCommandSignaled
from FlatCAMObj import FlatCAMExcellon
import math
import collections
class TclCommandMillDrills(TclCommandSignaled): class TclCommandMillDrills(TclCommandSignaled):
""" """
@ -72,7 +74,7 @@ class TclCommandMillDrills(TclCommandSignaled):
try: try:
obj = self.app.collection.get_by_name(str(name)) obj = self.app.collection.get_by_name(str(name))
except: except Exception as e:
obj = None obj = None
self.raise_tcl_error("Could not retrieve object: %s" % name) self.raise_tcl_error("Could not retrieve object: %s" % name)

View File

@ -5,8 +5,11 @@
# MIT Licence # # MIT Licence #
# ########################################################## # ##########################################################
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled from tclCommands.TclCommand import TclCommandSignaled
from FlatCAMObj import FlatCAMExcellon
import collections
import math
class TclCommandMillSlots(TclCommandSignaled): class TclCommandMillSlots(TclCommandSignaled):

View File

@ -1,5 +1,7 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled from tclCommands.TclCommand import TclCommandSignaled
from FlatCAMObj import FlatCAMExcellon, FlatCAMGeometry, FlatCAMGerber
import collections
class TclCommandMirror(TclCommandSignaled): class TclCommandMirror(TclCommandSignaled):
@ -55,7 +57,7 @@ class TclCommandMirror(TclCommandSignaled):
# Get source object. # Get source object.
try: try:
obj = self.app.collection.get_by_name(str(name)) obj = self.app.collection.get_by_name(str(name))
except: except Exception as e:
return "Could not retrieve object: %s" % name return "Could not retrieve object: %s" % name
if obj is None: if obj is None:
@ -76,7 +78,7 @@ class TclCommandMirror(TclCommandSignaled):
if 'box' in args: if 'box' in args:
try: try:
box = self.app.collection.get_by_name(args['box']) box = self.app.collection.get_by_name(args['box'])
except: except Exception as e:
return "Could not retrieve object box: %s" % args['box'] return "Could not retrieve object box: %s" % args['box']
if box is None: if box is None:

View File

@ -1,6 +1,7 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommand from tclCommands.TclCommand import TclCommand
import collections
class TclCommandNew(TclCommand): class TclCommandNew(TclCommand):
""" """

View File

@ -5,9 +5,10 @@
# MIT Licence # # MIT Licence #
# ########################################################## # ##########################################################
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled from tclCommands.TclCommand import TclCommandSignaled
import collections
class TclCommandNewExcellon(TclCommandSignaled): class TclCommandNewExcellon(TclCommandSignaled):
""" """

View File

@ -1,6 +1,7 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled from tclCommands.TclCommand import TclCommandSignaled
import collections
class TclCommandNewGeometry(TclCommandSignaled): class TclCommandNewGeometry(TclCommandSignaled):
""" """

View File

@ -5,9 +5,10 @@
# MIT Licence # # MIT Licence #
# ########################################################## # ##########################################################
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled from tclCommands.TclCommand import TclCommandSignaled
import collections
class TclCommandNewGerber(TclCommandSignaled): class TclCommandNewGerber(TclCommandSignaled):
""" """
@ -56,7 +57,7 @@ class TclCommandNewGerber(TclCommandSignaled):
else: else:
name = 'new_grb' name = 'new_grb'
def initialize(grb_obj, self): def initialize(grb_obj, app_obj):
grb_obj.multitool = False grb_obj.multitool = False
grb_obj.source_file = [] grb_obj.source_file = []
grb_obj.multigeo = False grb_obj.multigeo = False

View File

@ -1,5 +1,10 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommand from tclCommands.TclCommand import TclCommand
from FlatCAMObj import FlatCAMGeometry, FlatCAMGerber
from shapely.ops import cascaded_union
import collections
import gettext import gettext
import FlatCAMTranslation as fcTranslate import FlatCAMTranslation as fcTranslate
import builtins import builtins

View File

@ -1,6 +1,7 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommand from tclCommands.TclCommand import TclCommand
import collections
class TclCommandOffset(TclCommand): class TclCommandOffset(TclCommand):
""" """

View File

@ -1,6 +1,7 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled from tclCommands.TclCommand import TclCommandSignaled
import collections
class TclCommandOpenExcellon(TclCommandSignaled): class TclCommandOpenExcellon(TclCommandSignaled):
""" """

View File

@ -1,6 +1,7 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled from tclCommands.TclCommand import TclCommandSignaled
import collections
class TclCommandOpenGCode(TclCommandSignaled): class TclCommandOpenGCode(TclCommandSignaled):
""" """

View File

@ -1,5 +1,7 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled from tclCommands.TclCommand import TclCommandSignaled
from camlib import Geometry, ParseError
import collections
class TclCommandOpenGerber(TclCommandSignaled): class TclCommandOpenGerber(TclCommandSignaled):

View File

@ -1,6 +1,7 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled from tclCommands.TclCommand import TclCommandSignaled
import collections
class TclCommandOpenProject(TclCommandSignaled): class TclCommandOpenProject(TclCommandSignaled):
""" """

View File

@ -1,6 +1,7 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled from tclCommands.TclCommand import TclCommandSignaled
import collections
class TclCommandOptions(TclCommandSignaled): class TclCommandOptions(TclCommandSignaled):
""" """

View File

@ -1,6 +1,8 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommand from tclCommands.TclCommand import TclCommand
import collections
import logging
import gettext import gettext
import FlatCAMTranslation as fcTranslate import FlatCAMTranslation as fcTranslate
import builtins import builtins
@ -9,6 +11,8 @@ fcTranslate.apply_language('strings')
if '_' not in builtins.__dict__: if '_' not in builtins.__dict__:
_ = gettext.gettext _ = gettext.gettext
log = logging.getLogger('base')
class TclCommandPaint(TclCommand): class TclCommandPaint(TclCommand):
""" """

View File

@ -1,7 +1,13 @@
from ObjectCollection import *
from copy import copy,deepcopy
from tclCommands.TclCommand import TclCommand from tclCommands.TclCommand import TclCommand
from FlatCAMObj import FlatCAMGeometry, FlatCAMExcellon
import shapely.affinity as affinity
import logging
from copy import deepcopy
import collections
log = logging.getLogger('base')
class TclCommandPanelize(TclCommand): class TclCommandPanelize(TclCommand):
@ -64,7 +70,7 @@ class TclCommandPanelize(TclCommand):
# Get source object. # Get source object.
try: try:
obj = self.app.collection.get_by_name(str(name)) obj = self.app.collection.get_by_name(str(name))
except: except Exception as e:
return "Could not retrieve object: %s" % name return "Could not retrieve object: %s" % name
if obj is None: if obj is None:
@ -74,7 +80,7 @@ class TclCommandPanelize(TclCommand):
boxname = args['box'] boxname = args['box']
try: try:
box = self.app.collection.get_by_name(boxname) box = self.app.collection.get_by_name(boxname)
except: except Exception as e:
return "Could not retrieve object: %s" % name return "Could not retrieve object: %s" % name
else: else:
box = obj box = obj
@ -185,8 +191,9 @@ class TclCommandPanelize(TclCommand):
if option is not 'name': if option is not 'name':
try: try:
obj_fin.options[option] = obj.options[option] obj_fin.options[option] = obj.options[option]
except: except Exception as e:
log.warning("Failed to copy option.", option) log.warning("Failed to copy option: %s" % str(option))
log.debug("TclCommandPanelize.execute().panelize2() --> %s" % str(e))
for row in range(rows): for row in range(rows):
currentx = 0.0 currentx = 0.0
@ -277,9 +284,9 @@ class TclCommandPanelize(TclCommand):
try: try:
panelize_2() panelize_2()
self.app.inform.emit("[success] Panel created successfully.") self.app.inform.emit("[success] Panel created successfully.")
except Exception as e: except Exception as ee:
proc.done() proc.done()
log.debug(str(e)) log.debug(str(ee))
return return
proc.done() proc.done()

View File

@ -1,6 +1,7 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommand from tclCommands.TclCommand import TclCommand
import collections
class TclCommandPlotAll(TclCommand): class TclCommandPlotAll(TclCommand):
""" """

View File

@ -5,9 +5,10 @@
# MIT Licence # # MIT Licence #
# ########################################################## # ##########################################################
from ObjectCollection import *
from tclCommands.TclCommand import TclCommand from tclCommands.TclCommand import TclCommand
import collections
class TclCommandPlotObjects(TclCommand): class TclCommandPlotObjects(TclCommand):
""" """

View File

@ -5,9 +5,10 @@
# MIT Licence # # MIT Licence #
# ########################################################## # ##########################################################
from ObjectCollection import *
from tclCommands.TclCommand import TclCommand from tclCommands.TclCommand import TclCommand
import collections
class TclCommandQuit(TclCommand): class TclCommandQuit(TclCommand):
""" """
@ -51,4 +52,3 @@ class TclCommandQuit(TclCommand):
""" """
self.app.quit_application() self.app.quit_application()

View File

@ -1,6 +1,7 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled from tclCommands.TclCommand import TclCommandSignaled
import collections
class TclCommandSaveProject(TclCommandSignaled): class TclCommandSaveProject(TclCommandSignaled):
""" """

View File

@ -1,6 +1,18 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommand from tclCommands.TclCommand import TclCommand
import collections
import logging
import gettext
import FlatCAMTranslation as fcTranslate
import builtins
fcTranslate.apply_language('strings')
if '_' not in builtins.__dict__:
_ = gettext.gettext
log = logging.getLogger('base')
class TclCommandScale(TclCommand): class TclCommandScale(TclCommand):
""" """

View File

@ -1,6 +1,7 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommand from tclCommands.TclCommand import TclCommand
import collections
class TclCommandSetActive(TclCommand): class TclCommandSetActive(TclCommand):
""" """

View File

@ -6,10 +6,12 @@
# ########################################################## # ##########################################################
from tclCommands.TclCommand import TclCommand from tclCommands.TclCommand import TclCommand
from ObjectCollection import *
import collections
from camlib import get_bounds from camlib import get_bounds
import logging
import gettext import gettext
import FlatCAMTranslation as fcTranslate import FlatCAMTranslation as fcTranslate
import builtins import builtins
@ -18,6 +20,8 @@ fcTranslate.apply_language('strings')
if '_' not in builtins.__dict__: if '_' not in builtins.__dict__:
_ = gettext.gettext _ = gettext.gettext
log = logging.getLogger('base')
class TclCommandSetOrigin(TclCommand): class TclCommandSetOrigin(TclCommand):
""" """

View File

@ -1,6 +1,7 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommand from tclCommands.TclCommand import TclCommand
import collections
class TclCommandSetSys(TclCommand): class TclCommandSetSys(TclCommand):
""" """

View File

@ -1,6 +1,7 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommand from tclCommands.TclCommand import TclCommand
import collections
class TclCommandSkew(TclCommand): class TclCommandSkew(TclCommand):
""" """

View File

@ -1,6 +1,7 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled from tclCommands.TclCommand import TclCommandSignaled
import collections
class TclCommandSubtractPoly(TclCommandSignaled): class TclCommandSubtractPoly(TclCommandSignaled):
""" """
@ -50,11 +51,13 @@ class TclCommandSubtractPoly(TclCommandSignaled):
if len(unnamed_args) % 2 != 0: if len(unnamed_args) % 2 != 0:
return "Incomplete coordinate." return "Incomplete coordinate."
points = [[float(unnamed_args[2 * i]), float(unnamed_args[2 * i + 1])] for i in range(len(unnamed_args) / 2)] points = [
[float(unnamed_args[2 * i]), float(unnamed_args[2 * i + 1])] for i in range(int(len(unnamed_args) / 2))
]
try: try:
obj = self.app.collection.get_by_name(str(obj_name)) obj = self.app.collection.get_by_name(str(obj_name))
except: except Exception as e:
return "Could not retrieve object: %s" % obj_name return "Could not retrieve object: %s" % obj_name
if obj is None: if obj is None:
return "Object not found: %s" % obj_name return "Object not found: %s" % obj_name

View File

@ -1,6 +1,15 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled from tclCommands.TclCommand import TclCommandSignaled
import collections
import gettext
import FlatCAMTranslation as fcTranslate
import builtins
fcTranslate.apply_language('strings')
if '_' not in builtins.__dict__:
_ = gettext.gettext
class TclCommandSubtractRectangle(TclCommandSignaled): class TclCommandSubtractRectangle(TclCommandSignaled):
""" """
@ -61,7 +70,7 @@ class TclCommandSubtractRectangle(TclCommandSignaled):
try: try:
obj = self.app.collection.get_by_name(str(obj_name)) obj = self.app.collection.get_by_name(str(obj_name))
except: except Exception as e:
return "Could not retrieve object: %s" % obj_name return "Could not retrieve object: %s" % obj_name
if obj is None: if obj is None:
return "Object not found: %s" % obj_name return "Object not found: %s" % obj_name

View File

@ -1,6 +1,7 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommand from tclCommands.TclCommand import TclCommand
import collections
class TclCommandVersion(TclCommand): class TclCommandVersion(TclCommand):
""" """
@ -44,4 +45,3 @@ class TclCommandVersion(TclCommand):
""" """
self.app.version_check() self.app.version_check()

View File

@ -1,6 +1,7 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled from tclCommands.TclCommand import TclCommandSignaled
import collections
class TclCommandWriteGCode(TclCommandSignaled): class TclCommandWriteGCode(TclCommandSignaled):
""" """
@ -89,7 +90,7 @@ class TclCommandWriteGCode(TclCommandSignaled):
try: try:
obj = self.app.collection.get_by_name(str(obj_name)) obj = self.app.collection.get_by_name(str(obj_name))
except: except Exception as e:
if muted == 0: if muted == 0:
return "Could not retrieve object: %s" % obj_name return "Could not retrieve object: %s" % obj_name
else: else: