fixes #0003979: Pocket with mode 'up to face' doesn't work correctly
This commit is contained in:
@@ -218,6 +218,8 @@ App::DocumentObjectExecReturn *Pad::execute(void)
|
||||
TopExp_Explorer Ex(supportface,TopAbs_WIRE);
|
||||
if (!Ex.More())
|
||||
supportface = TopoDS_Face();
|
||||
|
||||
#if 0
|
||||
BRepFeat_MakePrism PrismMaker;
|
||||
PrismMaker.Init(base, sketchshape, supportface, dir, 2, 1);
|
||||
PrismMaker.Perform(upToFace);
|
||||
@@ -225,6 +227,9 @@ App::DocumentObjectExecReturn *Pad::execute(void)
|
||||
if (!PrismMaker.IsDone())
|
||||
return new App::DocumentObjectExecReturn("Pad: Up to face: Could not extrude the sketch!");
|
||||
prism = PrismMaker.Shape();
|
||||
#else
|
||||
generatePrism(prism, method, base, sketchshape, supportface, upToFace, dir, 2, 1);
|
||||
#endif
|
||||
base.Nullify();
|
||||
} else {
|
||||
// A support object is always required and we need to use BRepFeat_MakePrism
|
||||
@@ -239,6 +244,7 @@ App::DocumentObjectExecReturn *Pad::execute(void)
|
||||
TopExp_Explorer Ex(supportface,TopAbs_WIRE);
|
||||
if (!Ex.More())
|
||||
supportface = TopoDS_Face();
|
||||
#if 0
|
||||
BRepFeat_MakePrism PrismMaker;
|
||||
PrismMaker.Init(base, sketchshape, supportface, dir, 2, 1);
|
||||
PrismMaker.Perform(upToFace);
|
||||
@@ -246,6 +252,9 @@ App::DocumentObjectExecReturn *Pad::execute(void)
|
||||
if (!PrismMaker.IsDone())
|
||||
return new App::DocumentObjectExecReturn("Pad: Up to face: Could not extrude the sketch!");
|
||||
prism = PrismMaker.Shape();
|
||||
#else
|
||||
generatePrism(prism, method, base, sketchshape, supportface, upToFace, dir, 2, 1);
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
generatePrism(prism, sketchshape, method, dir, L, L2,
|
||||
|
||||
@@ -174,6 +174,7 @@ App::DocumentObjectExecReturn *Pocket::execute(void)
|
||||
TopExp_Explorer Ex(supportface,TopAbs_WIRE);
|
||||
if (!Ex.More())
|
||||
supportface = TopoDS_Face();
|
||||
#if 0
|
||||
BRepFeat_MakePrism PrismMaker;
|
||||
PrismMaker.Init(base, profileshape, supportface, dir, 0, 1);
|
||||
PrismMaker.Perform(upToFace);
|
||||
@@ -181,6 +182,10 @@ App::DocumentObjectExecReturn *Pocket::execute(void)
|
||||
if (!PrismMaker.IsDone())
|
||||
return new App::DocumentObjectExecReturn("Pocket: Up to face: Could not extrude the sketch!");
|
||||
TopoDS_Shape prism = PrismMaker.Shape();
|
||||
#else
|
||||
TopoDS_Shape prism;
|
||||
generatePrism(prism, method, base, profileshape, supportface, upToFace, dir, 0, 1);
|
||||
#endif
|
||||
|
||||
// And the really expensive way to get the SubShape...
|
||||
BRepAlgoAPI_Cut mkCut(base, prism);
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
# include <BRep_Tool.hxx>
|
||||
# include <BRepExtrema_DistShapeShape.hxx>
|
||||
# include <BRepPrimAPI_MakePrism.hxx>
|
||||
# include <BRepFeat_MakePrism.hxx>
|
||||
# include <BRepProj_Projection.hxx>
|
||||
# include <Geom_Plane.hxx>
|
||||
# include <TopoDS.hxx>
|
||||
@@ -544,6 +545,35 @@ void ProfileBased::generatePrism(TopoDS_Shape& prism,
|
||||
|
||||
}
|
||||
|
||||
void ProfileBased::generatePrism(TopoDS_Shape& prism,
|
||||
const std::string& method,
|
||||
const TopoDS_Shape& baseshape,
|
||||
const TopoDS_Shape& profileshape,
|
||||
const TopoDS_Face& sketchface,
|
||||
const TopoDS_Face& uptoface,
|
||||
const gp_Dir& direction,
|
||||
Standard_Integer Mode,
|
||||
Standard_Boolean Modify)
|
||||
{
|
||||
if (method == "UpToFirst" || method == "UpToFace") {
|
||||
BRepFeat_MakePrism PrismMaker;
|
||||
TopoDS_Shape base = baseshape;
|
||||
TopoDS_Face supportface = sketchface;
|
||||
for (TopExp_Explorer xp(profileshape, TopAbs_FACE); xp.More(); xp.Next()) {
|
||||
PrismMaker.Init(base, xp.Current(), supportface, direction, Mode, Modify);
|
||||
PrismMaker.Perform(uptoface);
|
||||
if (!PrismMaker.IsDone())
|
||||
throw Base::RuntimeError("ProfileBased: Up to face: Could not extrude the sketch!");
|
||||
|
||||
base = PrismMaker.Shape();
|
||||
if (Mode == 2)
|
||||
Mode = 1;
|
||||
}
|
||||
|
||||
prism = base;
|
||||
}
|
||||
}
|
||||
|
||||
bool ProfileBased::checkWireInsideFace(const TopoDS_Wire& wire, const TopoDS_Face& face,
|
||||
const gp_Dir& dir) {
|
||||
// Project wire onto the face (face, not surface! So limits of face apply)
|
||||
|
||||
@@ -134,6 +134,19 @@ protected:
|
||||
const double L2,
|
||||
const bool midplane,
|
||||
const bool reversed);
|
||||
/**
|
||||
* Generate a linear prism
|
||||
* It will be a stand-alone solid created with BRepFeat_MakePrism
|
||||
*/
|
||||
static void generatePrism(TopoDS_Shape& prism,
|
||||
const std::string& method,
|
||||
const TopoDS_Shape& baseshape,
|
||||
const TopoDS_Shape& profileshape,
|
||||
const TopoDS_Face& sketchface,
|
||||
const TopoDS_Face& uptoface,
|
||||
const gp_Dir& direction,
|
||||
Standard_Integer Mode,
|
||||
Standard_Boolean Modify);
|
||||
|
||||
/// Check whether the wire after projection on the face is inside the face
|
||||
static bool checkWireInsideFace(const TopoDS_Wire& wire,
|
||||
|
||||
Reference in New Issue
Block a user