// shared pointers
%shared_ptr(BuildAPI_Edge)
%shared_ptr(BuildAPI_Vertex)
+%shared_ptr(BuildAPI_Wire)
// all supported interfaces
%include "BuildAPI_Edge.h"
%include "BuildAPI_Vertex.h"
+%include "BuildAPI_Wire.h"
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: BuildAPI_Wire.cpp
+// Created: 09 June 2016
+// Author: Dmitry Bobylev
+
+#include "BuildAPI_Wire.h"
+
+#include <ModelHighAPI_Tools.h>
+
+//==================================================================================================
+BuildAPI_Wire::BuildAPI_Wire(const std::shared_ptr<ModelAPI_Feature>& theFeature)
+: ModelHighAPI_Interface(theFeature)
+{
+ initialize();
+}
+
+//==================================================================================================
+BuildAPI_Wire::BuildAPI_Wire(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects)
+: ModelHighAPI_Interface(theFeature)
+{
+ if(initialize()) {
+ setBase(theBaseObjects);
+ }
+}
+
+//==================================================================================================
+BuildAPI_Wire::~BuildAPI_Wire()
+{
+
+}
+
+//==================================================================================================
+void BuildAPI_Wire::setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects)
+{
+ fillAttribute(theBaseObjects, mybaseObjects);
+
+ execute();
+}
+
+//==================================================================================================
+void BuildAPI_Wire::addContour()
+{
+ feature()->customAction(BuildPlugin_Wire::ADD_CONTOUR_ACTION_ID());
+}
+
+// TODO(spo): make add* as static functions of the class
+//==================================================================================================
+WirePtr addWire(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(BuildAPI_Wire::ID());
+ return WirePtr(new BuildAPI_Wire(aFeature, theBaseObjects));
+}
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: BuildAPI_Wire.h
+// Created: 09 June 2016
+// Author: Dmitry Bobylev
+
+#ifndef BuildAPI_Wire_H_
+#define BuildAPI_Wire_H_
+
+#include "BuildAPI.h"
+
+#include <BuildPlugin_Wire.h>
+
+#include <ModelHighAPI_Interface.h>
+#include <ModelHighAPI_Macro.h>
+
+class ModelHighAPI_Selection;
+
+/// \class BuildAPI_Wire
+/// \ingroup CPPHighAPI
+/// \brief Interface for Wire feature.
+class BuildAPI_Wire: public ModelHighAPI_Interface
+{
+public:
+ /// Constructor without values.
+ BUILDAPI_EXPORT
+ explicit BuildAPI_Wire(const std::shared_ptr<ModelAPI_Feature>& theFeature);
+
+ /// Constructor with values.
+ BUILDAPI_EXPORT
+ explicit BuildAPI_Wire(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects);
+
+ /// Destructor.
+ BUILDAPI_EXPORT
+ virtual ~BuildAPI_Wire();
+
+ INTERFACE_1(BuildPlugin_Wire::ID(),
+ baseObjects, BuildPlugin_Wire::BASE_OBJECTS_ID(), ModelAPI_AttributeSelectionList, /** Base objects */)
+
+ /// Modify base attribute of the feature.
+ BUILDAPI_EXPORT
+ void setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects);
+
+ /// Adds closed contour.
+ BUILDAPI_EXPORT
+ void addContour();
+};
+
+/// Pointer on Wire object.
+typedef std::shared_ptr<BuildAPI_Wire> WirePtr;
+
+/// \ingroup CPPHighAPI
+/// \brief Create Wire feature.
+BUILDAPI_EXPORT
+WirePtr addWire(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects);
+
+#endif // BuildAPI_Wire_H_
#include "BuildAPI_Edge.h"
#include "BuildAPI_Vertex.h"
+ #include "BuildAPI_Wire.h"
#endif // FeaturesAPI_swig_H_
BuildAPI.h
BuildAPI_Edge.h
BuildAPI_Vertex.h
+ BuildAPI_Wire.h
)
SET(PROJECT_SOURCES
BuildAPI_Edge.cpp
BuildAPI_Vertex.cpp
+ BuildAPI_Wire.cpp
)
SET(PROJECT_LIBRARIES
//=================================================================================================
bool BuildPlugin_Wire::customAction(const std::string& theActionId)
{
- if(theActionId == "add_contour") {
+ if(theActionId == ADD_CONTOUR_ACTION_ID()) {
return addContour();
} else {
std::string aMsg = "Error: Feature \"%1\" does not support action \"%2\".";
return MY_BASE_OBJECTS_ID;
}
+ /// Attribute name of base objects.
+ inline static const std::string& ADD_CONTOUR_ACTION_ID()
+ {
+ static const std::string MY_ADD_CONTOUR_ACTION_ID("add_contour");
+ return MY_ADD_CONTOUR_ACTION_ID;
+ }
+
/// \return the kind of a feature.
BUILDPLUGIN_EXPORT virtual const std::string& getKind()
{