Replace Base::Exception with appropriate subclass
This commit is contained in:
@@ -610,7 +610,7 @@ Base::Vector3d SketchObject::getPoint(int GeoId, PointPos PosId) const
|
||||
{
|
||||
if(!(GeoId == H_Axis || GeoId == V_Axis
|
||||
|| (GeoId <= getHighestCurveIndex() && GeoId >= -getExternalGeometryCount()) ))
|
||||
throw Base::Exception("SketchObject::getPoint. Invalid GeoId was supplied.");
|
||||
throw Base::ValueError("SketchObject::getPoint. Invalid GeoId was supplied.");
|
||||
const Part::Geometry *geo = getGeometry(GeoId);
|
||||
if (geo->getTypeId() == Part::GeomPoint::getClassTypeId()) {
|
||||
const Part::GeomPoint *p = static_cast<const Part::GeomPoint*>(geo);
|
||||
@@ -1578,8 +1578,7 @@ int SketchObject::fillet(int GeoId1, int GeoId2,
|
||||
|
||||
radius = ((refp1 - normalintersect).Length() + (refp2 - normalintersect).Length())/2;
|
||||
}
|
||||
catch(Base::Exception e) {
|
||||
|
||||
catch(const Base::Exception&) {
|
||||
radius = ref21.Length(); // fall-back to simplest estimation.
|
||||
}
|
||||
}
|
||||
@@ -5609,8 +5608,7 @@ void SketchObject::rebuildExternalGeometry(void)
|
||||
refSubShape = refShape.getSubShape(SubElement.c_str());
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
|
||||
throw Base::Exception(e.GetMessageString());
|
||||
throw Base::CADKernelError(e.GetMessageString());
|
||||
}
|
||||
} else if (Obj->getTypeId().isDerivedFrom(App::Plane::getClassTypeId())) {
|
||||
const App::Plane* pl = static_cast<const App::Plane*>(Obj);
|
||||
@@ -5622,12 +5620,12 @@ void SketchObject::rebuildExternalGeometry(void)
|
||||
gp_Pln plane(gp_Pnt(base.x,base.y,base.z), gp_Dir(normal.x, normal.y, normal.z));
|
||||
BRepBuilderAPI_MakeFace fBuilder(plane);
|
||||
if (!fBuilder.IsDone())
|
||||
throw Base::Exception("Sketcher: addExternal(): Failed to build face from App::Plane");
|
||||
throw Base::RuntimeError("Sketcher: addExternal(): Failed to build face from App::Plane");
|
||||
|
||||
TopoDS_Face f = TopoDS::Face(fBuilder.Shape());
|
||||
refSubShape = f;
|
||||
} else {
|
||||
throw Base::Exception("Datum feature type is not yet supported as external geometry for a sketch");
|
||||
throw Base::TypeError("Datum feature type is not yet supported as external geometry for a sketch");
|
||||
}
|
||||
|
||||
switch (refSubShape.ShapeType())
|
||||
@@ -5655,10 +5653,10 @@ void SketchObject::rebuildExternalGeometry(void)
|
||||
}
|
||||
|
||||
} else {
|
||||
throw Base::Exception("Selected external reference plane must be normal to sketch plane");
|
||||
throw Base::ValueError("Selected external reference plane must be normal to sketch plane");
|
||||
}
|
||||
} else {
|
||||
throw Base::Exception("Non-planar faces are not yet supported for external geometry of sketches");
|
||||
throw Base::ValueError("Non-planar faces are not yet supported for external geometry of sketches");
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -5704,7 +5702,7 @@ void SketchObject::rebuildExternalGeometry(void)
|
||||
}
|
||||
else {
|
||||
// creates an ellipse
|
||||
throw Base::Exception("Not yet supported geometry for external geometry");
|
||||
throw Base::NotImplementedError("Not yet supported geometry for external geometry");
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -5872,14 +5870,13 @@ void SketchObject::rebuildExternalGeometry(void)
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw Base::Exception("Not yet supported geometry for external geometry");
|
||||
throw Base::NotImplementedError("Not yet supported geometry for external geometry");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
|
||||
throw Base::Exception(e.GetMessageString());
|
||||
throw Base::CADKernelError(e.GetMessageString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5898,7 +5895,7 @@ void SketchObject::rebuildExternalGeometry(void)
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw Base::Exception("Unknown type of geometry");
|
||||
throw Base::TypeError("Unknown type of geometry");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -6422,7 +6419,7 @@ double SketchObject::calculateAngleViaPoint(int GeoId1, int GeoId2, double px, d
|
||||
return sk.calculateAngleViaPoint(i1,i2,px,py);
|
||||
}
|
||||
else
|
||||
throw Base::Exception("Null geometry in calculateAngleViaPoint");
|
||||
throw Base::ValueError("Null geometry in calculateAngleViaPoint");
|
||||
|
||||
/*
|
||||
// OCC-based calculation. It is faster, but it was removed due to problems
|
||||
@@ -6436,12 +6433,12 @@ double SketchObject::calculateAngleViaPoint(int GeoId1, int GeoId2, double px, d
|
||||
|
||||
double u1 = 0.0;
|
||||
double u2 = 0.0;
|
||||
if (! g1.closestParameterToBasicCurve(p, u1) ) throw Base::Exception("SketchObject::calculateAngleViaPoint: closestParameter(curve1) failed!");
|
||||
if (! g2.closestParameterToBasicCurve(p, u2) ) throw Base::Exception("SketchObject::calculateAngleViaPoint: closestParameter(curve2) failed!");
|
||||
if (! g1.closestParameterToBasicCurve(p, u1) ) throw Base::ValueError("SketchObject::calculateAngleViaPoint: closestParameter(curve1) failed!");
|
||||
if (! g2.closestParameterToBasicCurve(p, u2) ) throw Base::ValueError("SketchObject::calculateAngleViaPoint: closestParameter(curve2) failed!");
|
||||
|
||||
gp_Dir tan1, tan2;
|
||||
if (! g1.tangent(u1,tan1) ) throw Base::Exception("SketchObject::calculateAngleViaPoint: tangent1 failed!");
|
||||
if (! g2.tangent(u2,tan2) ) throw Base::Exception("SketchObject::calculateAngleViaPoint: tangent2 failed!");
|
||||
if (! g1.tangent(u1,tan1) ) throw Base::ValueError("SketchObject::calculateAngleViaPoint: tangent1 failed!");
|
||||
if (! g2.tangent(u2,tan2) ) throw Base::ValueError("SketchObject::calculateAngleViaPoint: tangent2 failed!");
|
||||
|
||||
assert(abs(tan1.Z())<0.0001);
|
||||
assert(abs(tan2.Z())<0.0001);
|
||||
|
||||
Reference in New Issue
Block a user