- some changes in the app.on_togle_units() to make sure we don't try to convert empty parameters which may cause crashes on FlatCAM units change
- updated setup_ubuntu.sh file - made sure to import certain libraries in some of the FlatCAM files and not to rely on chained imports
This commit is contained in:
@@ -3679,12 +3679,14 @@ class App(QtCore.QObject):
|
|||||||
def scale_options(sfactor):
|
def scale_options(sfactor):
|
||||||
for dim in dimensions:
|
for dim in dimensions:
|
||||||
if dim == 'excellon_toolchangexy':
|
if dim == 'excellon_toolchangexy':
|
||||||
coords_xy = [float(eval(a)) for a in self.defaults["excellon_toolchangexy"].split(",")]
|
coordinates = self.defaults["excellon_toolchangexy"].split(",")
|
||||||
|
coords_xy = [float(eval(a)) for a in coordinates if a != '']
|
||||||
coords_xy[0] *= sfactor
|
coords_xy[0] *= sfactor
|
||||||
coords_xy[1] *= sfactor
|
coords_xy[1] *= sfactor
|
||||||
self.options['excellon_toolchangexy'] = "%f, %f" % (coords_xy[0], coords_xy[1])
|
self.options['excellon_toolchangexy'] = "%f, %f" % (coords_xy[0], coords_xy[1])
|
||||||
elif dim == 'geometry_toolchangexy':
|
elif dim == 'geometry_toolchangexy':
|
||||||
coords_xy = [float(eval(a)) for a in self.defaults["geometry_toolchangexy"].split(",")]
|
coordinates = self.defaults["geometry_toolchangexy"].split(",")
|
||||||
|
coords_xy = [float(eval(a)) for a in coordinates if a != '']
|
||||||
coords_xy[0] *= sfactor
|
coords_xy[0] *= sfactor
|
||||||
coords_xy[1] *= sfactor
|
coords_xy[1] *= sfactor
|
||||||
self.options['geometry_toolchangexy'] = "%f, %f" % (coords_xy[0], coords_xy[1])
|
self.options['geometry_toolchangexy'] = "%f, %f" % (coords_xy[0], coords_xy[1])
|
||||||
@@ -3725,38 +3727,48 @@ class App(QtCore.QObject):
|
|||||||
sptools[t] *= sfactor
|
sptools[t] *= sfactor
|
||||||
self.options['tools_solderpaste_tools'] += "%f," % sptools[t]
|
self.options['tools_solderpaste_tools'] += "%f," % sptools[t]
|
||||||
elif dim == 'tools_solderpaste_xy_toolchange':
|
elif dim == 'tools_solderpaste_xy_toolchange':
|
||||||
sp_coords = [float(eval(a)) for a in self.defaults["tools_solderpaste_xy_toolchange"].split(",")]
|
coordinates = self.defaults["tools_solderpaste_xy_toolchange"].split(",")
|
||||||
|
sp_coords = [float(eval(a)) for a in coordinates if a != '']
|
||||||
sp_coords[0] *= sfactor
|
sp_coords[0] *= sfactor
|
||||||
sp_coords[1] *= sfactor
|
sp_coords[1] *= sfactor
|
||||||
self.options['tools_solderpaste_xy_toolchange'] = "%f, %f" % (sp_coords[0], sp_coords[1])
|
self.options['tools_solderpaste_xy_toolchange'] = "%f, %f" % (sp_coords[0], sp_coords[1])
|
||||||
elif dim == 'global_gridx' or dim == 'global_gridy':
|
elif dim == 'global_gridx' or dim == 'global_gridy':
|
||||||
if new_units == 'IN':
|
if new_units == 'IN':
|
||||||
|
val = 0.1
|
||||||
try:
|
try:
|
||||||
val = float(self.defaults[dim]) * sfactor
|
val = float(self.defaults[dim]) * sfactor
|
||||||
self.options[dim] = float('%.6f' % val)
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.debug('App.on_toggle_units().scale_defaults() --> %s' % str(e))
|
log.debug('App.on_toggle_units().scale_defaults() --> %s' % str(e))
|
||||||
|
|
||||||
|
self.options[dim] = float('%.6f' % val)
|
||||||
else:
|
else:
|
||||||
|
val = 0.1
|
||||||
try:
|
try:
|
||||||
val = float(self.defaults[dim]) * sfactor
|
val = float(self.defaults[dim]) * sfactor
|
||||||
self.options[dim] = float('%.4f' % val)
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.debug('App.on_toggle_units().scale_defaults() --> %s' % str(e))
|
log.debug('App.on_toggle_units().scale_defaults() --> %s' % str(e))
|
||||||
|
|
||||||
|
self.options[dim] = float('%.4f' % val)
|
||||||
else:
|
else:
|
||||||
|
val = 0.1
|
||||||
try:
|
try:
|
||||||
self.options[dim] = float(self.options[dim]) * sfactor
|
val = float(self.options[dim]) * sfactor
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.debug('App.on_toggle_units().scale_options() --> %s' % str(e))
|
log.debug('App.on_toggle_units().scale_options() --> %s' % str(e))
|
||||||
|
|
||||||
|
self.options[dim] = val
|
||||||
|
|
||||||
def scale_defaults(sfactor):
|
def scale_defaults(sfactor):
|
||||||
for dim in dimensions:
|
for dim in dimensions:
|
||||||
if dim == 'excellon_toolchangexy':
|
if dim == 'excellon_toolchangexy':
|
||||||
coords_xy = [float(eval(a)) for a in self.defaults["excellon_toolchangexy"].split(",")]
|
coordinates = self.defaults["excellon_toolchangexy"].split(",")
|
||||||
|
coords_xy = [float(eval(a)) for a in coordinates if a != '']
|
||||||
coords_xy[0] *= sfactor
|
coords_xy[0] *= sfactor
|
||||||
coords_xy[1] *= sfactor
|
coords_xy[1] *= sfactor
|
||||||
self.defaults['excellon_toolchangexy'] = "%.4f, %.4f" % (coords_xy[0], coords_xy[1])
|
self.defaults['excellon_toolchangexy'] = "%.4f, %.4f" % (coords_xy[0], coords_xy[1])
|
||||||
elif dim == 'geometry_toolchangexy':
|
elif dim == 'geometry_toolchangexy':
|
||||||
coords_xy = [float(eval(a)) for a in self.defaults["geometry_toolchangexy"].split(",")]
|
coordinates = self.defaults["geometry_toolchangexy"].split(",")
|
||||||
|
coords_xy = [float(eval(a)) for a in coordinates if a != '']
|
||||||
coords_xy[0] *= sfactor
|
coords_xy[0] *= sfactor
|
||||||
coords_xy[1] *= sfactor
|
coords_xy[1] *= sfactor
|
||||||
self.defaults['geometry_toolchangexy'] = "%.4f, %.4f" % (coords_xy[0], coords_xy[1])
|
self.defaults['geometry_toolchangexy'] = "%.4f, %.4f" % (coords_xy[0], coords_xy[1])
|
||||||
@@ -3797,29 +3809,37 @@ class App(QtCore.QObject):
|
|||||||
sptools[t] *= sfactor
|
sptools[t] *= sfactor
|
||||||
self.defaults['tools_solderpaste_tools'] += "%.4f," % sptools[t]
|
self.defaults['tools_solderpaste_tools'] += "%.4f," % sptools[t]
|
||||||
elif dim == 'tools_solderpaste_xy_toolchange':
|
elif dim == 'tools_solderpaste_xy_toolchange':
|
||||||
sp_coords = [float(eval(a)) for a in self.defaults["tools_solderpaste_xy_toolchange"].split(",")]
|
coordinates = self.defaults["tools_solderpaste_xy_toolchange"].split(",")
|
||||||
|
sp_coords = [float(eval(a)) for a in coordinates if a != '']
|
||||||
sp_coords[0] *= sfactor
|
sp_coords[0] *= sfactor
|
||||||
sp_coords[1] *= sfactor
|
sp_coords[1] *= sfactor
|
||||||
self.defaults['tools_solderpaste_xy_toolchange'] = "%.4f, %.4f" % (sp_coords[0], sp_coords[1])
|
self.defaults['tools_solderpaste_xy_toolchange'] = "%.4f, %.4f" % (sp_coords[0], sp_coords[1])
|
||||||
elif dim == 'global_gridx' or dim == 'global_gridy':
|
elif dim == 'global_gridx' or dim == 'global_gridy':
|
||||||
if new_units == 'IN':
|
if new_units == 'IN':
|
||||||
|
val = 0.1
|
||||||
try:
|
try:
|
||||||
val = float(self.defaults[dim]) * sfactor
|
val = float(self.defaults[dim]) * sfactor
|
||||||
self.defaults[dim] = float('%.6f' % val)
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.debug('App.on_toggle_units().scale_defaults() --> %s' % str(e))
|
log.debug('App.on_toggle_units().scale_defaults() --> %s' % str(e))
|
||||||
|
|
||||||
|
self.defaults[dim] = float('%.6f' % val)
|
||||||
else:
|
else:
|
||||||
|
val = 0.1
|
||||||
try:
|
try:
|
||||||
val = float(self.defaults[dim]) * sfactor
|
val = float(self.defaults[dim]) * sfactor
|
||||||
self.defaults[dim] = float('%.4f' % val)
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.debug('App.on_toggle_units().scale_defaults() --> %s' % str(e))
|
log.debug('App.on_toggle_units().scale_defaults() --> %s' % str(e))
|
||||||
|
|
||||||
|
self.defaults[dim] = float('%.4f' % val)
|
||||||
else:
|
else:
|
||||||
|
val = 0.1
|
||||||
try:
|
try:
|
||||||
self.defaults[dim] = float(self.defaults[dim]) * sfactor
|
val = float(self.defaults[dim]) * sfactor
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.debug('App.on_toggle_units().scale_defaults() --> %s' % str(e))
|
log.debug('App.on_toggle_units().scale_defaults() --> %s' % str(e))
|
||||||
|
|
||||||
|
self.defaults[dim] = val
|
||||||
|
|
||||||
# The scaling factor depending on choice of units.
|
# The scaling factor depending on choice of units.
|
||||||
factor = 1/25.4
|
factor = 1/25.4
|
||||||
if new_units == 'MM':
|
if new_units == 'MM':
|
||||||
|
|||||||
@@ -9,6 +9,12 @@ CAD program, and create G-Code for Isolation routing.
|
|||||||
|
|
||||||
=================================================
|
=================================================
|
||||||
|
|
||||||
|
9.07.2019
|
||||||
|
|
||||||
|
- some changes in the app.on_togle_units() to make sure we don't try to convert empty parameters which may cause crashes on FlatCAM units change
|
||||||
|
- updated setup_ubuntu.sh file
|
||||||
|
- made sure to import certain libraries in some of the FlatCAM files and not to rely on chained imports
|
||||||
|
|
||||||
8.07.2019
|
8.07.2019
|
||||||
|
|
||||||
- fixed bug that allowed empty tool in the tools generated in Geometry object
|
- fixed bug that allowed empty tool in the tools generated in Geometry object
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ from FlatCAMTool import FlatCAMTool
|
|||||||
from ObjectCollection import *
|
from ObjectCollection import *
|
||||||
from FlatCAMApp import *
|
from FlatCAMApp import *
|
||||||
from shapely.geometry import box
|
from shapely.geometry import box
|
||||||
|
from shapely.ops import cascaded_union, unary_union
|
||||||
|
|
||||||
import gettext
|
import gettext
|
||||||
import FlatCAMTranslation as fcTranslate
|
import FlatCAMTranslation as fcTranslate
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ apt-get install python3-tk
|
|||||||
apt-get install libspatialindex-dev
|
apt-get install libspatialindex-dev
|
||||||
apt-get install python3-gdal
|
apt-get install python3-gdal
|
||||||
apt-get install python3-lxml
|
apt-get install python3-lxml
|
||||||
easy_install3 -U distribute
|
|
||||||
pip3 install --upgrade dill
|
pip3 install --upgrade dill
|
||||||
pip3 install --upgrade Shapely
|
pip3 install --upgrade Shapely
|
||||||
pip3 install --upgrade vispy
|
pip3 install --upgrade vispy
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
from ObjectCollection import *
|
from ObjectCollection import *
|
||||||
from tclCommands.TclCommand import TclCommand
|
from tclCommands.TclCommand import TclCommand
|
||||||
|
from shapely.ops import cascaded_union
|
||||||
|
from shapely.geometry import LineString
|
||||||
|
|
||||||
|
|
||||||
class TclCommandCutout(TclCommand):
|
class TclCommandCutout(TclCommand):
|
||||||
@@ -81,11 +83,12 @@ class TclCommandCutout(TclCommand):
|
|||||||
|
|
||||||
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:
|
||||||
|
log.debug("TclCommandCutout.execute() --> %s" % str(e))
|
||||||
return "Could not retrieve object: %s" % name
|
return "Could not retrieve object: %s" % name
|
||||||
|
|
||||||
def geo_init_me(geo_obj, app_obj):
|
def geo_init_me(geo_obj, app_obj):
|
||||||
margin = margin_par + dia_par / 2
|
margin = margin_par + dia_par / 2
|
||||||
gap_size = dia_par + gapsize_par
|
gap_size = dia_par + gapsize_par
|
||||||
|
|
||||||
minx, miny, maxx, maxy = obj.bounds()
|
minx, miny, maxx, maxy = obj.bounds()
|
||||||
|
|||||||
@@ -1,11 +1,15 @@
|
|||||||
from ObjectCollection import *
|
from ObjectCollection import *
|
||||||
from tclCommands.TclCommand import TclCommandSignaled
|
from tclCommands.TclCommand import TclCommandSignaled
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
|
from shapely.ops import cascaded_union
|
||||||
|
from shapely.geometry import Polygon, LineString, LinearRing
|
||||||
|
|
||||||
|
|
||||||
class TclCommandGeoCutout(TclCommandSignaled):
|
class TclCommandGeoCutout(TclCommandSignaled):
|
||||||
"""
|
"""
|
||||||
Tcl shell command to create a board cutout geometry. Allow cutout for any shape. Cuts holding gaps from geometry.
|
Tcl shell command to create a board cutout geometry.
|
||||||
|
Allow cutout for any shape.
|
||||||
|
Cuts holding gaps from geometry.
|
||||||
|
|
||||||
example:
|
example:
|
||||||
|
|
||||||
@@ -66,9 +70,9 @@ class TclCommandGeoCutout(TclCommandSignaled):
|
|||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def subtract_rectangle(obj_, x0, y0, x1, y1):
|
# def subtract_rectangle(obj_, x0, y0, x1, y1):
|
||||||
pts = [(x0, y0), (x1, y0), (x1, y1), (x0, y1)]
|
# pts = [(x0, y0), (x1, y0), (x1, y1), (x0, y1)]
|
||||||
obj_.subtract_polygon(pts)
|
# obj_.subtract_polygon(pts)
|
||||||
|
|
||||||
def substract_rectangle_geo(geo, x0, y0, x1, y1):
|
def substract_rectangle_geo(geo, x0, y0, x1, y1):
|
||||||
pts = [(x0, y0), (x1, y0), (x1, y1), (x0, y1)]
|
pts = [(x0, y0), (x1, y0), (x1, y1), (x0, y1)]
|
||||||
|
|||||||
Reference in New Issue
Block a user