ADD_SUBDIRECTORY (src/ConstructionAPI)
ADD_SUBDIRECTORY (src/ExchangeAPI)
ADD_SUBDIRECTORY (src/FeaturesAPI)
+ADD_SUBDIRECTORY (src/ParametersAPI)
ADD_SUBDIRECTORY (src/PartSetAPI)
ADD_SUBDIRECTORY (src/SketchAPI)
--- /dev/null
+## Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+INCLUDE(Common)
+
+SET(PROJECT_HEADERS
+ ParametersAPI.h
+ ParametersAPI_Parameter.h
+)
+
+SET(PROJECT_SOURCES
+ ParametersAPI_Parameter.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 ParametersPlugin 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/ParametersPlugin
+)
+
+#TODO(spo): is ${CAS_DEFINITIONS} necessary?
+ADD_DEFINITIONS(-DCONSTRUCTIONAPI_EXPORTS ${CAS_DEFINITIONS})
+ADD_LIBRARY(ParametersAPI SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS})
+TARGET_LINK_LIBRARIES(ParametersAPI ${PROJECT_LIBRARIES})
+
+# SWIG wrapper
+
+INCLUDE(PythonAPI)
+
+SET_SOURCE_FILES_PROPERTIES(ParametersAPI.i PROPERTIES CPLUSPLUS ON)
+SET_SOURCE_FILES_PROPERTIES(ParametersAPI.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
+ ParametersAPI
+ ModelHighAPI
+ ModelAPI
+ ${PYTHON_LIBRARIES}
+)
+
+SET(SWIG_MODULE_ParametersAPI_EXTRA_DEPS ${SWIG_MODULE_ParametersAPI_EXTRA_DEPS}
+ ${PROJECT_SOURCE_DIR}/src/ModelHighAPI/ModelHighAPI.i
+ doxyhelp.i
+ ${PROJECT_HEADERS}
+)
+
+SWIG_ADD_MODULE(ParametersAPI python ParametersAPI.i ${PROJECT_HEADERS})
+SWIG_LINK_LIBRARIES(ParametersAPI ${SWIG_LINK_LIBRARIES})
+
+IF(WIN32)
+ SET_TARGET_PROPERTIES(_ParametersAPI PROPERTIES DEBUG_OUTPUT_NAME _ParametersAPI_d)
+ENDIF(WIN32)
+
+INSTALL(TARGETS _ParametersAPI DESTINATION ${SHAPER_INSTALL_SWIG})
+INSTALL(TARGETS ParametersAPI DESTINATION ${SHAPER_INSTALL_BIN})
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/ParametersAPI.py DESTINATION ${SHAPER_INSTALL_SWIG})
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+#ifndef PARAMETERSAPI_H
+#define PARAMETERSAPI_H
+
+#if defined PARAMETERSAPI_EXPORTS
+#if defined WIN32
+#define PARAMETERSAPI_EXPORT __declspec( dllexport )
+#else
+#define PARAMETERSAPI_EXPORT
+#endif
+#else
+#if defined WIN32
+#define PARAMETERSAPI_EXPORT __declspec( dllimport )
+#else
+#define PARAMETERSAPI_EXPORT
+#endif
+#endif
+
+#endif
--- /dev/null
+/* ParametersAPI.i */
+
+%module ParametersAPI
+
+%{
+ #include "ParametersAPI_swig.h"
+%}
+
+%include "doxyhelp.i"
+
+// import other modules
+%import "ModelHighAPI.i"
+
+// to avoid error on this
+#define PARAMETERSAPI_EXPORT
+
+// standard definitions
+%include "typemaps.i"
+%include "std_shared_ptr.i"
+
+// shared pointers
+%shared_ptr(ParametersAPI_Parameter)
+
+// all supported interfaces
+%include "ParametersAPI_Parameter.h"
--- /dev/null
+// Name : ParametersAPI_Parameter.cpp
+// Purpose:
+//
+// History:
+// 16/06/16 - Sergey POKHODENKO - Creation of the file
+
+//--------------------------------------------------------------------------------------
+#include "ParametersAPI_Parameter.h"
+//--------------------------------------------------------------------------------------
+#include <ModelHighAPI_Tools.h>
+//--------------------------------------------------------------------------------------
+ParametersAPI_Parameter::ParametersAPI_Parameter(
+ const std::shared_ptr<ModelAPI_Feature> & theFeature)
+: ModelHighAPI_Interface(theFeature)
+{
+ initialize();
+}
+
+ParametersAPI_Parameter::ParametersAPI_Parameter(
+ const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ const std::string & theName,
+ const ModelHighAPI_Double & theExpression)
+: ModelHighAPI_Interface(theFeature)
+{
+ if (initialize()) {
+ fillAttribute(theName, name());
+ fillAttribute(theExpression, expression());
+
+ execute();
+ }
+}
+
+ParametersAPI_Parameter::~ParametersAPI_Parameter()
+{
+}
+
+//--------------------------------------------------------------------------------------
+ParameterPtr addParameter(const std::shared_ptr<ModelAPI_Document> & theParameter,
+ const std::string & theName,
+ const ModelHighAPI_Double & theExpression)
+{
+ // TODO(spo): check that theParameter is not empty
+ std::shared_ptr<ModelAPI_Feature> aFeature = theParameter->addFeature(ParametersAPI_Parameter::ID());
+ return ParameterPtr(new ParametersAPI_Parameter(aFeature));
+}
--- /dev/null
+// Name : ParametersAPI_Parameter.h
+// Purpose:
+//
+// History:
+// 16/06/16 - Sergey POKHODENKO - Creation of the file
+
+#ifndef SRC_PARAMETERSAPI_PARAMETERSAPI_PARAMETER_H_
+#define SRC_PARAMETERSAPI_PARAMETERSAPI_PARAMETER_H_
+
+//--------------------------------------------------------------------------------------
+#include "ParametersAPI.h"
+
+#include <ParametersPlugin_Parameter.h>
+
+#include <ModelHighAPI_Interface.h>
+#include <ModelHighAPI_Macro.h>
+//--------------------------------------------------------------------------------------
+class ModelHighAPI_Double;
+//--------------------------------------------------------------------------------------
+/**\class ParametersAPI_Parameter
+ * \ingroup CPPHighAPI
+ * \brief Interface for Parameter feature
+ */
+class ParametersAPI_Parameter : public ModelHighAPI_Interface
+{
+public:
+ /// Constructor without values
+ PARAMETERSAPI_EXPORT
+ explicit ParametersAPI_Parameter(const std::shared_ptr<ModelAPI_Feature> & theFeature);
+ /// Constructor with values
+ PARAMETERSAPI_EXPORT
+ explicit ParametersAPI_Parameter(const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ const std::string & theName,
+ const ModelHighAPI_Double & theExpression);
+ /// Destructor
+ PARAMETERSAPI_EXPORT
+ virtual ~ParametersAPI_Parameter();
+
+ INTERFACE_2(ParametersPlugin_Parameter::ID(),
+ name, ParametersPlugin_Parameter::VARIABLE_ID(), ModelAPI_AttributeString, /** Name */,
+ expression, ParametersPlugin_Parameter::EXPRESSION_ID(), ModelAPI_AttributeDouble, /** Expression */
+ )
+
+};
+
+//! Pointer on Parameter object
+typedef std::shared_ptr<ParametersAPI_Parameter> ParameterPtr;
+
+/**\ingroup CPPHighAPI
+ * \brief Create Parameter feature
+ */
+PARAMETERSAPI_EXPORT
+ParameterPtr addParameter(const std::shared_ptr<ModelAPI_Document> & thePart,
+ const std::string & theName,
+ const ModelHighAPI_Double & theExpression);
+
+//--------------------------------------------------------------------------------------
+//--------------------------------------------------------------------------------------
+#endif /* SRC_PARAMETERSAPI_PARAMETERSAPI_PARAMETER_H_ */
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File: ParametersAPI_swig.h
+// Created: 16/06/16
+// Author: Sergey POKHODENKO
+
+#ifndef SRC_PARAMETERSAPI_PARAMETERSAPI_SWIG_H_
+#define SRC_PARAMETERSAPI_PARAMETERSAPI_SWIG_H_
+
+ #include <ModelHighAPI_swig.h>
+
+ #include "ParametersAPI_Parameter.h"
+
+#endif /* SRC_PARAMETERSAPI_PARAMETERSAPI_SWIG_H_ */
FeaturesAPI.FeaturesAPI_Translation(self.part.addFeature("Translation"))
FeaturesAPI.FeaturesAPI_Group(self.part.addFeature("Group"))
- model.parameter.Parameter(self.part.addFeature("Parameter"))
+ import ParametersAPI
+ ParametersAPI.ParametersAPI_Parameter(self.part.addFeature("Parameter"))
#-----------------------------------------------------------------------------
"""Package for Parameter plugin for the Parametric Geometry API of the Modeler.
"""
-from parameter import addParameter
\ No newline at end of file
+from ParametersAPI import addParameter
\ No newline at end of file