Allow extruding from a datum plane to another face or plane, optionally with an offset

This commit is contained in:
jrheinlaender
2013-07-10 10:15:50 +02:00
committed by Stefan Tröger
parent 0c16cb4cee
commit 12bf1d58f6
16 changed files with 230 additions and 42 deletions

View File

@@ -494,7 +494,8 @@ void SketchBased::getUpToFace(TopoDS_Face& upToFace,
const TopoDS_Face& supportface,
const TopoDS_Shape& sketchshape,
const std::string& method,
const gp_Dir& dir)
const gp_Dir& dir,
const double offset)
{
if ((method == "UpToLast") || (method == "UpToFirst")) {
// Check for valid support object
@@ -564,6 +565,18 @@ void SketchBased::getUpToFace(TopoDS_Face& upToFace,
if (distSS.Value() < Precision::Confusion())
throw Base::Exception("SketchBased: Up to face: Must not intersect sketch!");
// Move the face in the extrusion direction
// TODO: For non-planar faces, we could consider offsetting the surface
if (fabs(offset) > Precision::Confusion()) {
if (adapt2.GetType() == GeomAbs_Plane) {
gp_Trsf mov;
mov.SetTranslation(offset * gp_Vec(dir));
TopLoc_Location loc(mov);
upToFace.Move(loc);
} else {
throw Base::Exception("SketchBased: Up to Face: Offset not supported yet for non-planar faces");
}
}
}
void SketchBased::generatePrism(TopoDS_Shape& prism,