prepare for PyCXX 7.0

This commit is contained in:
wmayer
2018-04-18 19:20:50 +02:00
parent 08286c407e
commit 99ec96acd5
36 changed files with 226 additions and 239 deletions

View File

@@ -1277,7 +1277,7 @@ private:
PyObject *pleft=Py_False;
if (!PyArg_ParseTuple(args.ptr(), "ddd|dO!", &pitch, &height, &radius, &angle,
&(PyBool_Type), &pleft)) {
throw Py::Exception("Part.makeLongHelix fails on parms");
throw Py::RuntimeError("Part.makeLongHelix fails on parms");
}
try {

View File

@@ -148,7 +148,7 @@ void ArcOfConicPy::setAxis(Py::Object arg)
conic->SetAxis(axis);
}
catch (Standard_Failure) {
throw Py::Exception("cannot set axis");
throw Py::RuntimeError("cannot set axis");
}
}
@@ -188,7 +188,7 @@ void ArcOfConicPy::setXAxis(Py::Object arg)
conic->SetPosition(pos);
}
catch (Standard_Failure) {
throw Py::Exception("cannot set X axis");
throw Py::RuntimeError("cannot set X axis");
}
}
@@ -228,7 +228,7 @@ void ArcOfConicPy::setYAxis(Py::Object arg)
conic->SetPosition(pos);
}
catch (Standard_Failure) {
throw Py::Exception("cannot set Y axis");
throw Py::RuntimeError("cannot set Y axis");
}
}

View File

@@ -296,7 +296,7 @@ void ConePy::setAxis(Py::Object arg)
this_surf->SetAxis(axis);
}
catch (Standard_Failure) {
throw Py::Exception("cannot set axis");
throw Py::RuntimeError("cannot set axis");
}
}

View File

@@ -151,7 +151,7 @@ void ConicPy::setAxis(Py::Object arg)
conic->SetAxis(axis);
}
catch (Standard_Failure) {
throw Py::Exception("cannot set axis");
throw Py::RuntimeError("cannot set axis");
}
}
@@ -187,7 +187,7 @@ void ConicPy::setXAxis(Py::Object arg)
conic->SetPosition(pos);
}
catch (Standard_Failure) {
throw Py::Exception("cannot set X axis");
throw Py::RuntimeError("cannot set X axis");
}
}
@@ -223,7 +223,7 @@ void ConicPy::setYAxis(Py::Object arg)
conic->SetPosition(pos);
}
catch (Standard_Failure) {
throw Py::Exception("cannot set Y axis");
throw Py::RuntimeError("cannot set Y axis");
}
}

View File

@@ -293,7 +293,7 @@ void CylinderPy::setAxis(Py::Object arg)
this_surf->SetAxis(axis);
}
catch (Standard_Failure) {
throw Py::Exception("cannot set axis");
throw Py::RuntimeError("cannot set axis");
}
}

View File

@@ -163,7 +163,7 @@ void Line2dPy::setLocation(Py::Object arg)
try {
GCE2d_MakeLine ms(pnt, dir);
if (!ms.IsDone()) {
throw Py::Exception(gce_ErrorStatusText(ms.Status()));
throw Py::RuntimeError(gce_ErrorStatusText(ms.Status()));
}
// get Geom_Line of line
@@ -171,8 +171,7 @@ void Line2dPy::setLocation(Py::Object arg)
this_line->SetLin2d(that_line->Lin2d());
}
catch (Standard_Failure& e) {
throw Py::Exception(e.GetMessageString());
throw Py::RuntimeError(e.GetMessageString());
}
}
@@ -218,7 +217,7 @@ void Line2dPy::setDirection(Py::Object arg)
try {
GCE2d_MakeLine ms(pnt, dir);
if (!ms.IsDone()) {
throw Py::Exception(gce_ErrorStatusText(ms.Status()));
throw Py::RuntimeError(gce_ErrorStatusText(ms.Status()));
}
// get Geom_Line of line
@@ -226,8 +225,7 @@ void Line2dPy::setDirection(Py::Object arg)
this_line->SetLin2d(that_line->Lin2d());
}
catch (Standard_Failure& e) {
throw Py::Exception(e.GetMessageString());
throw Py::RuntimeError(e.GetMessageString());
}
}

View File

@@ -240,7 +240,7 @@ void Line2dSegmentPy::setStartPoint(Py::Object arg)
Standard_Failure::Raise("Both points are equal");
GCE2d_MakeSegment ms(p1, p2);
if (!ms.IsDone()) {
throw Py::Exception(gce_ErrorStatusText(ms.Status()));
throw Py::RuntimeError(gce_ErrorStatusText(ms.Status()));
}
// get Geom_Line of line segment
@@ -252,8 +252,7 @@ void Line2dSegmentPy::setStartPoint(Py::Object arg)
this_curv->SetTrim(that_curv->FirstParameter(), that_curv->LastParameter());
}
catch (Standard_Failure& e) {
throw Py::Exception(e.GetMessageString());
throw Py::RuntimeError(e.GetMessageString());
}
}
@@ -301,7 +300,7 @@ void Line2dSegmentPy::setEndPoint(Py::Object arg)
Standard_Failure::Raise("Both points are equal");
GCE2d_MakeSegment ms(p1, p2);
if (!ms.IsDone()) {
throw Py::Exception(gce_ErrorStatusText(ms.Status()));
throw Py::RuntimeError(gce_ErrorStatusText(ms.Status()));
}
// get Geom_Line of line segment
@@ -313,8 +312,7 @@ void Line2dSegmentPy::setEndPoint(Py::Object arg)
this_curv->SetTrim(that_curv->FirstParameter(), that_curv->LastParameter());
}
catch (Standard_Failure& e) {
throw Py::Exception(e.GetMessageString());
throw Py::RuntimeError(e.GetMessageString());
}
}

View File

@@ -122,8 +122,7 @@ void OffsetCurve2dPy::setBasisCurve(Py::Object arg)
curve2->SetBasisCurve(curve);
}
catch (Standard_Failure& e) {
throw Py::Exception(e.GetMessageString());
throw Py::RuntimeError(e.GetMessageString());
}
}
}

View File

@@ -161,7 +161,7 @@ void LinePy::setLocation(Py::Object arg)
try {
GC_MakeLine ms(pnt, dir);
if (!ms.IsDone()) {
throw Py::Exception(gce_ErrorStatusText(ms.Status()));
throw Py::RuntimeError(gce_ErrorStatusText(ms.Status()));
}
// get Geom_Line of line
@@ -169,8 +169,7 @@ void LinePy::setLocation(Py::Object arg)
this_curv->SetLin(that_curv->Lin());
}
catch (Standard_Failure& e) {
throw Py::Exception(e.GetMessageString());
throw Py::RuntimeError(e.GetMessageString());
}
}
@@ -211,7 +210,7 @@ void LinePy::setDirection(Py::Object arg)
try {
GC_MakeLine ms(pnt, dir);
if (!ms.IsDone()) {
throw Py::Exception(gce_ErrorStatusText(ms.Status()));
throw Py::RuntimeError(gce_ErrorStatusText(ms.Status()));
}
// get Geom_Line of line
@@ -219,8 +218,7 @@ void LinePy::setDirection(Py::Object arg)
this_curv->SetLin(that_curv->Lin());
}
catch (Standard_Failure& e) {
throw Py::Exception(e.GetMessageString());
throw Py::RuntimeError(e.GetMessageString());
}
}

View File

@@ -196,7 +196,6 @@ PyObject* LineSegmentPy::setParameterRange(PyObject *args)
this_curve->SetTrim(first, last);
}
catch (Standard_Failure& e) {
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
return NULL;
}
@@ -244,7 +243,7 @@ void LineSegmentPy::setStartPoint(Py::Object arg)
Standard_Failure::Raise("Both points are equal");
GC_MakeSegment ms(p1, p2);
if (!ms.IsDone()) {
throw Py::Exception(gce_ErrorStatusText(ms.Status()));
throw Py::RuntimeError(gce_ErrorStatusText(ms.Status()));
}
// get Geom_Line of line segment
@@ -256,8 +255,7 @@ void LineSegmentPy::setStartPoint(Py::Object arg)
this_curv->SetTrim(that_curv->FirstParameter(), that_curv->LastParameter());
}
catch (Standard_Failure& e) {
throw Py::Exception(e.GetMessageString());
throw Py::RuntimeError(e.GetMessageString());
}
}
@@ -301,7 +299,7 @@ void LineSegmentPy::setEndPoint(Py::Object arg)
Standard_Failure::Raise("Both points are equal");
GC_MakeSegment ms(p1, p2);
if (!ms.IsDone()) {
throw Py::Exception(gce_ErrorStatusText(ms.Status()));
throw Py::RuntimeError(gce_ErrorStatusText(ms.Status()));
}
// get Geom_Line of line segment
@@ -313,8 +311,7 @@ void LineSegmentPy::setEndPoint(Py::Object arg)
this_curv->SetTrim(that_curv->FirstParameter(), that_curv->LastParameter());
}
catch (Standard_Failure& e) {
throw Py::Exception(e.GetMessageString());
throw Py::RuntimeError(e.GetMessageString());
}
}

View File

@@ -145,8 +145,7 @@ void OffsetCurvePy::setBasisCurve(Py::Object arg)
curve2->SetBasisCurve(curve);
}
catch (Standard_Failure& e) {
throw Py::Exception(e.GetMessageString());
throw Py::RuntimeError(e.GetMessageString());
}
}
}

View File

@@ -120,8 +120,7 @@ void OffsetSurfacePy::setBasisSurface(Py::Object arg)
surf2->SetBasisSurface(surf);
}
catch (Standard_Failure& e) {
throw Py::Exception(e.GetMessageString());
throw Py::RuntimeError(e.GetMessageString());
}
}
}

View File

@@ -208,8 +208,7 @@ void PlanePy::setPosition(Py::Object arg)
this_surf->SetLocation(loc);
}
catch (Standard_Failure& e) {
throw Py::Exception(e.GetMessageString());
throw Py::RuntimeError(e.GetMessageString());
}
}
@@ -252,7 +251,7 @@ void PlanePy::setAxis(Py::Object arg)
this_surf->SetAxis(axis);
}
catch (Standard_Failure) {
throw Py::Exception("cannot set axis");
throw Py::RuntimeError("cannot set axis");
}
}

View File

@@ -144,8 +144,7 @@ void PointPy::setX(Py::Float X)
this_point->SetX(double(X));
}
catch (Standard_Failure& e) {
throw Py::Exception(e.GetMessageString());
throw Py::RuntimeError(e.GetMessageString());
}
}
@@ -165,8 +164,7 @@ void PointPy::setY(Py::Float Y)
this_point->SetY(double(Y));
}
catch (Standard_Failure& e) {
throw Py::Exception(e.GetMessageString());
throw Py::RuntimeError(e.GetMessageString());
}
}
@@ -186,8 +184,7 @@ void PointPy::setZ(Py::Float Z)
this_point->SetZ(double(Z));
}
catch (Standard_Failure& e) {
throw Py::Exception(e.GetMessageString());
throw Py::RuntimeError(e.GetMessageString());
}
}

View File

@@ -177,7 +177,7 @@ void SpherePy::setAxis(Py::Object arg)
this_surf->SetAxis(axis);
}
catch (Standard_Failure) {
throw Py::Exception("cannot set axis");
throw Py::RuntimeError("cannot set axis");
}
}

View File

@@ -139,8 +139,7 @@ void SurfaceOfExtrusionPy::setBasisCurve(Py::Object arg)
curve2->SetBasisCurve(curve);
}
catch (Standard_Failure& e) {
throw Py::Exception(e.GetMessageString());
throw Py::RuntimeError(e.GetMessageString());
}
}
}

View File

@@ -166,8 +166,7 @@ void SurfaceOfRevolutionPy::setBasisCurve(Py::Object arg)
curve2->SetBasisCurve(curve);
}
catch (Standard_Failure& e) {
throw Py::Exception(e.GetMessageString());
throw Py::RuntimeError(e.GetMessageString());
}
}
}

View File

@@ -1000,7 +1000,7 @@ Py::Dict TopoShapeEdgePy::getPrincipalProperties(void) const
Py::Boolean TopoShapeEdgePy::getClosed(void) const
{
if (getTopoShapePtr()->getShape().IsNull())
throw Py::Exception("Cannot determine the 'Closed'' flag of an empty shape");
throw Py::RuntimeError("Cannot determine the 'Closed'' flag of an empty shape");
Standard_Boolean ok = BRep_Tool::IsClosed(getTopoShapePtr()->getShape());
return Py::Boolean(ok ? true : false);
}

View File

@@ -873,14 +873,14 @@ Py::Object TopoShapeFacePy::getOuterWire(void) const
{
const TopoDS_Shape& clSh = getTopoShapePtr()->getShape();
if (clSh.IsNull())
throw Py::Exception("Null shape");
throw Py::RuntimeError("Null shape");
if (clSh.ShapeType() == TopAbs_FACE) {
TopoDS_Face clFace = (TopoDS_Face&)clSh;
TopoDS_Wire clWire = ShapeAnalysis::OuterWire(clFace);
return Py::Object(new TopoShapeWirePy(new TopoShape(clWire)),true);
}
else {
throw Py::Exception("Internal error, TopoDS_Shape is not a face!");
throw Py::TypeError("Internal error, TopoDS_Shape is not a face!");
}
}

View File

@@ -119,7 +119,7 @@ void ToroidPy::setMajorRadius(Py::Float arg)
torus->SetMajorRadius((double)arg);
}
catch (Standard_Failure) {
throw Py::Exception("Major radius must be positive and higher than minor radius");
throw Py::RuntimeError("Major radius must be positive and higher than minor radius");
}
}
@@ -138,7 +138,7 @@ void ToroidPy::setMinorRadius(Py::Float arg)
torus->SetMinorRadius((double)arg);
}
catch (Standard_Failure) {
throw Py::Exception("Minor radius must be positive and lower than major radius");
throw Py::RuntimeError("Minor radius must be positive and lower than major radius");
}
}
@@ -205,7 +205,7 @@ void ToroidPy::setAxis(Py::Object arg)
this_surf->SetAxis(axis);
}
catch (Standard_Failure) {
throw Py::Exception("cannot set axis");
throw Py::RuntimeError("cannot set axis");
}
}