prevent inverted pipes and correct camera adjustment
This commit is contained in:
parent
342ba89afd
commit
a727a9b93d
|
@ -52,6 +52,7 @@
|
|||
#include <BRepAlgoAPI_Cut.hxx>
|
||||
#include <BRepBuilderAPI_Sewing.hxx>
|
||||
#include <BRepBuilderAPI_MakeSolid.hxx>
|
||||
#include <BRepClass3d_SolidClassifier.hxx>
|
||||
#endif
|
||||
|
||||
#include <Base/Exception.h>
|
||||
|
@ -196,16 +197,28 @@ App::DocumentObjectExecReturn *Pipe::execute(void)
|
|||
if(!mkSolid.IsDone())
|
||||
return new App::DocumentObjectExecReturn("Result is not a solid");
|
||||
|
||||
AddSubShape.setValue(mkSolid.Shape());
|
||||
TopoDS_Shape result = mkSolid.Shape();
|
||||
BRepClass3d_SolidClassifier SC(result);
|
||||
SC.PerformInfinitePoint(Precision::Confusion());
|
||||
if ( SC.State() == TopAbs_IN) {
|
||||
result.Reverse();
|
||||
}
|
||||
|
||||
AddSubShape.setValue(result);
|
||||
|
||||
if(base.IsNull()) {
|
||||
Shape.setValue(mkSolid.Shape());
|
||||
Shape.setValue(result);
|
||||
return App::DocumentObject::StdReturn;
|
||||
}
|
||||
|
||||
if(getAddSubType() == FeatureAddSub::Additive) {
|
||||
|
||||
BRepAlgoAPI_Fuse mkFuse(base, mkSolid.Shape());
|
||||
auto* b = getDocument()->addObject("Part::Feature", "base");
|
||||
static_cast<Part::Feature*>(b)->Shape.setValue(base);
|
||||
b = getDocument()->addObject("Part::Feature", "pipe");
|
||||
static_cast<Part::Feature*>(b)->Shape.setValue(result);
|
||||
|
||||
BRepAlgoAPI_Fuse mkFuse(base, result);
|
||||
if (!mkFuse.IsDone())
|
||||
return new App::DocumentObjectExecReturn("Adding the pipe failed");
|
||||
// we have to get the solids (fuse sometimes creates compounds)
|
||||
|
@ -219,7 +232,7 @@ App::DocumentObjectExecReturn *Pipe::execute(void)
|
|||
}
|
||||
else if(getAddSubType() == FeatureAddSub::Subtractive) {
|
||||
|
||||
BRepAlgoAPI_Cut mkCut(base, mkSolid.Shape());
|
||||
BRepAlgoAPI_Cut mkCut(base, result);
|
||||
if (!mkCut.IsDone())
|
||||
return new App::DocumentObjectExecReturn("Subtracting the pipe failed");
|
||||
// we have to get the solids (fuse sometimes creates compounds)
|
||||
|
|
|
@ -1150,7 +1150,7 @@ void CmdPartDesignPad::activated(int iMsg)
|
|||
Gui::Command::updateActive();
|
||||
|
||||
finishSketchBased(cmd, sketch, FeatName);
|
||||
//adjustCameraPosition();
|
||||
cmd->adjustCameraPosition();
|
||||
};
|
||||
|
||||
prepareSketchBased(this, "Pad", worker);
|
||||
|
@ -1187,7 +1187,7 @@ void CmdPartDesignPocket::activated(int iMsg)
|
|||
|
||||
Gui::Command::doCommand(Doc,"App.activeDocument().%s.Length = 5.0",FeatName.c_str());
|
||||
finishSketchBased(cmd, sketch, FeatName);
|
||||
//adjustCameraPosition();
|
||||
cmd->adjustCameraPosition();
|
||||
};
|
||||
|
||||
prepareSketchBased(this, "Pocket", worker);
|
||||
|
@ -1230,7 +1230,7 @@ void CmdPartDesignRevolution::activated(int iMsg)
|
|||
Gui::Command::doCommand(Doc,"App.activeDocument().%s.Reversed = 1",FeatName.c_str());
|
||||
|
||||
finishSketchBased(cmd, sketch, FeatName);
|
||||
//adjustCameraPosition();
|
||||
cmd->adjustCameraPosition();
|
||||
};
|
||||
|
||||
prepareSketchBased(this, "Revolution", worker);
|
||||
|
@ -1273,7 +1273,7 @@ void CmdPartDesignGroove::activated(int iMsg)
|
|||
Gui::Command::doCommand(Doc,"App.activeDocument().%s.Reversed = 1",FeatName.c_str());
|
||||
|
||||
finishSketchBased(cmd, sketch, FeatName);
|
||||
//adjustCameraPosition();
|
||||
cmd->adjustCameraPosition();
|
||||
};
|
||||
|
||||
prepareSketchBased(this, "Groove", worker);
|
||||
|
@ -1320,7 +1320,7 @@ void CmdPartDesignAdditivePipe::activated(int iMsg)
|
|||
Gui::Command::updateActive();
|
||||
|
||||
finishSketchBased(cmd, sketch, FeatName);
|
||||
//adjustCameraPosition();
|
||||
cmd->adjustCameraPosition();
|
||||
};
|
||||
|
||||
prepareSketchBased(this, "AdditivePipe", worker);
|
||||
|
@ -1368,7 +1368,7 @@ void CmdPartDesignSubtractivePipe::activated(int iMsg)
|
|||
Gui::Command::updateActive();
|
||||
|
||||
finishSketchBased(cmd, sketch, FeatName);
|
||||
//adjustCameraPosition();
|
||||
cmd->adjustCameraPosition();
|
||||
};
|
||||
|
||||
prepareSketchBased(this, "SubtractivePipe", worker);
|
||||
|
|
Loading…
Reference in New Issue
Block a user