From 81a5ec5e55ef3a77c6f40dbd36405c16c2816617 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Mon, 28 Dec 2020 18:24:50 +0100 Subject: [PATCH] LinearPattern: Support 1 occurrence When using linear pattern with expression, this can be usefull to have only one occurence (the original one), which can't be done with the following implemenation. This commit change this behaviour by allowing this value. --- src/Mod/PartDesign/App/FeatureLinearPattern.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/Mod/PartDesign/App/FeatureLinearPattern.cpp b/src/Mod/PartDesign/App/FeatureLinearPattern.cpp index adc2918ab3..463339fd2b 100644 --- a/src/Mod/PartDesign/App/FeatureLinearPattern.cpp +++ b/src/Mod/PartDesign/App/FeatureLinearPattern.cpp @@ -73,12 +73,10 @@ const std::list LinearPattern::getTransformations(const std::vector LinearPattern::getTransformations(const std::vector 1) { + double offset = distance / (occurrences - 1); + for (int i = 1; i < occurrences; i++) { + trans.SetTranslation(direction * i * offset); + transformations.push_back(trans); + } } return transformations;