Gui: Add getObject<T>() helpers to various classes

Obtaining specific kind of document object is very common task. This
commit introduces handy helper which makes that a lot easier.
This commit is contained in:
Kacper Donat
2024-10-27 18:45:19 +01:00
parent ad50bb9bef
commit deb15a57e4
6 changed files with 22 additions and 5 deletions

View File

@@ -178,6 +178,9 @@ protected:
*/
PartDesign::Transformed* getObject() const;
template <class T>
T* getObject() const { return dynamic_cast<T*>(getObject()); }
/// Get the sketch object of the first original either of the object associated with this
/// feature or with the parent feature (MultiTransform mode)
App::DocumentObject* getSketchObject() const;