From 95428dfbe0f71bcf1654794240066d8f69f3bfb1 Mon Sep 17 00:00:00 2001 From: Roy-043 <70520633+Roy-043@users.noreply.github.com> Date: Wed, 23 Jun 2021 11:06:47 +0200 Subject: [PATCH 1/2] Draft: Fix Draft_PointArray and Draft_TwistedArray Count problems Draft_PointArray and Draft_TwistedArray have Count problems: 1. Draft_PointArray: Count is always zero. 2. Draft_PathTwistedArray: Number of items is Count+1. 3. Draft_PathTwistedLinkArray: Count is increased whenever object is recomputed. Also the first item in a twisted array should be unrotated. --- src/Mod/Draft/draftgeoutils/geo_arrays.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Mod/Draft/draftgeoutils/geo_arrays.py b/src/Mod/Draft/draftgeoutils/geo_arrays.py index 61d1e9647a..a798967888 100644 --- a/src/Mod/Draft/draftgeoutils/geo_arrays.py +++ b/src/Mod/Draft/draftgeoutils/geo_arrays.py @@ -64,8 +64,8 @@ def get_init_values(path, count=6): edge = path.Shape.Edges[0] edge_length = edge.Length - step = edge_length / count - inc = 360/count + step = edge_length / (count - 1) + inc = 360 / (count - 1) return norm, edge, step, inc @@ -91,16 +91,17 @@ def get_twisted_placements(path, count=15, rot_factor=0.25): places = [] params = [] - for number in range(count + 1): + for number in range(count): v0, tan, rot = get_n_params(edge, number, step, norm) - increment += inc angle = increment * rot_factor place = App.Placement(v0, tan, angle) place.Rotation = place.Rotation * rot places.append(place) params.append((v0, tan, angle, rot)) + + increment += inc return places, params From a9cb1973798c27e5b54a7314c826edd1cd1305df Mon Sep 17 00:00:00 2001 From: Roy-043 <70520633+Roy-043@users.noreply.github.com> Date: Wed, 23 Jun 2021 11:11:15 +0200 Subject: [PATCH 2/2] Draft: Fix Draft_PointArray and Draft_TwistedArray Count problems Draft_PointArray and Draft_TwistedArray have Count problems: 1. Draft_PointArray: Count is always zero. 2. Draft_PathTwistedArray: Number of items is Count+1. 3. Draft_PathTwistedLinkArray: Count is increased whenever object is recomputed. Also the first item in a twisted array should be unrotated. --- src/Mod/Draft/draftobjects/draftlink.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Mod/Draft/draftobjects/draftlink.py b/src/Mod/Draft/draftobjects/draftlink.py index dfaa0d4dc4..5437a67dbf 100644 --- a/src/Mod/Draft/draftobjects/draftlink.py +++ b/src/Mod/Draft/draftobjects/draftlink.py @@ -175,6 +175,8 @@ class DraftLink(DraftObject): obj.PlacementList = pls obj.setPropertyStatus('PlacementList', 'Immutable') obj.Count = len(pls) + elif hasattr(obj, 'Count') and obj.Count != len(pls): # required for regular pointarrays + obj.Count = len(pls) if obj.Base: shape = getattr(obj.Base, 'Shape', None)