Toponaming/Part: unify revolution changes

This commit is contained in:
bgbsww
2024-05-02 14:32:03 -04:00
committed by Chris Hennes
parent 5607f5d52e
commit ad0cb61656
5 changed files with 435 additions and 85 deletions

View File

@@ -106,6 +106,7 @@
#include <App/ElementNamingUtils.h>
#include <ShapeAnalysis_FreeBoundsProperties.hxx>
#include <BRepBuilderAPI_MakeSolid.hxx>
#include <BRepFeat_MakeRevol.hxx>
FC_LOG_LEVEL_INIT("TopoShape", true, true) // NOLINT
@@ -4439,6 +4440,51 @@ TopoShape& TopoShape::makeElementRevolve(const TopoShape& _base,
return makeElementShape(mkRevol, base, op);
}
TopoShape& TopoShape::makeElementRevolution(const TopoShape& _base,
const gp_Ax1& axis,
double d,
const TopoDS_Face& supportface,
const TopoDS_Face& uptoface,
const char* face_maker,
RevolMode Mode,
Standard_Boolean Modify,
const char* op)
{
if (!op) {
op = Part::OpCodes::Revolve;
}
TopoShape base(_base);
if (base.isNull()) {
FC_THROWM(NullShapeException, "Null shape");
}
if (face_maker && !base.hasSubShape(TopAbs_FACE)) {
if (!base.hasSubShape(TopAbs_WIRE)) {
base = base.makeElementWires();
}
base = base.makeElementFace(nullptr, face_maker, nullptr);
}
BRepFeat_MakeRevol mkRevol;
for (TopExp_Explorer xp(base.getShape(), TopAbs_FACE); xp.More(); xp.Next()) {
mkRevol.Init(_base.getShape(),
xp.Current(),
supportface,
axis,
static_cast<int>(Mode),
Modify);
mkRevol.Perform(uptoface);
if (!mkRevol.IsDone()) {
throw Base::RuntimeError("Revolution: Up to face: Could not revolve the sketch!");
}
base = mkRevol.Shape();
if (Mode == RevolMode::None) {
Mode = RevolMode::FuseWithBase;
}
}
return makeElementShape(mkRevol, base, op);
}
TopoShape& TopoShape::makeElementDraft(const TopoShape& shape,
const std::vector<TopoShape>& _faces,
const gp_Dir& pullDirection,