handle exception thrown by BRepBuilderAPI_RefineModel

This commit is contained in:
wmayer
2017-07-23 15:46:57 +02:00
parent 7c1e689217
commit 488c1a1fdf
6 changed files with 57 additions and 27 deletions

View File

@@ -102,12 +102,17 @@ App::DocumentObjectExecReturn *Boolean::execute(void)
history.push_back(buildHistory(*mkBool.get(), TopAbs_FACE, resShape, ToolShape));
if (hGrp->GetBool("RefineModel", false)) {
TopoDS_Shape oldShape = resShape;
BRepBuilderAPI_RefineModel mkRefine(oldShape);
resShape = mkRefine.Shape();
ShapeHistory hist = buildHistory(mkRefine, TopAbs_FACE, resShape, oldShape);
history[0] = joinHistory(history[0], hist);
history[1] = joinHistory(history[1], hist);
try {
TopoDS_Shape oldShape = resShape;
BRepBuilderAPI_RefineModel mkRefine(oldShape);
resShape = mkRefine.Shape();
ShapeHistory hist = buildHistory(mkRefine, TopAbs_FACE, resShape, oldShape);
history[0] = joinHistory(history[0], hist);
history[1] = joinHistory(history[1], hist);
}
catch (Standard_Failure) {
// do nothing
}
}
this->Shape.setValue(resShape);

View File

@@ -140,12 +140,17 @@ App::DocumentObjectExecReturn *MultiCommon::execute(void)
}
}
if (hGrp->GetBool("RefineModel", false)) {
TopoDS_Shape oldShape = resShape;
BRepBuilderAPI_RefineModel mkRefine(oldShape);
resShape = mkRefine.Shape();
ShapeHistory hist = buildHistory(mkRefine, TopAbs_FACE, resShape, oldShape);
for (std::vector<ShapeHistory>::iterator jt = history.begin(); jt != history.end(); ++jt)
*jt = joinHistory(*jt, hist);
try {
TopoDS_Shape oldShape = resShape;
BRepBuilderAPI_RefineModel mkRefine(oldShape);
resShape = mkRefine.Shape();
ShapeHistory hist = buildHistory(mkRefine, TopAbs_FACE, resShape, oldShape);
for (std::vector<ShapeHistory>::iterator jt = history.begin(); jt != history.end(); ++jt)
*jt = joinHistory(*jt, hist);
}
catch (Standard_Failure) {
// do nothing
}
}
this->Shape.setValue(resShape);

View File

@@ -164,12 +164,17 @@ App::DocumentObjectExecReturn *MultiFuse::execute(void)
}
}
if (hGrp->GetBool("RefineModel", false)) {
TopoDS_Shape oldShape = resShape;
BRepBuilderAPI_RefineModel mkRefine(oldShape);
resShape = mkRefine.Shape();
ShapeHistory hist = buildHistory(mkRefine, TopAbs_FACE, resShape, oldShape);
for (std::vector<ShapeHistory>::iterator jt = history.begin(); jt != history.end(); ++jt)
*jt = joinHistory(*jt, hist);
try {
TopoDS_Shape oldShape = resShape;
BRepBuilderAPI_RefineModel mkRefine(oldShape);
resShape = mkRefine.Shape();
ShapeHistory hist = buildHistory(mkRefine, TopAbs_FACE, resShape, oldShape);
for (std::vector<ShapeHistory>::iterator jt = history.begin(); jt != history.end(); ++jt)
*jt = joinHistory(*jt, hist);
}
catch (Standard_Failure) {
// do nothing
}
}
this->Shape.setValue(resShape);

View File

@@ -75,9 +75,14 @@ TopoDS_Shape FeaturePrimitive::refineShapeIfActive(const TopoDS_Shape& oldShape)
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/PartDesign");
if (hGrp->GetBool("RefineModel", false)) {
Part::BRepBuilderAPI_RefineModel mkRefine(oldShape);
TopoDS_Shape resShape = mkRefine.Shape();
return resShape;
try {
Part::BRepBuilderAPI_RefineModel mkRefine(oldShape);
TopoDS_Shape resShape = mkRefine.Shape();
return resShape;
}
catch (Standard_Failure) {
return oldShape;
}
}
return oldShape;

View File

@@ -1024,9 +1024,14 @@ TopoDS_Shape ProfileBased::refineShapeIfActive(const TopoDS_Shape& oldShape) con
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/PartDesign");
if (hGrp->GetBool("RefineModel", false)) {
Part::BRepBuilderAPI_RefineModel mkRefine(oldShape);
TopoDS_Shape resShape = mkRefine.Shape();
return resShape;
try {
Part::BRepBuilderAPI_RefineModel mkRefine(oldShape);
TopoDS_Shape resShape = mkRefine.Shape();
return resShape;
}
catch (Standard_Failure) {
return oldShape;
}
}
return oldShape;

View File

@@ -377,9 +377,14 @@ TopoDS_Shape Transformed::refineShapeIfActive(const TopoDS_Shape& oldShape) cons
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/PartDesign");
if (hGrp->GetBool("RefineModel", false)) {
Part::BRepBuilderAPI_RefineModel mkRefine(oldShape);
TopoDS_Shape resShape = mkRefine.Shape();
return resShape;
try {
Part::BRepBuilderAPI_RefineModel mkRefine(oldShape);
TopoDS_Shape resShape = mkRefine.Shape();
return resShape;
}
catch (Standard_Failure) {
return oldShape;
}
}
return oldShape;