From ee35270166e7529037af5b9b141e475dbec48378 Mon Sep 17 00:00:00 2001 From: palain Date: Tue, 3 Jan 2023 14:30:55 -0400 Subject: [PATCH] fixed shapely 2.0 - added remove doubles to overcuts, overcuts-b and silhouette offset --- scripts/addons/cam/curvecamtools.py | 5 ++++- scripts/addons/cam/polygon_utils_cam.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/addons/cam/curvecamtools.py b/scripts/addons/cam/curvecamtools.py index 49615e81..c890f5f9 100644 --- a/scripts/addons/cam/curvecamtools.py +++ b/scripts/addons/cam/curvecamtools.py @@ -170,6 +170,7 @@ class CamCurveOvercuts(bpy.types.Operator): return context.active_object is not None and (context.active_object.type in ['CURVE', 'FONT']) def execute(self, context): + bpy.ops.object.curve_remove_doubles() o1 = bpy.context.active_object shapes = utils.curveToShapely(o1) negative_overcuts = [] @@ -177,7 +178,7 @@ class CamCurveOvercuts(bpy.types.Operator): diameter = self.diameter * 1.001 for s in shapes.geoms: s = shapely.geometry.polygon.orient(s, 1) - if s.boundary.type == 'LineString': + if s.boundary.geom_type == 'LineString': loops = [s.boundary] else: loops = s.boundary @@ -266,6 +267,7 @@ class CamCurveOvercutsB(bpy.types.Operator): return context.active_object is not None and context.active_object.type == 'CURVE' def execute(self, context): + bpy.ops.object.curve_remove_doubles() o1 = bpy.context.active_object shapes = utils.curveToShapely(o1) negative_overcuts = [] @@ -609,6 +611,7 @@ class CamOffsetSilhouete(bpy.types.Operator): context.active_object.type == 'MESH') def execute(self, context): # this is almost same as getobjectoutline, just without the need of operation data + bpy.ops.object.curve_remove_doubles() ob = context.active_object if self.opencurve and ob.type == 'CURVE': bpy.ops.object.duplicate() diff --git a/scripts/addons/cam/polygon_utils_cam.py b/scripts/addons/cam/polygon_utils_cam.py index 934179e6..2c790f50 100644 --- a/scripts/addons/cam/polygon_utils_cam.py +++ b/scripts/addons/cam/polygon_utils_cam.py @@ -83,7 +83,7 @@ def shapelyToCoords(anydata): # print(p.geom_type) if p.is_empty: return seq - elif p.type == 'Polygon': + elif p.geom_type == 'Polygon': # print('polygon') clen = len(p.exterior.coords)