Draft: fix division by zero and count is zero for path arrays

Fixes #16468.
This commit is contained in:
Roy-043
2024-09-12 11:27:55 +02:00
committed by Yorik van Havre
parent f5402a4687
commit 9ec88feabc
2 changed files with 14 additions and 5 deletions

View File

@@ -475,14 +475,19 @@ def placements_on_path(shapeRotation, pathwire, count, xlate, align,
end = endOffset
cdist = cdist - start - end
step = cdist / (count if (DraftGeomUtils.isReallyClosed(pathwire) and not (start or end)) else count - 1)
if count < 1:
count = 1
n = count if (DraftGeomUtils.isReallyClosed(pathwire) and not (start or end)) else count - 1
if n == 0:
n = 1
step = cdist / n
remains = 0
travel = start
placements = []
for i in range(0, count):
for i in range(count):
# which edge in path should contain this shape?
for j in range(0, len(ends)):
for j in range(len(ends)):
if travel <= ends[j]:
iend = j
remains = ends[iend] - travel