- added a Laser preprocessor named 'Z_laser' which will change the Z to the Travel Z on each ToolChange event allowing therefore control of the dot size
- by default now a new blank Geometry object created by FlatCAM is of type multigeo - made sure that optimizations of lines when importing SVG or DXF as lines will not encounter polygons but only LinesStrings or LinearRings, otherwise having crashes - fixed the import SVG and import DXF, when importing as Geometry to be imported as multigeo tool - fixed the import SVG and import DXF, the source files will be saved as loaded into the source_file attribute of the resulting object (be it Geometry or Gerber)
This commit is contained in:
26
camlib.py
26
camlib.py
@@ -1058,6 +1058,7 @@ class Geometry(object):
|
||||
geos = [translate(scale(g, 1.0, -1.0, origin=(0, 0)), yoff=h) for g in geos]
|
||||
|
||||
# trying to optimize the resulting geometry by merging contiguous lines
|
||||
geos = self.flatten(geos, reset=True, pathonly=True)
|
||||
geos = linemerge(geos)
|
||||
|
||||
# Add to object
|
||||
@@ -1081,12 +1082,31 @@ class Geometry(object):
|
||||
if flip:
|
||||
# Change origin to bottom left
|
||||
for i in geos_text:
|
||||
_, minimy, _, maximy = i.bounds
|
||||
__, minimy, __, maximy = i.bounds
|
||||
h2 = (maximy - minimy) * 0.5
|
||||
geos_text_f.append(translate(scale(i, 1.0, -1.0, origin=(0, 0)), yoff=(h + h2)))
|
||||
if geos_text_f:
|
||||
self.solid_geometry = self.solid_geometry + geos_text_f
|
||||
|
||||
tooldia = float(self.app.defaults["geometry_cnctooldia"])
|
||||
tooldia = float('%.*f' % (self.decimals, tooldia))
|
||||
|
||||
new_data = {k: v for k, v in self.options.items()}
|
||||
|
||||
self.tools.update({
|
||||
1: {
|
||||
'tooldia': tooldia,
|
||||
'offset': 'Path',
|
||||
'offset_value': 0.0,
|
||||
'type': _('Rough'),
|
||||
'tool_type': 'C1',
|
||||
'data': deepcopy(new_data),
|
||||
'solid_geometry': self.solid_geometry
|
||||
}
|
||||
})
|
||||
|
||||
self.tools[1]['data']['name'] = self.options['name']
|
||||
|
||||
def import_dxf_as_geo(self, filename, units='MM'):
|
||||
"""
|
||||
Imports shapes from an DXF file into the object's geometry.
|
||||
@@ -1103,6 +1123,7 @@ class Geometry(object):
|
||||
geos = getdxfgeo(dxf)
|
||||
|
||||
# trying to optimize the resulting geometry by merging contiguous lines
|
||||
geos = self.flatten(geos, reset=True, pathonly=True)
|
||||
geos = linemerge(geos)
|
||||
|
||||
# Add to object
|
||||
@@ -5176,7 +5197,8 @@ class CNCjob(Geometry):
|
||||
|
||||
geo_storage = {}
|
||||
for geo in temp_solid_geometry:
|
||||
geo_storage[geo.coords[0]] = geo
|
||||
if not geo is None:
|
||||
geo_storage[geo.coords[0]] = geo
|
||||
locations = list(geo_storage.keys())
|
||||
|
||||
if opt_type == 'M':
|
||||
|
||||
Reference in New Issue
Block a user