- starting to work on storing the solid_geometry for each tool in part in Excellon Object
This commit is contained in:
@@ -6012,9 +6012,14 @@ class App(QtCore.QObject):
|
|||||||
log.debug("Could not create geometry for Excellon object.")
|
log.debug("Could not create geometry for Excellon object.")
|
||||||
return "fail"
|
return "fail"
|
||||||
|
|
||||||
if excellon_obj.is_empty():
|
# if excellon_obj.is_empty():
|
||||||
app_obj.inform.emit("[ERROR_NOTCL] No geometry found in file: " + filename)
|
# app_obj.inform.emit("[ERROR_NOTCL] No geometry found in file: " + filename)
|
||||||
return "fail"
|
# return "fail"
|
||||||
|
for tool in excellon_obj.tools:
|
||||||
|
if excellon_obj.tools[tool]['solid_geometry']:
|
||||||
|
return
|
||||||
|
app_obj.inform.emit("[ERROR_NOTCL] No geometry found in file: " + filename)
|
||||||
|
return "fail"
|
||||||
|
|
||||||
with self.proc_container.new("Opening Excellon."):
|
with self.proc_container.new("Opening Excellon."):
|
||||||
|
|
||||||
|
|||||||
@@ -1882,27 +1882,45 @@ class FlatCAMExcellon(FlatCAMObj, Excellon):
|
|||||||
if not FlatCAMObj.plot(self):
|
if not FlatCAMObj.plot(self):
|
||||||
return
|
return
|
||||||
|
|
||||||
try:
|
|
||||||
_ = iter(self.solid_geometry)
|
|
||||||
except TypeError:
|
|
||||||
self.solid_geometry = [self.solid_geometry]
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Plot excellon (All polygons?)
|
# Plot excellon (All polygons?)
|
||||||
if self.options["solid"]:
|
if self.options["solid"]:
|
||||||
for geo in self.solid_geometry:
|
for tool in self.tools:
|
||||||
self.add_shape(shape=geo, color='#750000BF', face_color='#C40000BF', visible=self.options['plot'],
|
for geo in self.tools[tool]['solid_geometry']:
|
||||||
layer=2)
|
self.add_shape(shape=geo, color='#750000BF', face_color='#C40000BF', visible=self.options['plot'],
|
||||||
|
layer=2)
|
||||||
else:
|
else:
|
||||||
for geo in self.solid_geometry:
|
for tool in self.tools:
|
||||||
self.add_shape(shape=geo.exterior, color='red', visible=self.options['plot'])
|
for geo in self.tools[tool]['solid_geometry']:
|
||||||
for ints in geo.interiors:
|
self.add_shape(shape=geo.exterior, color='red', visible=self.options['plot'])
|
||||||
self.add_shape(shape=ints, color='green', visible=self.options['plot'])
|
for ints in geo.interiors:
|
||||||
|
self.add_shape(shape=ints, color='green', visible=self.options['plot'])
|
||||||
|
|
||||||
self.shapes.redraw()
|
self.shapes.redraw()
|
||||||
except (ObjectDeleted, AttributeError):
|
except (ObjectDeleted, AttributeError):
|
||||||
self.shapes.clear(update=True)
|
self.shapes.clear(update=True)
|
||||||
|
|
||||||
|
# try:
|
||||||
|
# _ = iter(self.solid_geometry)
|
||||||
|
# except TypeError:
|
||||||
|
# self.solid_geometry = [self.solid_geometry]
|
||||||
|
#
|
||||||
|
# try:
|
||||||
|
# # Plot excellon (All polygons?)
|
||||||
|
# if self.options["solid"]:
|
||||||
|
# for geo in self.solid_geometry:
|
||||||
|
# self.add_shape(shape=geo, color='#750000BF', face_color='#C40000BF', visible=self.options['plot'],
|
||||||
|
# layer=2)
|
||||||
|
# else:
|
||||||
|
# for geo in self.solid_geometry:
|
||||||
|
# self.add_shape(shape=geo.exterior, color='red', visible=self.options['plot'])
|
||||||
|
# for ints in geo.interiors:
|
||||||
|
# self.add_shape(shape=ints, color='green', visible=self.options['plot'])
|
||||||
|
#
|
||||||
|
# self.shapes.redraw()
|
||||||
|
# except (ObjectDeleted, AttributeError):
|
||||||
|
# self.shapes.clear(update=True)
|
||||||
|
|
||||||
# try:
|
# try:
|
||||||
# # Plot excellon (All polygons?)
|
# # Plot excellon (All polygons?)
|
||||||
# if self.options["solid"]:
|
# if self.options["solid"]:
|
||||||
@@ -4118,6 +4136,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
|
|||||||
self.ui.plot_cb.setChecked(True)
|
self.ui.plot_cb.setChecked(True)
|
||||||
self.ui_connect()
|
self.ui_connect()
|
||||||
|
|
||||||
|
|
||||||
class FlatCAMCNCjob(FlatCAMObj, CNCjob):
|
class FlatCAMCNCjob(FlatCAMObj, CNCjob):
|
||||||
"""
|
"""
|
||||||
Represents G-Code.
|
Represents G-Code.
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ CAD program, and create G-Code for Isolation routing.
|
|||||||
- added a new parameter named Offset in the Excellon tool table - work in progress
|
- added a new parameter named Offset in the Excellon tool table - work in progress
|
||||||
- finished work on Offset parameter in Excellon Object (Excellon Editor, camlib, FlatCAMObj updated to take this param in consideration)
|
- finished work on Offset parameter in Excellon Object (Excellon Editor, camlib, FlatCAMObj updated to take this param in consideration)
|
||||||
- fixed a bug where in Excellon editor when editing a file, a tool was automatically added. That is supposed to happen only for empty newly created Excellon Objects.
|
- fixed a bug where in Excellon editor when editing a file, a tool was automatically added. That is supposed to happen only for empty newly created Excellon Objects.
|
||||||
|
- starting to work on storing the solid_geometry for each tool in part in Excellon Object
|
||||||
|
|
||||||
10.02.2019
|
10.02.2019
|
||||||
|
|
||||||
|
|||||||
10
camlib.py
10
camlib.py
@@ -3510,6 +3510,7 @@ class Excellon(Geometry):
|
|||||||
spec = {"C": float(match.group(2))}
|
spec = {"C": float(match.group(2))}
|
||||||
self.tools[str(name_tool)] = spec
|
self.tools[str(name_tool)] = spec
|
||||||
log.debug(" Tool definition: %s %s" % (name_tool, spec))
|
log.debug(" Tool definition: %s %s" % (name_tool, spec))
|
||||||
|
spec['solid_geometry'] = []
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
log.warning("Line ignored, it's a comment: %s" % eline)
|
log.warning("Line ignored, it's a comment: %s" % eline)
|
||||||
@@ -3569,6 +3570,7 @@ class Excellon(Geometry):
|
|||||||
spec = {
|
spec = {
|
||||||
"C": float(match.group(2)),
|
"C": float(match.group(2)),
|
||||||
}
|
}
|
||||||
|
spec['solid_geometry'] = []
|
||||||
self.tools[name] = spec
|
self.tools[name] = spec
|
||||||
log.debug(" Tool definition out of header: %s %s" % (name, spec))
|
log.debug(" Tool definition out of header: %s %s" % (name, spec))
|
||||||
|
|
||||||
@@ -3914,6 +3916,7 @@ class Excellon(Geometry):
|
|||||||
# "H": float(match.group(6)),
|
# "H": float(match.group(6)),
|
||||||
# "Z": float(match.group(7))
|
# "Z": float(match.group(7))
|
||||||
}
|
}
|
||||||
|
spec['solid_geometry'] = []
|
||||||
self.tools[name] = spec
|
self.tools[name] = spec
|
||||||
log.debug(" Tool definition: %s %s" % (name, spec))
|
log.debug(" Tool definition: %s %s" % (name, spec))
|
||||||
continue
|
continue
|
||||||
@@ -4082,7 +4085,8 @@ class Excellon(Geometry):
|
|||||||
continue
|
continue
|
||||||
tooldia = self.tools[drill['tool']]['C']
|
tooldia = self.tools[drill['tool']]['C']
|
||||||
poly = drill['point'].buffer(tooldia / 2.0, int(int(self.geo_steps_per_circle) / 4))
|
poly = drill['point'].buffer(tooldia / 2.0, int(int(self.geo_steps_per_circle) / 4))
|
||||||
self.solid_geometry.append(poly)
|
# self.solid_geometry.append(poly)
|
||||||
|
self.tools[drill['tool']]['solid_geometry'].append(poly)
|
||||||
|
|
||||||
for slot in self.slots:
|
for slot in self.slots:
|
||||||
slot_tooldia = self.tools[slot['tool']]['C']
|
slot_tooldia = self.tools[slot['tool']]['C']
|
||||||
@@ -4091,7 +4095,9 @@ class Excellon(Geometry):
|
|||||||
|
|
||||||
lines_string = LineString([start, stop])
|
lines_string = LineString([start, stop])
|
||||||
poly = lines_string.buffer(slot_tooldia / 2.0, int(int(self.geo_steps_per_circle) / 4))
|
poly = lines_string.buffer(slot_tooldia / 2.0, int(int(self.geo_steps_per_circle) / 4))
|
||||||
self.solid_geometry.append(poly)
|
# self.solid_geometry.append(poly)
|
||||||
|
self.tools[drill['tool']]['solid_geometry'].append(poly)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.debug("Excellon geometry creation failed due of ERROR: %s" % str(e))
|
log.debug("Excellon geometry creation failed due of ERROR: %s" % str(e))
|
||||||
return "fail"
|
return "fail"
|
||||||
|
|||||||
Reference in New Issue
Block a user