Break up try/catch blocks for easier debugging

This commit is contained in:
WandererFan 2016-09-06 19:53:56 -04:00 committed by wmayer
parent cebe2faee1
commit 5fd19bb5f4
2 changed files with 56 additions and 20 deletions

View File

@ -155,27 +155,54 @@ App::DocumentObjectExecReturn *DrawViewPart::execute(void)
Base::Console().Log("INFO - DVP::execute - Scale: %.3f\n",s);
return DrawView::execute();
}
geometryObject->setScale(s);
geometryObject->setScale(Scale.getValue());
//TODO: remove these try/catch block when code is stable
gp_Pnt inputCenter;
try {
gp_Pnt inputCenter = TechDrawGeometry::findCentroid(shape,
Direction.getValue(),
getValidXDir());
inputCenter = TechDrawGeometry::findCentroid(shape,
Direction.getValue(),
getValidXDir());
shapeCentroid = Base::Vector3d(inputCenter.X(),inputCenter.Y(),inputCenter.Z());
TopoDS_Shape mirroredShape = TechDrawGeometry::mirrorShape(shape,
inputCenter,
Scale.getValue());
buildGeometryObject(mirroredShape,inputCenter);
#if MOD_TECHDRAW_HANDLE_FACES
extractFaces();
#endif //#if MOD_TECHDRAW_HANDLE_FACES
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
return new App::DocumentObjectExecReturn(e->GetMessageString());
Handle_Standard_Failure e1 = Standard_Failure::Caught();
Base::Console().Log("LOG - DVP::execute - findCentroid failed for %s - %s **\n",getNameInDocument(),e1->GetMessageString());
return new App::DocumentObjectExecReturn(e1->GetMessageString());
}
TopoDS_Shape mirroredShape;
try {
mirroredShape = TechDrawGeometry::mirrorShape(shape,
inputCenter,
Scale.getValue());
}
catch (Standard_Failure) {
Handle_Standard_Failure e2 = Standard_Failure::Caught();
Base::Console().Log("LOG - DVP::execute - mirrorShape failed for %s - %s **\n",getNameInDocument(),e2->GetMessageString());
return new App::DocumentObjectExecReturn(e2->GetMessageString());
}
try {
buildGeometryObject(mirroredShape,inputCenter);
}
catch (Standard_Failure) {
Handle_Standard_Failure e3 = Standard_Failure::Caught();
Base::Console().Log("LOG - DVP::execute - buildGeometryObject failed for %s - %s **\n",getNameInDocument(),e3->GetMessageString());
return new App::DocumentObjectExecReturn(e3->GetMessageString());
}
#if MOD_TECHDRAW_HANDLE_FACES
try {
extractFaces();
}
catch (Standard_Failure) {
Handle_Standard_Failure e4 = Standard_Failure::Caught();
Base::Console().Log("LOG - DVP::execute - buildGeometryObject failed for %s - %s **\n",getNameInDocument(),e4->GetMessageString());
return new App::DocumentObjectExecReturn(e4->GetMessageString());
}
#endif //#if MOD_TECHDRAW_HANDLE_FACES
//TODO: not sure about this
// There is a guaranteed change so check any references linked to this and touch
// We need to update all views pointing at this (ProjectionGroup, ClipGroup, Section, etc)

View File

@ -200,10 +200,12 @@ App::DocumentObjectExecReturn *DrawViewSection::execute(void)
geometryObject->setTolerance(Tolerance.getValue());
geometryObject->setScale(Scale.getValue());
Base::Vector3d validXDir = getValidXDir();
gp_Pnt inputCenter;
try {
gp_Pnt inputCenter = TechDrawGeometry::findCentroid(rawShape,
Direction.getValue(),
validXDir);
inputCenter = TechDrawGeometry::findCentroid(rawShape,
Direction.getValue(),
validXDir);
TopoDS_Shape mirroredShape = TechDrawGeometry::mirrorShape(rawShape,
inputCenter,
Scale.getValue());
@ -212,7 +214,14 @@ App::DocumentObjectExecReturn *DrawViewSection::execute(void)
#if MOD_TECHDRAW_HANDLE_FACES
extractFaces();
#endif //#if MOD_TECHDRAW_HANDLE_FACES
}
catch (Standard_Failure) {
Handle_Standard_Failure e1 = Standard_Failure::Caught();
Base::Console().Log("LOG - DVS::execute - base shape failed for %s - %s **\n",getNameInDocument(),e1->GetMessageString());
return new App::DocumentObjectExecReturn(e1->GetMessageString());
}
try {
TopoDS_Compound sectionCompound = findSectionPlaneIntersections(rawShape);
TopoDS_Shape mirroredSection = TechDrawGeometry::mirrorShape(sectionCompound,
inputCenter,
@ -234,9 +243,9 @@ App::DocumentObjectExecReturn *DrawViewSection::execute(void)
sectionFaces = newFaces;
}
catch (Standard_Failure) {
Handle_Standard_Failure e1 = Standard_Failure::Caught();
return new App::DocumentObjectExecReturn(std::string("DVS building Section shape failed: ") +
std::string(e1->GetMessageString()));
Handle_Standard_Failure e2 = Standard_Failure::Caught();
Base::Console().Log("LOG - DVS::execute - failed building section faces for %s - %s **\n",getNameInDocument(),e2->GetMessageString());
return new App::DocumentObjectExecReturn(e2->GetMessageString());
}
return DrawView::execute();