diff --git a/src/Mod/Part/App/Attacher.cpp b/src/Mod/Part/App/Attacher.cpp index 255d54b702..2107d02fed 100644 --- a/src/Mod/Part/App/Attacher.cpp +++ b/src/Mod/Part/App/Attacher.cpp @@ -1934,17 +1934,17 @@ AttachEngine3D::_calculateAttachedPlacement(const std::vectorshapeType()) { case TopAbs_VERTEX: { - if (auto point = dynamic_cast(geom.get())) { + if (auto point = freecad_cast(geom.get())) { placement.setPosition(point->getPoint()); } } break; case TopAbs_EDGE: { - if (auto conic = dynamic_cast(geom.get())) { + if (auto conic = freecad_cast(geom.get())) { placement.setPosition(conic->getLocation()); placement.setRotation(conic->getRotation().value_or(Base::Rotation {})); - } else if (auto line = dynamic_cast(geom.get())) { + } else if (auto line = freecad_cast(geom.get())) { auto u1 = line->getFirstParameter(); auto u2 = line->getLastParameter(); @@ -1963,11 +1963,11 @@ AttachEngine3D::_calculateAttachedPlacement(const std::vector(geom.get()); + auto surface = freecad_cast(geom.get()); - if (auto sphere = dynamic_cast(geom.get())) { + if (auto sphere = freecad_cast(geom.get())) { placement.setPosition(sphere->getLocation()); - } else if (auto cone = dynamic_cast(geom.get())) { + } else if (auto cone = freecad_cast(geom.get())) { placement.setPosition(cone->getApex()); } else if (auto com = shape->centerOfGravity()) { placement.setPosition(*com); diff --git a/src/Mod/Part/App/Geometry.cpp b/src/Mod/Part/App/Geometry.cpp index f4ac0ffb52..e88424e7f8 100644 --- a/src/Mod/Part/App/Geometry.cpp +++ b/src/Mod/Part/App/Geometry.cpp @@ -1285,7 +1285,7 @@ void GeomBezierCurve::Restore(Base::XMLReader& reader) PyObject *GeomBezierCurve::getPyObject() { - return new BezierCurvePy(dynamic_cast(this->clone())); + return new BezierCurvePy(freecad_cast(this->clone())); } bool GeomBezierCurve::isSame(const Geometry &_other, double tol, double) const @@ -2059,7 +2059,7 @@ void GeomBSplineCurve::Restore(Base::XMLReader& reader) PyObject *GeomBSplineCurve::getPyObject() { - return new BSplineCurvePy(dynamic_cast(this->clone())); + return new BSplineCurvePy(freecad_cast(this->clone())); } bool GeomBSplineCurve::isSame(const Geometry &_other, double tol, double atol) const @@ -4698,7 +4698,7 @@ void GeomLineSegment::Restore (Base::XMLReader &reader) PyObject *GeomLineSegment::getPyObject() { - return new LineSegmentPy(dynamic_cast(this->clone())); + return new LineSegmentPy(freecad_cast(this->clone())); } // ------------------------------------------------- @@ -4769,7 +4769,7 @@ void GeomOffsetCurve::Restore(Base::XMLReader &/*reader*/) PyObject *GeomOffsetCurve::getPyObject() { - return new OffsetCurvePy(dynamic_cast(this->clone())); + return new OffsetCurvePy(freecad_cast(this->clone())); } bool GeomOffsetCurve::isSame(const Geometry &_other, double tol, double atol) const diff --git a/src/Mod/Part/App/PropertyGeometryList.cpp b/src/Mod/Part/App/PropertyGeometryList.cpp index c4c9a30ff3..76515145e9 100644 --- a/src/Mod/Part/App/PropertyGeometryList.cpp +++ b/src/Mod/Part/App/PropertyGeometryList.cpp @@ -146,7 +146,7 @@ PyObject *PropertyGeometryList::getPyObject() void PropertyGeometryList::setPyObject(PyObject *value) { // check container of this property to notify about changes - Part2DObject* part2d = dynamic_cast(this->getContainer()); + Part2DObject* part2d = freecad_cast(this->getContainer()); if (PySequence_Check(value)) { Py::Sequence sequence(value);