#include <SketchPlugin_SketchEntity.h>
#include <SketchPlugin_Tools.h>
+#include <Events_InfoMessage.h>
#include <Events_Loop.h>
#include <memory>
return std::shared_ptr<GeomAPI_Ax3>(new GeomAPI_Ax3(anOrigin->pnt(), aDirX->dir(), aNorm->dir()));
}
+
+bool SketchPlugin_Sketch::customAction(const std::string& theActionId)
+{
+ bool isOk = false;
+ if (theActionId == ACTION_REMOVE_EXTERNAL())
+ isOk = removeLinksToExternal();
+ else {
+ std::string aMsg = "Error: Feature \"%1\" does not support action \"%2\".";
+ Events_InfoMessage("SketchPlugin_Sketch", aMsg).arg(getKind()).arg(theActionId).send();
+ }
+ return isOk;
+}
+
+bool SketchPlugin_Sketch::removeLinksToExternal()
+{
+ // TODO
+ return true;
+}
return MY_SOLVER_DOF;
}
+ /// Action ID to remove links to external entities while changing the sketch plane.
+ inline static const std::string& ACTION_REMOVE_EXTERNAL()
+ {
+ static const std::string MY_ACTION_REMOVE_EXTERNAL("RemoveExternalLinks");
+ return MY_ACTION_REMOVE_EXTERNAL;
+ }
+
/// Returns the kind of a feature
SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
{
SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID);
+ /// Performs some custom feature specific functionality (normally called by some GUI button)
+ /// \param theActionId an action key
+ /// \return a boolean value about it is performed
+ SKETCHPLUGIN_EXPORT virtual bool customAction(const std::string& theActionId);
+
/// \brief Create a result for the point in the attribute if the attribute is initialized
/// \param theFeature a source feature
/// \param theSketch a sketch intance
return isCustomized;
}
+private:
+ /// Substitute all links to external objects by newly created features.
+ /// \return \c true, if all links updated.
+ bool removeLinksToExternal();
};
#endif