PD: restore old method name and fix doxygen documentation

This commit is contained in:
wmayer
2022-02-13 22:30:17 +01:00
parent 0095f97299
commit 32ae033b43
4 changed files with 67 additions and 65 deletions

View File

@@ -126,16 +126,16 @@ Base::Vector3d FeatureExtrude::computeDirection(const Base::Vector3d& sketchVect
return extrudeDirection;
}
void FeatureExtrude::Extrude(TopoDS_Shape& prism,
const TopoDS_Shape& sketchshape,
const std::string& method,
const gp_Dir& direction,
const double L,
const double L2,
const double angle,
const double angle2,
const bool midplane,
const bool reversed)
void FeatureExtrude::generatePrism(TopoDS_Shape& prism,
const TopoDS_Shape& sketchshape,
const std::string& method,
const gp_Dir& direction,
const double L,
const double L2,
const double angle,
const double angle2,
const bool midplane,
const bool reversed)
{
if (method == "Length" || method == "TwoLengths" || method == "ThroughAll") {
double Ltotal = L;
@@ -205,15 +205,15 @@ void FeatureExtrude::Extrude(TopoDS_Shape& prism,
}
}
void FeatureExtrude::Extrude(TopoDS_Shape& prism,
const std::string& method,
const TopoDS_Shape& baseshape,
const TopoDS_Shape& profileshape,
const TopoDS_Face& supportface,
const TopoDS_Face& uptoface,
const gp_Dir& direction,
PrismMode Mode,
Standard_Boolean Modify)
void FeatureExtrude::generatePrism(TopoDS_Shape& prism,
const std::string& method,
const TopoDS_Shape& baseshape,
const TopoDS_Shape& profileshape,
const TopoDS_Face& supportface,
const TopoDS_Face& uptoface,
const gp_Dir& direction,
PrismMode Mode,
Standard_Boolean Modify)
{
if (method == "UpToFirst" || method == "UpToFace" || method == "UpToLast") {
BRepFeat_MakePrism PrismMaker;
@@ -240,24 +240,26 @@ void FeatureExtrude::Extrude(TopoDS_Shape& prism,
}
void FeatureExtrude::generateTaperedPrism(TopoDS_Shape& prism,
const TopoDS_Shape& sketchshape,
const std::string& method,
const gp_Dir& direction,
const double L,
const double L2,
const double angle,
const double angle2,
const bool midplane)
const TopoDS_Shape& sketchshape,
const std::string& method,
const gp_Dir& direction,
const double L,
const double L2,
const double angle,
const double angle2,
const bool midplane)
{
std::list<TopoDS_Shape> drafts;
bool isSolid = true; // in PD we only generate solids, while Part Extrude can also create only shells
bool isPartDesign = true; // there is an OCC bug with single-edge wires (circles) we need to treat differently for PD and Part
if (method == "ThroughAll")
if (method == "ThroughAll") {
Part::ExtrusionHelper::makeDraft(sketchshape, direction, getThroughAllLength(),
0.0, Base::toRadians(angle), 0.0, isSolid, drafts, isPartDesign);
else if (method == "TwoLengths")
}
else if (method == "TwoLengths") {
Part::ExtrusionHelper::makeDraft(sketchshape, direction, L, L2,
Base::toRadians(angle), Base::toRadians(angle2), isSolid, drafts, isPartDesign);
}
else if (method == "Length") {
if (midplane) {
Part::ExtrusionHelper::makeDraft(sketchshape, direction, L / 2, L / 2,

View File

@@ -68,18 +68,18 @@ protected:
Base::Vector3d computeDirection(const Base::Vector3d& sketchVector);
/**
* Generates an extrusion of the input sketchshape and stores it in the given &prism
* Generates an extrusion of the input sketchshape and stores it in the given \a prism
*/
void Extrude(TopoDS_Shape& prism,
const TopoDS_Shape& sketchshape,
const std::string& method,
const gp_Dir& direction,
const double L,
const double L2,
const double angle,
const double angle2,
const bool midplane,
const bool reversed);
void generatePrism(TopoDS_Shape& prism,
const TopoDS_Shape& sketchshape,
const std::string& method,
const gp_Dir& direction,
const double L,
const double L2,
const double angle,
const double angle2,
const bool midplane,
const bool reversed);
// See BRepFeat_MakePrism
enum PrismMode {
@@ -92,28 +92,28 @@ protected:
* Generates an extrusion of the input profileshape
* It will be a stand-alone solid created with BRepFeat_MakePrism
*/
static void Extrude(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,
PrismMode Mode,
Standard_Boolean Modify);
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,
PrismMode Mode,
Standard_Boolean Modify);
/**
* Generates a tapered prism of the input sketchshape and stores it in the given &prism
* Generates a tapered prism of the input sketchshape and stores it in the given \a prism
*/
void generateTaperedPrism(TopoDS_Shape& prism,
const TopoDS_Shape& sketchshape,
const std::string& method,
const gp_Dir& direction,
const double L,
const double L2,
const double angle,
const double angle2,
const bool midplane);
const TopoDS_Shape& sketchshape,
const std::string& method,
const gp_Dir& direction,
const double L,
const double L2,
const double angle,
const double angle2,
const bool midplane);
};
} //namespace PartDesign

View File

@@ -190,7 +190,7 @@ App::DocumentObjectExecReturn *Pad::execute()
supportface = TopoDS_Face();
PrismMode mode = PrismMode::None;
Extrude(prism, method, base, sketchshape, supportface, upToFace, dir, mode, Standard_True);
generatePrism(prism, method, base, sketchshape, supportface, upToFace, dir, mode, Standard_True);
base.Nullify();
}
else {
@@ -207,12 +207,12 @@ App::DocumentObjectExecReturn *Pad::execute()
if (!Ex.More())
supportface = TopoDS_Face();
PrismMode mode = PrismMode::None;
Extrude(prism, method, base, sketchshape, supportface, upToFace, dir, mode, Standard_True);
generatePrism(prism, method, base, sketchshape, supportface, upToFace, dir, mode, Standard_True);
}
}
else {
Extrude(prism, sketchshape, method, dir, L, L2,
TaperAngle.getValue(), TaperAngle2.getValue(), hasMidplane, hasReversed);
generatePrism(prism, sketchshape, method, dir, L, L2,
TaperAngle.getValue(), TaperAngle2.getValue(), hasMidplane, hasReversed);
}
if (prism.IsNull())

View File

@@ -200,7 +200,7 @@ App::DocumentObjectExecReturn *Pocket::execute()
supportface = TopoDS_Face();
TopoDS_Shape prism;
PrismMode mode = PrismMode::CutFromBase;
Extrude(prism, method, base, profileshape, supportface, upToFace, dir, mode, Standard_True);
generatePrism(prism, method, base, profileshape, supportface, upToFace, dir, mode, Standard_True);
// And the really expensive way to get the SubShape...
BRepAlgoAPI_Cut mkCut(base, prism);
@@ -219,8 +219,8 @@ App::DocumentObjectExecReturn *Pocket::execute()
}
else {
TopoDS_Shape prism;
Extrude(prism, profileshape, method, dir, L, L2, TaperAngle.getValue(), TaperAngle2.getValue(),
Midplane.getValue(), Reversed.getValue());
generatePrism(prism, profileshape, method, dir, L, L2, TaperAngle.getValue(), TaperAngle2.getValue(),
Midplane.getValue(), Reversed.getValue());
if (prism.IsNull())
return new App::DocumentObjectExecReturn("Pocket: Resulting shape is empty");