ADD_SUBDIRECTORY (src/ModuleBase)
ADD_SUBDIRECTORY (src/PartSet)
ADD_SUBDIRECTORY (src/PartSetPlugin)
+ADD_SUBDIRECTORY (src/ConstructionPlugin)
ADD_SUBDIRECTORY (src/PyConsole)
ADD_SUBDIRECTORY (src/PyEvent)
ADD_SUBDIRECTORY (src/PyInterp)
)
SET(XML_RESOURCES
- plugin-PartSet.xml
plugins.xml
)
+++ /dev/null
-<plugin>
- <workbench id="Part">
- <group id="Operations">
- <feature id="Part" text="New part" tooltip="Creates a new part" icon=":pictures/part_ico.png"/>
- <feature id="duplicate" text="Duplicate" tooltip="Duplicate selected object" icon=":icons/duplicate.png"/>
- <feature id="remove" text="Remove" tooltip="Remove selected object" icon=":icons/remove.png"/>
- </group>
- </workbench>
- <workbench id="Construction">
- <group id="Basic">
- <feature id="Point" text="Point" tooltip="Create a new point" icon=":icons/point.png">
- <doublevalue id="x" label="X:" max="50" step="1.0" default="0" icon=":pictures/x_point.png" tooltip="Set X"/>
- <doublevalue id="y" label="Y:" min="x" default="1" icon=":pictures/y_point.png" tooltip="Set Y"/>
- <doublevalue id="z" label="Z:" min="-20" step="0.1" default="2" icon=":pictures/z_point.png" tooltip="Set Z"/>
- </feature>
- <feature id="Axis" text="Axis" tooltip="Create a new axis" icon=":icons/axis.png" keysequence=""/>
- <feature id="Plane" text="Plane" tooltip="Create a new plane" icon=":icons/plane.png" keysequence=""/>
- </group>
- </workbench>
-</plugin>
<plugins module="PartSet">
<plugin library="PartSetPlugin" configuration="plugin-PartSet.xml"/>
+ <plugin library="ConstructionPlugin" configuration="plugin-Construction.xml"/>
</plugins>
--- /dev/null
+INCLUDE(Common)
+
+SET(PROJECT_HEADERS
+ ConstructionPlugin.h
+ ConstructionPlugin_Plugin.h
+ ConstructionPlugin_Point.h
+)
+
+SET(PROJECT_SOURCES
+ ConstructionPlugin_Plugin.cxx
+ ConstructionPlugin_Point.cxx
+)
+
+ADD_DEFINITIONS(-DCONSTRUCTIONPLUGIN_EXPORTS ${BOOST_DEFINITIONS})
+ADD_LIBRARY(ConstructionPlugin SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS})
+TARGET_LINK_LIBRARIES(ConstructionPlugin ${PROJECT_LIBRARIES} ModelAPI)
+
+INCLUDE_DIRECTORIES(
+ ../ModelAPI
+)
+
+SET(XML_RESOURCES
+ plugin-Construction.xml
+)
+
+INSTALL(TARGETS ConstructionPlugin DESTINATION plugins)
+INSTALL(FILES ${XML_RESOURCES} DESTINATION plugins)
--- /dev/null
+#ifndef CONSTRUCTIONPLUGIN_H
+#define CONSTRUCTIONPLUGIN_H
+
+#if defined CONSTRUCTIONPLUGIN_EXPORTS
+#if defined WIN32
+#define CONSTRUCTIONPLUGIN_EXPORT __declspec( dllexport )
+#else
+#define CONSTRUCTIONPLUGIN_EXPORT
+#endif
+#else
+#if defined WIN32
+#define CONSTRUCTIONPLUGIN_EXPORT __declspec( dllimport )
+#else
+#define CONSTRUCTIONPLUGIN_EXPORT
+#endif
+#endif
+
+#endif
--- /dev/null
+#include "ConstructionPlugin_Plugin.h"
+#include "ConstructionPlugin_Point.h"
+#include <ModelAPI_PluginManager.h>
+#include <ModelAPI_Document.h>
+
+using namespace std;
+
+// the only created instance of this plugin
+static ConstructionPlugin_Plugin* MY_INSTANCE = new ConstructionPlugin_Plugin();
+
+ConstructionPlugin_Plugin::ConstructionPlugin_Plugin()
+{
+ // register this plugin
+ ModelAPI_PluginManager::get()->registerPlugin(this);
+}
+
+shared_ptr<ModelAPI_Feature> ConstructionPlugin_Plugin::createFeature(string theFeatureID)
+{
+ if (theFeatureID == "Point") {
+ return shared_ptr<ModelAPI_Feature>(new ConstructionPlugin_Point);
+ }
+ // feature of such kind is not found
+ return shared_ptr<ModelAPI_Feature>();
+}
--- /dev/null
+// File: ConstructionPlugin_Plugin.hxx
+// Created: 31 Mar 2014
+// Author: Mikhail PONIKAROV
+
+#ifndef ConstructionPlugin_Plugin_HeaderFile
+#define ConstructionPlugin_Plugin_HeaderFile
+
+
+#include "ConstructionPlugin.h"
+#include "ModelAPI_Plugin.h"
+
+class CONSTRUCTIONPLUGIN_EXPORT ConstructionPlugin_Plugin: public ModelAPI_Plugin
+{
+public:
+ /// Creates the feature object of this plugin by the feature string ID
+ virtual std::shared_ptr<ModelAPI_Feature> createFeature(std::string theFeatureID);
+
+public:
+ /// Is needed for python wrapping by swig
+ ConstructionPlugin_Plugin();
+};
+
+#endif
--- /dev/null
+// File: ConstructionPlugin_Point.cxx
+// Created: 27 Mar 2014
+// Author: Mikhail PONIKAROV
+
+#include "ConstructionPlugin_Point.h"
+#include "ModelAPI_PluginManager.h"
+#include "ModelAPI_Document.h"
+#include "ModelAPI_Data.h"
+#include "ModelAPI_AttributeDouble.h"
+
+using namespace std;
+
+ConstructionPlugin_Point::ConstructionPlugin_Point()
+{
+}
+
+void ConstructionPlugin_Point::initAttributes()
+{
+ data()->addAttribute(POINT_ATTR_X, ModelAPI_AttributeDouble::type());
+ data()->addAttribute(POINT_ATTR_Y, ModelAPI_AttributeDouble::type());
+ data()->addAttribute(POINT_ATTR_Z, ModelAPI_AttributeDouble::type());
+}
+
+// this is for debug only
+#include <iostream>
+void ConstructionPlugin_Point::execute()
+{
+ // TODO: create a real shape for the point using OCC layer
+ cout<<"X="<<data()->real(POINT_ATTR_X)->value()<<" Y="<<data()->real(POINT_ATTR_Y)->value()
+ <<" Z="<<data()->real(POINT_ATTR_Z)->value()<<endl;
+}
--- /dev/null
+// File: ConstructionPlugin_Point.h
+// Created: 3 Apr 2014
+// Author: Mikhail PONIKAROV
+
+#ifndef ConstructionPlugin_Point_HeaderFile
+#define ConstructionPlugin_Point_HeaderFile
+
+#include "ConstructionPlugin.h"
+#include <ModelAPI_Feature.h>
+
+/// attribute name for X coordinate
+const std::string POINT_ATTR_X = "x";
+/// attribute name for Y coordinate
+const std::string POINT_ATTR_Y = "y";
+/// attribute name for Z coordinate
+const std::string POINT_ATTR_Z = "z";
+
+/**\class ConstructionPlugin_Point
+ * \ingroup DataModel
+ * \brief Feature for creation of the new part in PartSet.
+ */
+class ConstructionPlugin_Point: public ModelAPI_Feature
+{
+public:
+ /// Returns the kind of a feature
+ CONSTRUCTIONPLUGIN_EXPORT virtual const std::string& getKind()
+ {static std::string MY_KIND = "Point"; return MY_KIND;}
+
+ /// Returns to which group in the document must be added feature
+ CONSTRUCTIONPLUGIN_EXPORT virtual const std::string& getGroup()
+ {static std::string MY_GROUP = "Construction"; return MY_GROUP;}
+
+ /// Creates a new part document if needed
+ CONSTRUCTIONPLUGIN_EXPORT virtual void execute();
+
+ /// Request for initialization of data model of the feature: adding all attributes
+ CONSTRUCTIONPLUGIN_EXPORT virtual void initAttributes();
+
+ /// Use plugin manager for features creation
+ ConstructionPlugin_Point();
+};
+
+#endif
--- /dev/null
+<plugin>
+ <workbench id="Construction">
+ <group id="Basic">
+ <feature id="Point" text="Point" tooltip="Create a new point" icon=":icons/point.png">
+ <doublevalue id="x" label="X:" max="50" step="1.0" default="0" icon=":pictures/x_point.png" tooltip="Set X"/>
+ <doublevalue id="y" label="Y:" min="x" default="1" icon=":pictures/y_point.png" tooltip="Set Y"/>
+ <doublevalue id="z" label="Z:" min="-20" step="0.1" default="2" icon=":pictures/z_point.png" tooltip="Set Z"/>
+ </feature>
+ <feature id="Axis" text="Axis" tooltip="Create a new axis" icon=":icons/axis.png" keysequence=""/>
+ <feature id="Plane" text="Plane" tooltip="Create a new plane" icon=":icons/plane.png" keysequence=""/>
+ </group>
+ </workbench>
+</plugin>
PartSetPlugin.h
PartSetPlugin_Plugin.h
PartSetPlugin_Part.h
- PartSetPlugin_Point.h
)
SET(PROJECT_SOURCES
PartSetPlugin_Plugin.cxx
PartSetPlugin_Part.cxx
- PartSetPlugin_Point.cxx
)
ADD_DEFINITIONS(-DPARTSETPLUGIN_EXPORTS ${BOOST_DEFINITIONS})
../ModelAPI
)
+SET(XML_RESOURCES
+ plugin-PartSet.xml
+)
+
INSTALL(TARGETS PartSetPlugin DESTINATION plugins)
+INSTALL(FILES ${XML_RESOURCES} DESTINATION plugins)
{
if (theFeatureID == "Part") {
return shared_ptr<ModelAPI_Feature>(new PartSetPlugin_Part);
- } else if (theFeatureID == "Point") {
- return shared_ptr<ModelAPI_Feature>(new PartSetPlugin_Point);
}
// feature of such kind is not found
return shared_ptr<ModelAPI_Feature>();
+++ /dev/null
-// File: PartSetPlugin_Point.cxx
-// Created: 27 Mar 2014
-// Author: Mikhail PONIKAROV
-
-#include "PartSetPlugin_Point.h"
-#include "ModelAPI_PluginManager.h"
-#include "ModelAPI_Document.h"
-#include "ModelAPI_Data.h"
-#include "ModelAPI_AttributeDouble.h"
-
-using namespace std;
-
-PartSetPlugin_Point::PartSetPlugin_Point()
-{
-}
-
-void PartSetPlugin_Point::initAttributes()
-{
- data()->addAttribute(POINT_ATTR_X, ModelAPI_AttributeDouble::type());
- data()->addAttribute(POINT_ATTR_Y, ModelAPI_AttributeDouble::type());
- data()->addAttribute(POINT_ATTR_Z, ModelAPI_AttributeDouble::type());
-}
-
-// this is for debug only
-#include <iostream>
-void PartSetPlugin_Point::execute()
-{
- // TODO: create a real shape for the point using OCC layer
- cout<<"X="<<data()->real(POINT_ATTR_X)->value()<<" Y="<<data()->real(POINT_ATTR_Y)->value()
- <<" Z="<<data()->real(POINT_ATTR_Z)->value()<<endl;
-}
+++ /dev/null
-// File: PartSetPlugin_Point.h
-// Created: 3 Apr 2014
-// Author: Mikhail PONIKAROV
-
-#ifndef PartSetPlugin_Point_HeaderFile
-#define PartSetPlugin_Point_HeaderFile
-
-#include "PartSetPlugin.h"
-#include <ModelAPI_Feature.h>
-
-/// attribute name for X coordinate
-const std::string POINT_ATTR_X = "x";
-/// attribute name for Y coordinate
-const std::string POINT_ATTR_Y = "y";
-/// attribute name for Z coordinate
-const std::string POINT_ATTR_Z = "z";
-
-/**\class PartSetPlugin_Point
- * \ingroup DataModel
- * \brief Feature for creation of the new part in PartSet.
- */
-class PartSetPlugin_Point: public ModelAPI_Feature
-{
-public:
- /// Returns the kind of a feature
- PARTSETPLUGIN_EXPORT virtual const std::string& getKind()
- {static std::string MY_KIND = "Point"; return MY_KIND;}
-
- /// Returns to which group in the document must be added feature
- PARTSETPLUGIN_EXPORT virtual const std::string& getGroup()
- {static std::string MY_GROUP = "Construction"; return MY_GROUP;}
-
- /// Creates a new part document if needed
- PARTSETPLUGIN_EXPORT virtual void execute();
-
- /// Request for initialization of data model of the feature: adding all attributes
- PARTSETPLUGIN_EXPORT virtual void initAttributes();
-
- /// Use plugin manager for features creation
- PartSetPlugin_Point();
-};
-
-#endif
--- /dev/null
+<plugin>
+ <workbench id="Part">
+ <group id="Operations">
+ <feature id="Part" text="New part" tooltip="Creates a new part" icon=":pictures/part_ico.png"/>
+ <feature id="duplicate" text="Duplicate" tooltip="Duplicate selected object" icon=":icons/duplicate.png"/>
+ <feature id="remove" text="Remove" tooltip="Remove selected object" icon=":icons/remove.png"/>
+ </group>
+ </workbench>
+</plugin>