Merge pull request #4885 from Roy-043/Draft_Fix_Array_Count_Issues

Draft: Fix Draft_PointArray and Draft_TwistedArray Count problems
This commit is contained in:
Yorik van Havre
2021-08-17 15:19:57 +02:00
committed by GitHub
2 changed files with 7 additions and 4 deletions

View File

@@ -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

View File

@@ -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)