PD: [skip ci] code refactoring
Move adding offset to face from getUpToFace() to addOffsetToFace()
This commit is contained in:
@@ -194,7 +194,8 @@ App::DocumentObjectExecReturn *Pad::execute(void)
|
||||
getUpToFaceFromLinkSub(upToFace, UpToFace);
|
||||
upToFace.Move(invObjLoc);
|
||||
}
|
||||
getUpToFace(upToFace, base, supportface, sketchshape, method, dir, Offset.getValue());
|
||||
getUpToFace(upToFace, base, supportface, sketchshape, method, dir);
|
||||
addOffsetToFace(upToFace, dir, Offset.getValue());
|
||||
|
||||
// TODO: Write our own PrismMaker which does not depend on a solid base shape
|
||||
if (base.IsNull()) {
|
||||
|
||||
@@ -166,7 +166,8 @@ App::DocumentObjectExecReturn *Pocket::execute(void)
|
||||
getUpToFaceFromLinkSub(upToFace, UpToFace);
|
||||
upToFace.Move(invObjLoc);
|
||||
}
|
||||
getUpToFace(upToFace, base, supportface, profileshape, method, dir, Offset.getValue());
|
||||
getUpToFace(upToFace, base, supportface, profileshape, method, dir);
|
||||
addOffsetToFace(upToFace, dir, Offset.getValue());
|
||||
|
||||
// BRepFeat_MakePrism(..., 2, 1) in combination with PerForm(upToFace) is buggy when the
|
||||
// prism that is being created is contained completely inside the base solid
|
||||
|
||||
@@ -440,8 +440,7 @@ void ProfileBased::getUpToFace(TopoDS_Face& upToFace,
|
||||
const TopoDS_Face& supportface,
|
||||
const TopoDS_Shape& sketchshape,
|
||||
const std::string& method,
|
||||
const gp_Dir& dir,
|
||||
const double offset)
|
||||
const gp_Dir& dir)
|
||||
{
|
||||
if ((method == "UpToLast") || (method == "UpToFirst")) {
|
||||
// Check for valid support object
|
||||
@@ -528,10 +527,14 @@ void ProfileBased::getUpToFace(TopoDS_Face& upToFace,
|
||||
BRepExtrema_DistShapeShape distSS(sketchshape, upToFace);
|
||||
if (distSS.Value() < Precision::Confusion())
|
||||
throw Base::ValueError("SketchBased: Up to face: Must not intersect sketch!");
|
||||
}
|
||||
|
||||
void ProfileBased::addOffsetToFace(TopoDS_Face& upToFace, const gp_Dir& dir, double offset)
|
||||
{
|
||||
// Move the face in the extrusion direction
|
||||
// TODO: For non-planar faces, we could consider offsetting the surface
|
||||
if (fabs(offset) > Precision::Confusion()) {
|
||||
BRepAdaptor_Surface adapt2(TopoDS::Face(upToFace));
|
||||
if (adapt2.GetType() == GeomAbs_Plane) {
|
||||
gp_Trsf mov;
|
||||
mov.SetTranslation(offset * gp_Vec(dir));
|
||||
|
||||
@@ -129,8 +129,13 @@ protected:
|
||||
const TopoDS_Face& supportface,
|
||||
const TopoDS_Shape& sketchshape,
|
||||
const std::string& method,
|
||||
const gp_Dir& dir,
|
||||
const double offset);
|
||||
const gp_Dir& dir);
|
||||
|
||||
/// Add an offset to the face
|
||||
static void addOffsetToFace(TopoDS_Face& upToFace,
|
||||
const gp_Dir& dir,
|
||||
double offset);
|
||||
|
||||
/**
|
||||
* Generate a linear prism
|
||||
* It will be a stand-alone solid created with BRepPrimAPI_MakePrism
|
||||
|
||||
Reference in New Issue
Block a user