PartDesign: Mild code cleanup of Helix
This commit is contained in:
@@ -182,10 +182,6 @@ App::DocumentObjectExecReturn *Helix::execute(void)
|
||||
// generate the helix path
|
||||
TopoDS_Shape path = generateHelixPath();
|
||||
|
||||
// Below is basically a copy paste (with some simplification) from FeaturePipe.cpp Pipe::execute
|
||||
// TODO: find a way to reduce code repetition. E.g can I rip out this functionality of Pipe:execute to a static helper
|
||||
// function and call from here?
|
||||
|
||||
std::vector<TopoDS_Wire> wires;
|
||||
try {
|
||||
wires = getProfileWires();
|
||||
@@ -197,9 +193,6 @@ App::DocumentObjectExecReturn *Helix::execute(void)
|
||||
for(TopoDS_Wire& wire : wires)
|
||||
wiresections.emplace_back(1, wire);
|
||||
|
||||
//maybe we need a scaling law
|
||||
Handle(Law_Function) scalinglaw;
|
||||
|
||||
//build all shells
|
||||
std::vector<TopoDS_Shape> shells;
|
||||
std::vector<TopoDS_Wire> frontwires, backwires;
|
||||
@@ -209,22 +202,11 @@ App::DocumentObjectExecReturn *Helix::execute(void)
|
||||
|
||||
mkPS.SetTolerance(Precision::Confusion());
|
||||
mkPS.SetTransitionMode(BRepBuilderAPI_Transformed);
|
||||
|
||||
mkPS.SetMode(true); //This is for frenet
|
||||
//mkPipeShell.SetMode(TopoDS::Wire(auxpath), true); // this is for two rails
|
||||
|
||||
|
||||
if(!scalinglaw) {
|
||||
for(TopoDS_Wire& wire : wires) {
|
||||
wire.Move(invObjLoc);
|
||||
mkPS.Add(wire);
|
||||
}
|
||||
}
|
||||
else {
|
||||
for(TopoDS_Wire& wire : wires) {
|
||||
wire.Move(invObjLoc);
|
||||
mkPS.SetLaw(wire, scalinglaw);
|
||||
}
|
||||
for(TopoDS_Wire& wire : wires) {
|
||||
wire.Move(invObjLoc);
|
||||
mkPS.Add(wire);
|
||||
}
|
||||
|
||||
if (!mkPS.IsReady())
|
||||
@@ -232,7 +214,6 @@ App::DocumentObjectExecReturn *Helix::execute(void)
|
||||
|
||||
shells.push_back(mkPS.Shape());
|
||||
|
||||
|
||||
if (!mkPS.Shape().Closed()) {
|
||||
// shell is not closed - use simulate to get the end wires
|
||||
TopTools_ListOfShape sim;
|
||||
@@ -271,6 +252,7 @@ App::DocumentObjectExecReturn *Helix::execute(void)
|
||||
return new App::DocumentObjectExecReturn("Error: Result is not a solid");
|
||||
|
||||
TopoDS_Shape result = mkSolid.Shape();
|
||||
|
||||
BRepClass3d_SolidClassifier SC(result);
|
||||
SC.PerformInfinitePoint(Precision::Confusion());
|
||||
if (SC.State() == TopAbs_IN)
|
||||
@@ -278,7 +260,6 @@ App::DocumentObjectExecReturn *Helix::execute(void)
|
||||
|
||||
AddSubShape.setValue(result);
|
||||
|
||||
|
||||
if(base.IsNull()) {
|
||||
|
||||
if (getAddSubType() == FeatureAddSub::Subtractive)
|
||||
@@ -299,6 +280,7 @@ App::DocumentObjectExecReturn *Helix::execute(void)
|
||||
return new App::DocumentObjectExecReturn("Error: Adding the helix failed");
|
||||
// we have to get the solids (fuse sometimes creates compounds)
|
||||
TopoDS_Shape boolOp = this->getSolid(mkFuse.Shape());
|
||||
|
||||
// lets check if the result is a solid
|
||||
if (boolOp.IsNull())
|
||||
return new App::DocumentObjectExecReturn("Error: Result is not a solid");
|
||||
|
||||
Reference in New Issue
Block a user