From f35da87075a56571589519cb695efd5f7394b875 Mon Sep 17 00:00:00 2001 From: Florian Foinant-Willig Date: Thu, 8 Jun 2023 10:39:45 +0200 Subject: [PATCH] PartDesign: Fix uptolast ends too soon --- src/Mod/PartDesign/App/FeatureExtrude.cpp | 26 ++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/Mod/PartDesign/App/FeatureExtrude.cpp b/src/Mod/PartDesign/App/FeatureExtrude.cpp index 65d80d3e91..1853e9ded1 100644 --- a/src/Mod/PartDesign/App/FeatureExtrude.cpp +++ b/src/Mod/PartDesign/App/FeatureExtrude.cpp @@ -23,6 +23,7 @@ #include "PreCompiled.h" #ifndef _PreComp_ +# include # include # include # include @@ -200,7 +201,7 @@ void FeatureExtrude::generatePrism(TopoDS_Shape& prism, PrismMode Mode, Standard_Boolean Modify) { - if (method == "UpToFirst" || method == "UpToFace" || method == "UpToLast") { + if (method == "UpToFirst" || method == "UpToFace") { BRepFeat_MakePrism PrismMaker; TopoDS_Shape base = baseshape; for (TopExp_Explorer xp(profileshape, TopAbs_FACE); xp.More(); xp.Next()) { @@ -216,6 +217,29 @@ void FeatureExtrude::generatePrism(TopoDS_Shape& prism, prism = base; } + else if (method == "UpToLast") { + BRepFeat_MakePrism PrismMaker; + prism = baseshape; + for (TopExp_Explorer xp(profileshape, TopAbs_FACE); xp.More(); xp.Next()) { + PrismMaker.Init(baseshape, xp.Current(), supportface, direction, PrismMode::None, Modify); + + //Each face needs 2 prisms because if uptoFace is intersected twice the first one ends too soon + for (int i=0; i<2; i++){ + if (i==0){ + PrismMaker.Perform(uptoface); + }else{ + PrismMaker.Perform(uptoface, uptoface); + } + + if (!PrismMaker.IsDone()) + throw Base::RuntimeError("ProfileBased: Up to face: Could not extrude the sketch!"); + auto onePrism = PrismMaker.Shape(); + + BRepAlgoAPI_Fuse fuse(prism, onePrism); + prism = fuse.Shape(); + } + } + } else { std::stringstream str; str << "ProfileBased: Internal error: Unknown method '"