ADD_SUBDIRECTORY (src/ConstructionAPI)
ADD_SUBDIRECTORY (src/ExchangeAPI)
ADD_SUBDIRECTORY (src/FeaturesAPI)
+ADD_SUBDIRECTORY (src/PartSetAPI)
ADD_SUBDIRECTORY (src/SketchAPI)
IF(${HAVE_SALOME})
return true; \
}
+//--------------------------------------------------------------------------------------
+#define INTERFACE_0(KIND) \
+ public: \
+ INTERFACE_COMMON(KIND) \
+ protected: \
+ START_INIT() \
+ END_INIT() \
+ public:
//--------------------------------------------------------------------------------------
#define INTERFACE_1(KIND, \
it->appendToList(theAttribute);
}
+//--------------------------------------------------------------------------------------
+void fillAttribute(const std::shared_ptr<ModelAPI_Object> & theValue,
+ const std::shared_ptr<ModelAPI_AttributeReference> & theAttribute)
+{
+ theAttribute->setValue(theValue);
+}
+
//--------------------------------------------------------------------------------------
void fillAttribute(const std::list<std::shared_ptr<ModelAPI_Object> > & theValue,
const std::shared_ptr<ModelAPI_AttributeRefList> & theAttribute)
void fillAttribute(const std::list<ModelHighAPI_RefAttr> & theValue,
const std::shared_ptr<ModelAPI_AttributeRefAttrList> & theAttribute);
+MODELHIGHAPI_EXPORT
+void fillAttribute(const std::shared_ptr<ModelAPI_Object> & theValue,
+ const std::shared_ptr<ModelAPI_AttributeReference> & theAttribute);
+
MODELHIGHAPI_EXPORT
void fillAttribute(const std::list<std::shared_ptr<ModelAPI_Object> > & theValue,
const std::shared_ptr<ModelAPI_AttributeRefList> & theAttribute);
--- /dev/null
+## Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+INCLUDE(Common)
+
+SET(PROJECT_HEADERS
+ PartSetAPI.h
+ PartSetAPI_Part.h
+)
+
+SET(PROJECT_SOURCES
+ PartSetAPI_Part.cpp
+)
+
+SET(PROJECT_LIBRARIES
+ ModelAPI
+ ModelHighAPI
+)
+
+INCLUDE_DIRECTORIES(
+ ${PROJECT_SOURCE_DIR}/src/Events
+ ${PROJECT_SOURCE_DIR}/src/ModelAPI
+ ${PROJECT_SOURCE_DIR}/src/ModelHighAPI
+)
+
+# Plugin headers dependency
+INCLUDE_DIRECTORIES(
+ # TODO(spo): modify PartSetPlugin headers to remove dependency on GeomAPI headers
+ ${PROJECT_SOURCE_DIR}/src/GeomAPI
+ # TODO(spo): it is for *_swig.h files. Can we eliminate it?
+ ${PROJECT_SOURCE_DIR}/src/GeomDataAPI
+ ${PROJECT_SOURCE_DIR}/src/PartSetPlugin
+)
+
+#TODO(spo): is ${CAS_DEFINITIONS} necessary?
+ADD_DEFINITIONS(-DCONSTRUCTIONAPI_EXPORTS ${CAS_DEFINITIONS})
+ADD_LIBRARY(PartSetAPI SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS})
+TARGET_LINK_LIBRARIES(PartSetAPI ${PROJECT_LIBRARIES})
+
+# SWIG wrapper
+
+INCLUDE(PythonAPI)
+
+SET_SOURCE_FILES_PROPERTIES(PartSetAPI.i PROPERTIES CPLUSPLUS ON)
+SET_SOURCE_FILES_PROPERTIES(PartSetAPI.i PROPERTIES SWIG_DEFINITIONS "-shadow")
+
+#TODO(spo): is ModelAPI necessary or it could be received by INTERFACE_ (may require modern CMake)?
+SET(SWIG_LINK_LIBRARIES
+ PartSetAPI
+ ModelHighAPI
+ ModelAPI
+ ${PYTHON_LIBRARIES}
+)
+
+SET(SWIG_MODULE_PartSetAPI_EXTRA_DEPS ${SWIG_MODULE_PartSetAPI_EXTRA_DEPS}
+ ${PROJECT_SOURCE_DIR}/src/ModelHighAPI/ModelHighAPI.i
+ doxyhelp.i
+ ${PROJECT_HEADERS}
+)
+
+SWIG_ADD_MODULE(PartSetAPI python PartSetAPI.i ${PROJECT_HEADERS})
+SWIG_LINK_LIBRARIES(PartSetAPI ${SWIG_LINK_LIBRARIES})
+
+IF(WIN32)
+ SET_TARGET_PROPERTIES(_PartSetAPI PROPERTIES DEBUG_OUTPUT_NAME _PartSetAPI_d)
+ENDIF(WIN32)
+
+INSTALL(TARGETS _PartSetAPI DESTINATION ${SHAPER_INSTALL_SWIG})
+INSTALL(TARGETS PartSetAPI DESTINATION ${SHAPER_INSTALL_BIN})
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/PartSetAPI.py DESTINATION ${SHAPER_INSTALL_SWIG})
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+#ifndef PARTSETAPI_H
+#define PARTSETAPI_H
+
+#if defined PARTSETAPI_EXPORTS
+#if defined WIN32
+#define PARTSETAPI_EXPORT __declspec( dllexport )
+#else
+#define PARTSETAPI_EXPORT
+#endif
+#else
+#if defined WIN32
+#define PARTSETAPI_EXPORT __declspec( dllimport )
+#else
+#define PARTSETAPI_EXPORT
+#endif
+#endif
+
+#endif
--- /dev/null
+/* PartSetAPI.i */
+
+%module PartSetAPI
+
+%{
+ #include "PartSetAPI_swig.h"
+%}
+
+%include "doxyhelp.i"
+
+// import other modules
+%import "ModelHighAPI.i"
+
+// to avoid error on this
+#define PARTSETAPI_EXPORT
+
+// standard definitions
+%include "typemaps.i"
+%include "std_shared_ptr.i"
+
+// shared pointers
+%shared_ptr(PartSetAPI_Part)
+
+// all supported interfaces
+%include "PartSetAPI_Part.h"
--- /dev/null
+// Name : PartSetAPI_Part.cpp
+// Purpose:
+//
+// History:
+// 16/06/16 - Sergey POKHODENKO - Creation of the file
+
+//--------------------------------------------------------------------------------------
+#include "PartSetAPI_Part.h"
+//--------------------------------------------------------------------------------------
+#include <ModelAPI_ResultPart.h>
+//--------------------------------------------------------------------------------------
+#include <PartSetPlugin_Duplicate.h>
+#include <PartSetPlugin_Remove.h>
+//--------------------------------------------------------------------------------------
+PartSetAPI_Part::PartSetAPI_Part(
+ const std::shared_ptr<ModelAPI_Feature> & theFeature)
+: ModelHighAPI_Interface(theFeature)
+{
+ initialize();
+}
+
+PartSetAPI_Part::~PartSetAPI_Part()
+{
+}
+
+//--------------------------------------------------------------------------------------
+std::shared_ptr<ModelAPI_Document> PartSetAPI_Part::document() const
+{
+ return std::dynamic_pointer_cast<ModelAPI_ResultPart>(defaultResult())->partDoc();
+}
+
+//--------------------------------------------------------------------------------------
+PartPtr addPart(const std::shared_ptr<ModelAPI_Document> & thePart)
+{
+ // TODO(spo): check that thePart is not empty
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(PartSetAPI_Part::ID());
+ aFeature->execute();
+ return PartPtr(new PartSetAPI_Part(aFeature));
+}
+
+PartPtr duplicatePart(const std::shared_ptr<ModelAPI_Document> & thePart)
+{
+ // TODO(spo): check that thePart is not empty
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(PartSetPlugin_Duplicate::ID());
+ aFeature->execute();
+ return PartPtr(new PartSetAPI_Part(aFeature));
+}
+
+void removePart(const std::shared_ptr<ModelAPI_Document> & thePart)
+{
+ // TODO(spo): check that thePart is not empty
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(PartSetPlugin_Remove::ID());
+ aFeature->execute();
+}
--- /dev/null
+// Name : PartSetAPI_Part.h
+// Purpose:
+//
+// History:
+// 16/06/16 - Sergey POKHODENKO - Creation of the file
+
+#ifndef SRC_PARTSETAPI_PARTSETAPI_PART_H_
+#define SRC_PARTSETAPI_PARTSETAPI_PART_H_
+
+//--------------------------------------------------------------------------------------
+#include "PartSetAPI.h"
+
+#include <PartSetPlugin_Part.h>
+
+#include <ModelHighAPI_Interface.h>
+#include <ModelHighAPI_Macro.h>
+//--------------------------------------------------------------------------------------
+class ModelAPI_Document;
+//--------------------------------------------------------------------------------------
+/**\class PartSetAPI_Part
+ * \ingroup CPPHighAPI
+ * \brief Interface for Part feature
+ */
+class PartSetAPI_Part : public ModelHighAPI_Interface
+{
+public:
+ /// Constructor without values
+ PARTSETAPI_EXPORT
+ explicit PartSetAPI_Part(const std::shared_ptr<ModelAPI_Feature> & theFeature);
+ /// Destructor
+ PARTSETAPI_EXPORT
+ virtual ~PartSetAPI_Part();
+
+ INTERFACE_0(PartSetPlugin_Part::ID())
+
+ /// Return document
+ PARTSETAPI_EXPORT
+ std::shared_ptr<ModelAPI_Document> document() const;
+};
+
+//! Pointer on Part object
+typedef std::shared_ptr<PartSetAPI_Part> PartPtr;
+
+/**\ingroup CPPHighAPI
+ * \brief Create Part feature
+ */
+PARTSETAPI_EXPORT
+PartPtr addPart(const std::shared_ptr<ModelAPI_Document> & thePartSet);
+
+/**\ingroup CPPHighAPI
+ * \brief Duplicate Part feature
+ */
+PARTSETAPI_EXPORT
+PartPtr duplicatePart(const std::shared_ptr<ModelAPI_Document> & thePart);
+
+/**\ingroup CPPHighAPI
+ * \brief Remove Part feature
+ */
+PARTSETAPI_EXPORT
+void removePart(const std::shared_ptr<ModelAPI_Document> & thePart);
+
+//--------------------------------------------------------------------------------------
+//--------------------------------------------------------------------------------------
+#endif /* SRC_PARTSETAPI_PARTSETAPI_PART_H_ */
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File: PartSetAPI_swig.h
+// Created: 16/06/16
+// Author: Sergey POKHODENKO
+
+#ifndef SRC_PARTSETAPI_PARTSETAPI_SWIG_H_
+#define SRC_PARTSETAPI_PARTSETAPI_SWIG_H_
+
+ #include <ModelHighAPI_swig.h>
+
+ #include "PartSetAPI_Part.h"
+
+#endif /* SRC_PARTSETAPI_PARTSETAPI_SWIG_H_ */
"""Package for PartSet plugin for the Parametric Geometry API of the Modeler.
"""
-from part import addPart, duplicatePart, removePart
\ No newline at end of file
+from PartSetAPI import addPart, duplicatePart, removePart
\ No newline at end of file