- fixed some possible issues due of changes in version 2.0 of Shapely

- removed the import * statement from most of the app
This commit is contained in:
Marius Stanciu
2023-03-06 16:40:49 +02:00
parent 33de5314b1
commit 3b3c87e953
230 changed files with 1253 additions and 15935 deletions

View File

@@ -5,15 +5,14 @@
# MIT Licence #
# ##########################################################
from shapely.geometry import LineString, Point
from shapely.affinity import rotate
# from ezdxf.math import Vector as ezdxf_vector
from ezdxf.math import Vec3 as ezdxf_vector
from appParsers.ParseFont import *
from appParsers.ParseDXF_Spline import spline2Polyline, normalize_2
from appParsers.ParseDXF_Spline import Vector as DxfVector
from shapely.geometry import LineString, Point, Polygon
from shapely.affinity import rotate, translate, scale
# from ezdxf.math import Vector as ezdxf_vector
from ezdxf.math import Vec3 as ezdxf_vector
import math
import logging

View File

@@ -419,10 +419,10 @@ class Excellon(Geometry):
self.app.log.debug("ALternative M71/M72 units found, after conversion: %s" % self.units)
if self.units == 'MM':
self.app.log.warning("Excellon format preset is: %s:%s" %
(str(self.excellon_format_upper_mm), str(self.excellon_format_lower_mm)))
(str(self.excellon_format_upper_mm), str(self.excellon_format_lower_mm)))
else:
self.app.log.warning("Excellon format preset is: %s:%s" %
(str(self.excellon_format_upper_in), str(self.excellon_format_lower_in)))
(str(self.excellon_format_upper_in), str(self.excellon_format_lower_in)))
continue
# ### Body ####

View File

@@ -22,6 +22,7 @@ import freetype as ft
from fontTools import ttLib
import logging
import gettext
import appTranslation as fcTranslate
import builtins

View File

@@ -1,6 +1,10 @@
from PyQt6 import QtWidgets
from camlib import Geometry, arc, arc_angle, ApertureMacro, grace, flatten_shapely_geometry
from appParsers.ParseDXF import getdxfgeo
from appParsers.ParseSVG import svgparselength, getsvggeo, svgparse_viewbox
import numpy as np
import traceback
from copy import deepcopy
@@ -8,13 +12,13 @@ from copy import deepcopy
from shapely.ops import unary_union, linemerge
import shapely.affinity as affinity
from shapely.geometry import box as shply_box
from shapely.geometry import LinearRing, MultiLineString
from shapely.geometry import LinearRing, MultiLineString, LineString, Polygon, MultiPolygon, Point
from lxml import etree as ET
import ezdxf
from appParsers.ParseDXF import *
from appParsers.ParseSVG import svgparselength, getsvggeo, svgparse_viewbox
import logging
import re
import sys
import gettext
import builtins
@@ -1422,7 +1426,8 @@ class Gerber(Geometry):
j = 0
if quadrant_mode is None:
self.app.log.error("Found arc without preceding quadrant specification G74 or G75. (%d)" % line_num)
self.app.log.error(
"Found arc without preceding quadrant specification G74 or G75. (%d)" % line_num)
self.app.log.error(gline)
continue
@@ -1959,7 +1964,7 @@ class Gerber(Geometry):
self.app.log.debug("appParsers.ParseGerber.Gerber.import_svg(). Finished parsing the SVG geometry.")
if flip:
geos = [translate(scale(g, 1.0, -1.0, origin=(0, 0)), yoff=h) for g in geos]
geos = [affinity.translate(affinity.scale(g, 1.0, -1.0, origin=(0, 0)), yoff=h) for g in geos]
self.app.log.debug("appParsers.ParseGerber.Gerber.import_svg(). SVG geometry was flipped.")
# Add to object
@@ -2529,7 +2534,7 @@ class Gerber(Geometry):
try:
if isinstance(self.solid_geometry, (MultiPolygon, MultiLineString)):
self.geo_len = len(self.solid_geometry.geoms)
else:
if isinstance(self.solid_geometry, list):
self.geo_len = len(self.solid_geometry)
except (TypeError, ValueError, RuntimeError):
self.geo_len = 1
@@ -2634,8 +2639,8 @@ class Gerber(Geometry):
geo_p = shply_box(minx, miny, maxx, maxy)
new_geo_el['solid'] = geo_p
else:
self.app.log.debug("appParsers.ParseGerber.Gerber.buffer() --> "
"ap type not supported")
self.app.log.debug(
"appParsers.ParseGerber.Gerber.buffer() --> ap type not supported")
else:
new_geo_el['solid'] = geo_el['follow'].buffer(
size/1.9999,

View File

@@ -18,7 +18,6 @@ import sys
from shapely.ops import unary_union
from shapely.geometry import LineString, Point
# import AppTranslation as fcTranslate
import gettext
import builtins