diff --git a/src/Mod/Part/App/Geometry.cpp b/src/Mod/Part/App/Geometry.cpp index ed4604b29f..c9ce273258 100644 --- a/src/Mod/Part/App/Geometry.cpp +++ b/src/Mod/Part/App/Geometry.cpp @@ -288,7 +288,7 @@ bool Geometry::hasExtension(std::string name) const return false; } -std::weak_ptr Geometry::getExtension(Base::Type type) const +std::weak_ptr Geometry::getExtension(Base::Type type) { for( auto ext : extensions) { if(ext->getTypeId() == type) @@ -298,7 +298,7 @@ std::weak_ptr Geometry::getExtension(Base::Type type) c throw Base::ValueError("No geometry extension of the requested type."); } -std::weak_ptr Geometry::getExtension(std::string name) const +std::weak_ptr Geometry::getExtension(std::string name) { for( auto ext : extensions) { if(ext->getName() == name) @@ -308,6 +308,17 @@ std::weak_ptr Geometry::getExtension(std::string name) throw Base::ValueError("No geometry extension with the requested name."); } +std::weak_ptr Geometry::getExtension(Base::Type type) const +{ + return const_cast(this)->getExtension(type).lock(); +} + +std::weak_ptr Geometry::getExtension(std::string name) const +{ + return const_cast(this)->getExtension(name).lock(); +} + + void Geometry::setExtension(std::unique_ptr && geo) { bool hasext=false; diff --git a/src/Mod/Part/App/Geometry.h b/src/Mod/Part/App/Geometry.h index 9ed35a73a2..f05f554cf9 100644 --- a/src/Mod/Part/App/Geometry.h +++ b/src/Mod/Part/App/Geometry.h @@ -107,6 +107,8 @@ public: bool hasExtension(std::string name) const; std::weak_ptr getExtension(Base::Type type) const; std::weak_ptr getExtension(std::string name) const; + std::weak_ptr getExtension(Base::Type type); + std::weak_ptr getExtension(std::string name); void setExtension(std::unique_ptr &&geo); void deleteExtension(Base::Type type); void deleteExtension(std::string name);