Correction.
{
return ROOT_DOC->transactionID();
}
+
+void Model_Session::forceLoadPlugin(const std::string& thePluginName)
+{
+ // load all information about plugins, features and attributes
+ LoadPluginsInfo();
+
+ // store name of current plugin for further restoring,
+ // because forceLoadPlugin may be called while loading another plugin
+ std::string aCurrentPluginName = myCurrentPluginName;
+
+ myCurrentPluginName = thePluginName;
+ if (myPluginObjs.find(myCurrentPluginName) == myPluginObjs.end()) {
+ // load plugin library if not yet done
+ Config_ModuleReader::loadPlugin(myCurrentPluginName);
+ }
+
+ // restore current plugin
+ myCurrentPluginName = aCurrentPluginName;
+}
/// Returns the global identifier of the current transaction (needed for the update algo)
MODEL_EXPORT virtual int transactionID();
+ /// Load plugin by its name
+ MODEL_EXPORT virtual void forceLoadPlugin(const std::string& thePluginName);
+
protected:
/// Loads (if not done yet) the information about the features and plugins
void LoadPluginsInfo();
/// Returns the global identifier of the current transaction (needed for the update algo)
virtual int transactionID() = 0;
+ /// Load plugin by its name
+ virtual void forceLoadPlugin(const std::string& thePluginName) = 0;
+
protected:
/// Sets the session interface implementation (once per application launch)
static void setSession(std::shared_ptr<ModelAPI_Session> theManager);
It is kept, because SketchPlugin should be loaded before SketchAPI is first used.
Otherwise, the runtime error will be generated while some static inline methods are broken.
"""
-from ModelAPI import *
+from ModelAPI import ModelAPI_Session
aSession = ModelAPI_Session.get()
-aDocument = aSession.moduleDocument()
-aSession.startOperation()
-aDocument.addFeature("Sketch")
-aSession.finishOperation()
-aSession.abortOperation()
+aSession.forceLoadPlugin("SketchPlugin")
# DEBIAN 6.0 WORKAROUND FINISH
from SketchAPI import addSketch