- in Tool Transform added a new feature named 'Buffer'. For Geometry and Gerber objects will create (and replace) a geometry at a distance from the original geometry and for Excellon will adjust the Tool diameters

This commit is contained in:
Marius Stanciu
2019-12-23 22:59:01 +02:00
committed by Marius
parent fe5c2c7836
commit b1b140634b
9 changed files with 359 additions and 33 deletions

View File

@@ -1457,4 +1457,35 @@ class Excellon(Geometry):
slot['start'] = affinity.rotate(slot['start'], angle, origin=(px, py))
self.create_geometry()
self.app.proc_container.new_text = ''
self.app.proc_container.new_text = ''
def buffer(self, distance, join):
"""
:param distance:
:param join:
:return:
"""
log.debug("flatcamParsers.ParseExcellon.Excellon.buffer()")
if distance == 0:
return
def buffer_geom(obj):
if type(obj) is list:
new_obj = []
for g in obj:
new_obj.append(buffer_geom(g))
return new_obj
else:
try:
return obj.buffer(distance, resolution=self.geo_steps_per_circle)
except AttributeError:
return obj
# buffer solid_geometry
for tool, tool_dict in list(self.tools.items()):
self.tools[tool]['solid_geometry'] = buffer_geom(tool_dict['solid_geometry'])
self.tools[tool]['C'] += distance
self.create_geometry()