PartDesign: Fix uptolast ends too soon

This commit is contained in:
Florian Foinant-Willig
2023-06-08 10:39:45 +02:00
committed by Chris Hennes
parent b04f278a41
commit f35da87075

View File

@@ -23,6 +23,7 @@
#include "PreCompiled.h"
#ifndef _PreComp_
# include <BRepAlgoAPI_Fuse.hxx>
# include <BRep_Builder.hxx>
# include <BRepFeat_MakePrism.hxx>
# include <BRepPrimAPI_MakePrism.hxx>
@@ -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 '"