Use OCCT Handle macro for Handle_ classes

This is the result of running OCCT's upgrade script provided
with OCCT 7.0. See
https://www.opencascade.com/content/freecad-occt710-and-windows-rtti-data-missing#comment-form
and
https://www.forum.freecadweb.org/viewtopic.php?f=4&t=21405&start=120#p169019
for why this is necessary for OCCT >= 7.1
This commit is contained in:
Peter Lama
2017-04-17 20:33:29 -04:00
committed by wmayer
parent ea3d86b735
commit a75a98ef27
141 changed files with 2198 additions and 2208 deletions

View File

@@ -116,7 +116,7 @@ int TopoShapeEdgePy::PyInit(PyObject* args, PyObject* /*kwd*/)
double first=DBL_MAX, last=DBL_MAX;
if (PyArg_ParseTuple(args, "O!|dd", &(Part::GeometryPy::Type), &pcObj, &first, &last)) {
Geometry* geom = static_cast<GeometryPy*>(pcObj)->getGeometryPtr();
Handle_Geom_Curve curve = Handle_Geom_Curve::DownCast(geom->handle());
Handle(Geom_Curve) curve = Handle(Geom_Curve)::DownCast(geom->handle());
if (curve.IsNull()) {
PyErr_SetString(PartExceptionOCCError, "geometry is not a curve type");
return -1;
@@ -133,7 +133,7 @@ int TopoShapeEdgePy::PyInit(PyObject* args, PyObject* /*kwd*/)
return 0;
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
Handle(Standard_Failure) e = Standard_Failure::Caught();
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return -1;
}
@@ -166,7 +166,7 @@ int TopoShapeEdgePy::PyInit(PyObject* args, PyObject* /*kwd*/)
return 0;
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
Handle(Standard_Failure) e = Standard_Failure::Caught();
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return -1;
}
@@ -244,7 +244,7 @@ PyObject* TopoShapeEdgePy::parameterAt(PyObject *args)
}
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
Handle(Standard_Failure) e = Standard_Failure::Caught();
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
@@ -287,7 +287,7 @@ PyObject* TopoShapeEdgePy::normalAt(PyObject *args)
return new Base::VectorPy(new Base::Vector3d(V.X(),V.Y(),V.Z()));
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
Handle(Standard_Failure) e = Standard_Failure::Caught();
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
@@ -308,7 +308,7 @@ PyObject* TopoShapeEdgePy::curvatureAt(PyObject *args)
return Py::new_reference_to(Py::Float(C));
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
Handle(Standard_Failure) e = Standard_Failure::Caught();
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
@@ -330,7 +330,7 @@ PyObject* TopoShapeEdgePy::centerOfCurvatureAt(PyObject *args)
return new Base::VectorPy(new Base::Vector3d(V.X(),V.Y(),V.Z()));
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
Handle(Standard_Failure) e = Standard_Failure::Caught();
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
@@ -351,7 +351,7 @@ PyObject* TopoShapeEdgePy::derivative1At(PyObject *args)
return new Base::VectorPy(new Base::Vector3d(V.X(),V.Y(),V.Z()));
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
Handle(Standard_Failure) e = Standard_Failure::Caught();
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
@@ -372,7 +372,7 @@ PyObject* TopoShapeEdgePy::derivative2At(PyObject *args)
return new Base::VectorPy(new Base::Vector3d(V.X(),V.Y(),V.Z()));
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
Handle(Standard_Failure) e = Standard_Failure::Caught();
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
@@ -393,7 +393,7 @@ PyObject* TopoShapeEdgePy::derivative3At(PyObject *args)
return new Base::VectorPy(new Base::Vector3d(V.X(),V.Y(),V.Z()));
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
Handle(Standard_Failure) e = Standard_Failure::Caught();
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
@@ -621,7 +621,7 @@ PyObject* TopoShapeEdgePy::split(PyObject *args)
std::sort(par.begin(), par.end());
BRepBuilderAPI_MakeWire mkWire;
Handle_Geom_Curve c = adapt.Curve().Curve();
Handle(Geom_Curve) c = adapt.Curve().Curve();
std::vector<Standard_Real>::iterator end = par.end() - 1;
for (std::vector<Standard_Real>::iterator it = par.begin(); it != end; ++it) {
BRepBuilderAPI_MakeEdge mkBuilder(c, it[0], it[1]);
@@ -631,7 +631,7 @@ PyObject* TopoShapeEdgePy::split(PyObject *args)
return new TopoShapeWirePy(new TopoShape(mkWire.Shape()));
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
Handle(Standard_Failure) e = Standard_Failure::Caught();
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
@@ -652,7 +652,7 @@ PyObject* TopoShapeEdgePy::isSeam(PyObject *args)
return PyBool_FromLong(ok ? 1 : 0);
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
Handle(Standard_Failure) e = Standard_Failure::Caught();
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
@@ -734,9 +734,9 @@ Py::Object TopoShapeEdgePy::getCurve() const
if (LineOld) {
GeomLineSegment* line = new GeomLineSegment();
Handle_Geom_TrimmedCurve this_curv = Handle_Geom_TrimmedCurve::DownCast
Handle(Geom_TrimmedCurve) this_curv = Handle(Geom_TrimmedCurve)::DownCast
(line->handle());
Handle_Geom_Line this_line = Handle_Geom_Line::DownCast
Handle(Geom_Line) this_line = Handle(Geom_Line)::DownCast
(this_curv->BasisCurve());
this_line->SetLin(adapt.Line());
this_curv->SetTrim(adapt.FirstParameter(), adapt.LastParameter());
@@ -752,7 +752,7 @@ Py::Object TopoShapeEdgePy::getCurve() const
}
else {
GeomLine* line = new GeomLine();
Handle_Geom_Line this_curv = Handle_Geom_Line::DownCast
Handle(Geom_Line) this_curv = Handle(Geom_Line)::DownCast
(line->handle());
this_curv->SetLin(adapt.Line());
return Py::Object(new LinePy(line),true);
@@ -761,7 +761,7 @@ Py::Object TopoShapeEdgePy::getCurve() const
case GeomAbs_Circle:
{
GeomCircle* circle = new GeomCircle();
Handle_Geom_Circle this_curv = Handle_Geom_Circle::DownCast
Handle(Geom_Circle) this_curv = Handle(Geom_Circle)::DownCast
(circle->handle());
this_curv->SetCirc(adapt.Circle());
//Standard_Real dd = adapt.FirstParameter();
@@ -771,7 +771,7 @@ Py::Object TopoShapeEdgePy::getCurve() const
case GeomAbs_Ellipse:
{
GeomEllipse* elips = new GeomEllipse();
Handle_Geom_Ellipse this_curv = Handle_Geom_Ellipse::DownCast
Handle(Geom_Ellipse) this_curv = Handle(Geom_Ellipse)::DownCast
(elips->handle());
this_curv->SetElips(adapt.Ellipse());
return Py::Object(new EllipsePy(elips),true);
@@ -779,7 +779,7 @@ Py::Object TopoShapeEdgePy::getCurve() const
case GeomAbs_Hyperbola:
{
GeomHyperbola* hypr = new GeomHyperbola();
Handle_Geom_Hyperbola this_curv = Handle_Geom_Hyperbola::DownCast
Handle(Geom_Hyperbola) this_curv = Handle(Geom_Hyperbola)::DownCast
(hypr->handle());
this_curv->SetHypr(adapt.Hyperbola());
return Py::Object(new HyperbolaPy(hypr),true);
@@ -787,7 +787,7 @@ Py::Object TopoShapeEdgePy::getCurve() const
case GeomAbs_Parabola:
{
GeomParabola* parab = new GeomParabola();
Handle_Geom_Parabola this_curv = Handle_Geom_Parabola::DownCast
Handle(Geom_Parabola) this_curv = Handle(Geom_Parabola)::DownCast
(parab->handle());
this_curv->SetParab(adapt.Parabola());
return Py::Object(new ParabolaPy(parab),true);
@@ -806,8 +806,8 @@ Py::Object TopoShapeEdgePy::getCurve() const
case GeomAbs_OffsetCurve:
{
Standard_Real first, last;
Handle_Geom_Curve c = BRep_Tool::Curve(e, first, last);
Handle_Geom_OffsetCurve off = Handle_Geom_OffsetCurve::DownCast(c);
Handle(Geom_Curve) c = BRep_Tool::Curve(e, first, last);
Handle(Geom_OffsetCurve) off = Handle(Geom_OffsetCurve)::DownCast(c);
if (!off.IsNull()) {
GeomOffsetCurve* curve = new GeomOffsetCurve(off);
return Py::Object(new OffsetCurvePy(curve),true);