ADD_SUBDIRECTORY (src/GeomDataAPI)
ADD_SUBDIRECTORY (src/PartSetPlugin)
ADD_SUBDIRECTORY (src/ConstructionPlugin)
+ADD_SUBDIRECTORY (src/FeaturesPlugin)
ADD_SUBDIRECTORY (src/SketchPlugin)
ADD_SUBDIRECTORY (src/SketchSolver)
ADD_SUBDIRECTORY (src/ModuleBase)
<plugin library="PartSetPlugin" configuration="plugin-PartSet.xml"/>
<plugin library="SketchPlugin" configuration="plugin-Sketch.xml"/>
<plugin library="ConstructionPlugin" configuration="plugin-Construction.xml"/>
+ <plugin library="FeaturesPlugin" configuration="plugin-Features.xml"/>
<plugin library="SketchSolver"/>
<plugin library="DFBrowser"/>
</plugins>
ConstructionPlugin.h
ConstructionPlugin_Plugin.h
ConstructionPlugin_Point.h
- ConstructionPlugin_Extrusion.h
)
SET(PROJECT_SOURCES
ConstructionPlugin_Plugin.cpp
ConstructionPlugin_Point.cpp
- ConstructionPlugin_Extrusion.cpp
)
ADD_DEFINITIONS(-DCONSTRUCTIONPLUGIN_EXPORTS ${BOOST_DEFINITIONS})
SET(XML_RESOURCES
plugin-Construction.xml
point_widget.xml
- extrusion_widget.xml
)
INSTALL(TARGETS ConstructionPlugin DESTINATION plugins)
+++ /dev/null
-// File: ConstructionPlugin_Extrusion.cpp
-// Created: 30 May 2014
-// Author: Vitaly SMETANNIKOV
-
-#include "ConstructionPlugin_Extrusion.h"
-#include <ModelAPI_PluginManager.h>
-#include <ModelAPI_Document.h>
-#include <ModelAPI_Data.h>
-#include <ModelAPI_AttributeDouble.h>
-#include <ModelAPI_AttributeReference.h>
-#include <ModelAPI_AttributeBoolean.h>
-
-#include <GeomAlgoAPI_Extrusion.h>
-
-using namespace std;
-
-ConstructionPlugin_Extrusion::ConstructionPlugin_Extrusion()
-{
-}
-
-void ConstructionPlugin_Extrusion::initAttributes()
-{
- data()->addAttribute(EXTRUSION_FACE, ModelAPI_AttributeReference::type());
- data()->addAttribute(EXTRUSION_SIZE, ModelAPI_AttributeDouble::type());
- data()->addAttribute(EXTRUSION_REVERSE, ModelAPI_AttributeBoolean::type());
-}
-
-void ConstructionPlugin_Extrusion::execute()
-{
- boost::shared_ptr<ModelAPI_AttributeReference> aFaceRef =
- boost::dynamic_pointer_cast<ModelAPI_AttributeReference>(data()->attribute(EXTRUSION_FACE));
- if (!aFaceRef)
- return;
- FeaturePtr aFaceFeature = aFaceRef->value();
- if (!aFaceFeature)
- return;
- boost::shared_ptr<GeomAPI_Shape> aFace = aFaceFeature->data()->shape();
- if (!aFace)
- return;
-
- double aSize = data()->real(EXTRUSION_SIZE)->value();
- if (data()->boolean(EXTRUSION_REVERSE)->value())
- aSize = -aSize;
- data()->store(GeomAlgoAPI_Extrusion::makeExtrusion(aFace, aSize));
-}
+++ /dev/null
-// File: ConstructionPlugin_Extrusion.h
-// Created: 30 May 2014
-// Author: Vitaly SMETANNIKOV
-
-#ifndef ConstructionPlugin_Extrusion_HeaderFile
-#define ConstructionPlugin_Extrusion_HeaderFile
-
-#include "ConstructionPlugin.h"
-#include <ModelAPI_Feature.h>
-
-/// Extrusion kind
-const std::string CONSTRUCTION_EXTRUSION_KIND("Extrusion");
-
-/// attribute name of referenced face
-const std::string EXTRUSION_FACE = "extrusion_face";
-
-/// attribute name of extrusion size
-const std::string EXTRUSION_SIZE = "extrusion_size";
-
-/// attribute name of reverce direction
-const std::string EXTRUSION_REVERSE = "extrusion_reverse";
-
-
-class ConstructionPlugin_Extrusion: public ModelAPI_Feature
-{
-public:
- /// Returns the kind of a feature
- CONSTRUCTIONPLUGIN_EXPORT virtual const std::string& getKind()
- { static std::string MY_KIND = CONSTRUCTION_EXTRUSION_KIND; 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_Extrusion();
-};
-
-#endif
#include "ConstructionPlugin_Plugin.h"
#include "ConstructionPlugin_Point.h"
-#include "ConstructionPlugin_Extrusion.h"
#include <ModelAPI_PluginManager.h>
#include <ModelAPI_Document.h>
{
if (theFeatureID == CONSTRUCTION_POINT_KIND) {
return FeaturePtr(new ConstructionPlugin_Point);
- } else if (theFeatureID == CONSTRUCTION_EXTRUSION_KIND) {
- return FeaturePtr(new ConstructionPlugin_Extrusion);
}
// feature of such kind is not found
return FeaturePtr();
+++ /dev/null
-<source>
- <selector id="extrusion_face"
- label="Select a face"
- icon=":icons/sketch.png"
- tooltip="Select a face for extrusion"
- activate="true"
- shape_types="face"
- />
- <doublevalue id="extrusion_size" label="Size" min="0" step="1.0" default="10" icon=":icons/dimension_v.png" tooltip="Set size of extrusion"/>
- <boolvalue id="extrusion_reverse" label="Reverse" default="false" tooltip="Reverse default direction"/>
-</source>
</feature>
<feature id="Axis" title="Axis" tooltip="Create a new axis" icon=":icons/axis.png" keysequence="" internal="true"/>
<feature id="Plane" title="Plane" tooltip="Create a new plane" icon=":icons/plane.png" keysequence="" internal="true"/>
- <feature id="Extrusion" title="Extrusion" tooltip="Create a shape by extrusion of a contour" icon=":icons/extrusion.png">
- <source path="extrusion_widget.xml"/>
- </feature>
</group>
</workbench>
</plugin>
--- /dev/null
+INCLUDE(Common)
+
+SET(PROJECT_HEADERS
+ FeaturesPlugin.h
+ FeaturesPlugin_Plugin.h
+ FeaturesPlugin_Extrusion.h
+)
+
+SET(PROJECT_SOURCES
+ FeaturesPlugin_Plugin.cpp
+ FeaturesPlugin_Extrusion.cpp
+)
+
+ADD_DEFINITIONS(-DFEATURESPLUGIN_EXPORTS ${BOOST_DEFINITIONS})
+ADD_LIBRARY(FeaturesPlugin SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS})
+TARGET_LINK_LIBRARIES(FeaturesPlugin ${PROJECT_LIBRARIES} ModelAPI GeomAPI GeomAlgoAPI)
+
+INCLUDE_DIRECTORIES(
+ ../ModelAPI
+ ../GeomAPI
+ ../GeomAlgoAPI
+)
+
+SET(XML_RESOURCES
+ plugin-Features.xml
+ extrusion_widget.xml
+)
+
+INSTALL(TARGETS FeaturesPlugin DESTINATION plugins)
+INSTALL(FILES ${XML_RESOURCES} DESTINATION plugins)
--- /dev/null
+#ifndef FEATURESPLUGIN_H
+#define FEATURESPLUGIN_H
+
+#if defined FEATURESPLUGIN_EXPORTS
+#if defined WIN32
+#define FEATURESPLUGIN_EXPORT __declspec( dllexport )
+#else
+#define FEATURESPLUGIN_EXPORT
+#endif
+#else
+#if defined WIN32
+#define FEATURESPLUGIN_EXPORT __declspec( dllimport )
+#else
+#define FEATURESPLUGIN_EXPORT
+#endif
+#endif
+
+#endif
--- /dev/null
+// File: FeaturesPlugin_Extrusion.cpp
+// Created: 30 May 2014
+// Author: Vitaly SMETANNIKOV
+
+#include "FeaturesPlugin_Extrusion.h"
+#include <ModelAPI_PluginManager.h>
+#include <ModelAPI_Document.h>
+#include <ModelAPI_Data.h>
+#include <ModelAPI_AttributeDouble.h>
+#include <ModelAPI_AttributeReference.h>
+#include <ModelAPI_AttributeBoolean.h>
+
+#include <GeomAlgoAPI_Extrusion.h>
+
+using namespace std;
+
+FeaturesPlugin_Extrusion::FeaturesPlugin_Extrusion()
+{
+}
+
+void FeaturesPlugin_Extrusion::initAttributes()
+{
+ data()->addAttribute(EXTRUSION_FACE, ModelAPI_AttributeReference::type());
+ data()->addAttribute(EXTRUSION_SIZE, ModelAPI_AttributeDouble::type());
+ data()->addAttribute(EXTRUSION_REVERSE, ModelAPI_AttributeBoolean::type());
+}
+
+void FeaturesPlugin_Extrusion::execute()
+{
+ boost::shared_ptr<ModelAPI_AttributeReference> aFaceRef =
+ boost::dynamic_pointer_cast<ModelAPI_AttributeReference>(data()->attribute(EXTRUSION_FACE));
+ if (!aFaceRef)
+ return;
+ FeaturePtr aFaceFeature = aFaceRef->value();
+ if (!aFaceFeature)
+ return;
+ boost::shared_ptr<GeomAPI_Shape> aFace = aFaceFeature->data()->shape();
+ if (!aFace)
+ return;
+
+ double aSize = data()->real(EXTRUSION_SIZE)->value();
+ if (data()->boolean(EXTRUSION_REVERSE)->value())
+ aSize = -aSize;
+ data()->store(GeomAlgoAPI_Extrusion::makeExtrusion(aFace, aSize));
+}
--- /dev/null
+// File: FeaturesPlugin_Extrusion.h
+// Created: 30 May 2014
+// Author: Vitaly SMETANNIKOV
+
+#ifndef FeaturesPlugin_Extrusion_HeaderFile
+#define FeaturesPlugin_Extrusion_HeaderFile
+
+#include "FeaturesPlugin.h"
+#include <ModelAPI_Feature.h>
+
+/// Extrusion kind
+const std::string FEATURES_EXTRUSION_KIND("Extrusion");
+
+/// attribute name of referenced face
+const std::string EXTRUSION_FACE = "extrusion_face";
+
+/// attribute name of extrusion size
+const std::string EXTRUSION_SIZE = "extrusion_size";
+
+/// attribute name of reverse direction
+const std::string EXTRUSION_REVERSE = "extrusion_reverse";
+
+
+class FeaturesPlugin_Extrusion: public ModelAPI_Feature
+{
+public:
+ /// Returns the kind of a feature
+ FEATURESPLUGIN_EXPORT virtual const std::string& getKind()
+ { static std::string MY_KIND = FEATURES_EXTRUSION_KIND; return MY_KIND; }
+
+ /// Returns to which group in the document must be added feature
+ FEATURESPLUGIN_EXPORT virtual const std::string& getGroup()
+ { static std::string MY_GROUP = "Construction"; return MY_GROUP; }
+
+ /// Creates a new part document if needed
+ FEATURESPLUGIN_EXPORT virtual void execute();
+
+ /// Request for initialization of data model of the feature: adding all attributes
+ FEATURESPLUGIN_EXPORT virtual void initAttributes();
+
+ /// Use plugin manager for features creation
+ FeaturesPlugin_Extrusion();
+};
+
+#endif
--- /dev/null
+#include "FeaturesPlugin_Plugin.h"
+#include "FeaturesPlugin_Extrusion.h"
+
+#include <ModelAPI_PluginManager.h>
+#include <ModelAPI_Document.h>
+
+using namespace std;
+
+// the only created instance of this plugin
+static FeaturesPlugin_Plugin* MY_INSTANCE = new FeaturesPlugin_Plugin();
+
+FeaturesPlugin_Plugin::FeaturesPlugin_Plugin()
+{
+ // register this plugin
+ ModelAPI_PluginManager::get()->registerPlugin(this);
+}
+
+FeaturePtr FeaturesPlugin_Plugin::createFeature(string theFeatureID)
+{
+ if (theFeatureID == FEATURES_EXTRUSION_KIND) {
+ return FeaturePtr(new FeaturesPlugin_Extrusion);
+ }
+ // feature of such kind is not found
+ return FeaturePtr();
+}
--- /dev/null
+// File: FeaturesPlugin_Plugin.hxx
+// Created: 07 July 2014
+// Author: Vitaly SMETANNIKOV
+
+#ifndef FeaturesPlugin_Plugin_HeaderFile
+#define FeaturesPlugin_Plugin_HeaderFile
+
+
+#include "FeaturesPlugin.h"
+#include <ModelAPI_Plugin.h>
+#include <ModelAPI_Feature.h>
+
+class FEATURESPLUGIN_EXPORT FeaturesPlugin_Plugin: public ModelAPI_Plugin
+{
+public:
+ /// Creates the feature object of this plugin by the feature string ID
+ virtual FeaturePtr createFeature(std::string theFeatureID);
+
+public:
+ /// Is needed for python wrapping by swig
+ FeaturesPlugin_Plugin();
+};
+
+#endif
--- /dev/null
+<source>
+ <selector id="extrusion_face"
+ label="Select a face"
+ icon=":icons/sketch.png"
+ tooltip="Select a face for extrusion"
+ activate="true"
+ shape_types="face"
+ />
+ <doublevalue id="extrusion_size" label="Size" min="0" step="1.0" default="10" icon=":icons/dimension_v.png" tooltip="Set size of extrusion"/>
+ <boolvalue id="extrusion_reverse" label="Reverse" default="false" tooltip="Reverse default direction"/>
+</source>
--- /dev/null
+<plugin>
+ <workbench id="Features">
+ <group id="Basic">
+ <feature id="Extrusion" title="Extrusion" tooltip="Create a shape by extrusion of a contour" icon=":icons/extrusion.png">
+ <source path="extrusion_widget.xml"/>
+ </feature>
+ </group>
+</workbench>
+</plugin>