- fixed the merge methods for all FlatCAM objects

This commit is contained in:
Marius Stanciu
2020-04-29 11:10:43 +03:00
committed by Marius
parent 2ca6e2e3f1
commit b8d85d2be2
7 changed files with 25 additions and 49 deletions

View File

@@ -130,7 +130,8 @@ class ExcellonObject(FlatCAMObj, Excellon):
# from predecessors.
self.ser_attrs += ['options', 'kind']
def merge(self, exc_list, exc_final):
@staticmethod
def merge(exc_list, exc_final, decimals=None):
"""
Merge Excellon objects found in exc_list parameter into exc_final object.
Options are always copied from source .
@@ -146,10 +147,9 @@ class ExcellonObject(FlatCAMObj, Excellon):
:return: None
"""
try:
decimals_exc = self.decimals
except AttributeError:
decimals_exc = 4
if decimals is None:
decimals = 4
decimals_exc = decimals
# flag to signal that we need to reorder the tools dictionary and drills and slots lists
flag_order = False

View File

@@ -2519,10 +2519,10 @@ class GeometryObject(FlatCAMObj, Geometry):
self.ui.plot_cb.setChecked(True)
self.ui_connect()
def merge(self, geo_list, geo_final, multigeo=None):
@staticmethod
def merge(geo_list, geo_final, multigeo=None):
"""
Merges the geometry of objects in grb_list into
the geometry of geo_final.
Merges the geometry of objects in grb_list into the geometry of geo_final.
:param geo_list: List of GerberObject Objects to join.
:param geo_final: Destination GerberObject object.
@@ -2552,7 +2552,7 @@ class GeometryObject(FlatCAMObj, Geometry):
# Expand lists
if type(geo_obj) is list:
GeometryObject.merge(self, geo_list=geo_obj, geo_final=geo_final)
GeometryObject.merge(geo_list=geo_obj, geo_final=geo_final)
# If not list, just append
else:
if multigeo is None or multigeo is False:

View File

@@ -39,7 +39,8 @@ class GerberObject(FlatCAMObj, Gerber):
ui_type = GerberObjectUI
def merge(self, grb_list, grb_final):
@staticmethod
def merge(grb_list, grb_final):
"""
Merges the geometry of objects in geo_list into
the geometry of geo_final.
@@ -64,7 +65,7 @@ class GerberObject(FlatCAMObj, Gerber):
# Expand lists
if type(grb) is list:
GerberObject.merge(grb, grb_final)
GerberObject.merge(grb_list=grb, grb_final=grb_final)
else: # If not list, just append
for option in grb.options:
if option != 'name':