Skip to content

Commit

Permalink
Part/PartDesign: fix TopoShape::makEPrism() with up to face
Browse files Browse the repository at this point in the history
  • Loading branch information
realthunder committed Dec 10, 2021
1 parent fc3356a commit 7edee4b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
13 changes: 12 additions & 1 deletion src/Mod/Part/App/TopoShapeEx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1829,7 +1829,7 @@ void GenericShapeMapper::init(const TopoShape &src, const TopoDS_Shape &dst)
TopoShape &TopoShape::makEPrism(const TopoShape &_base,
const TopoShape& sketchshape,
const TopoShape& supportface,
const TopoShape& _uptoface,
const TopoShape& __uptoface,
const gp_Dir& direction,
PrismMode _Mode,
Standard_Boolean checkLimits,
Expand All @@ -1840,6 +1840,17 @@ TopoShape &TopoShape::makEPrism(const TopoShape &_base,

BRepFeat_MakePrism PrismMaker;

TopoShape _uptoface(__uptoface);
if (_uptoface.shapeType(true) == TopAbs_FACE
&& !BRep_Tool::NaturalRestriction(TopoDS::Face(_uptoface.getShape()))) {
// When using the face with BRepFeat_MakePrism::Perform(const TopoDS_Shape& Until)
// then the algorithm expects that the 'NaturalRestriction' flag is set in order
// to work as expected.
BRep_Builder builder;
_uptoface = _uptoface.makECopy();
builder.NaturalRestriction(TopoDS::Face(_uptoface.getShape()), Standard_True);
}

TopoShape uptoface(_uptoface);
TopoShape base(_base);

Expand Down
6 changes: 0 additions & 6 deletions src/Mod/PartDesign/App/FeatureSketchBased.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -644,12 +644,6 @@ void ProfileBased::addOffsetToFace(TopoShape& upToFace, const gp_Dir& dir, doubl
mov.SetTranslation(offset * gp_Vec(dir));
TopLoc_Location loc(mov);
upToFace.move(loc);

// When using the face with BRepFeat_MakePrism::Perform(const TopoDS_Shape& Until)
// then the algorithm expects that the 'NaturalRestriction' flag is set in order
// to work as expected (see generatePrism())
BRep_Builder builder;
builder.NaturalRestriction(TopoDS::Face(upToFace.getShape()), Standard_True);
}
}

Expand Down

0 comments on commit 7edee4b

Please sign in to comment.