]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
CPP API for FeaturesPlugin_Extrusion
authordbv <dbv@opencascade.com>
Thu, 9 Jun 2016 12:58:00 +0000 (15:58 +0300)
committerspo <sergey.pokhodenko@opencascade.com>
Fri, 17 Jun 2016 11:41:06 +0000 (14:41 +0300)
src/FeaturesAPI/CMakeLists.txt
src/FeaturesAPI/FeaturesAPI.i
src/FeaturesAPI/FeaturesAPI_Extrusion.cpp [new file with mode: 0644]
src/FeaturesAPI/FeaturesAPI_Extrusion.h [new file with mode: 0644]
src/FeaturesAPI/FeaturesAPI_Group.h
src/FeaturesAPI/FeaturesAPI_swig.h
src/ModelHighAPI/ModelHighAPI_Macro.h
src/PythonAPI/Test/TestFeatures.py
src/PythonAPI/Test/TestFeaturesExtrusion.py
src/PythonAPI/model/features/__init__.py

index 440b777d8fd4b31cb182751cefaaef08cb63eca9..0809f3fe6bd4f0f281a0fbc303e006cfc75efac4 100644 (file)
@@ -5,6 +5,7 @@ INCLUDE(Common)
 SET(PROJECT_HEADERS
   FeaturesAPI.h
   FeaturesAPI_Boolean.h
+  FeaturesAPI_Extrusion.h
   FeaturesAPI_Group.h
   FeaturesAPI_Placement.h
   FeaturesAPI_Rotation.h
@@ -13,6 +14,7 @@ SET(PROJECT_HEADERS
 
 SET(PROJECT_SOURCES
   FeaturesAPI_Boolean.cpp
+  FeaturesAPI_Extrusion.cpp
   FeaturesAPI_Group.cpp
   FeaturesAPI_Placement.cpp
   FeaturesAPI_Rotation.cpp
index 52c73c7309a5b0d781319534bf4f371148396aa5..7801850d12356acbdacb38e6544c8fbf6acf91d2 100644 (file)
@@ -20,6 +20,7 @@
 
 // shared pointers
 %shared_ptr(FeaturesAPI_Boolean)
+%shared_ptr(FeaturesAPI_Extrusion)
 %shared_ptr(FeaturesAPI_Group)
 %shared_ptr(FeaturesAPI_Placement)
 %shared_ptr(FeaturesAPI_Rotation)
@@ -27,6 +28,7 @@
 
 // all supported interfaces
 %include "FeaturesAPI_Boolean.h"
+%include "FeaturesAPI_Extrusion.h"
 %include "FeaturesAPI_Group.h"
 %include "FeaturesAPI_Placement.h"
 %include "FeaturesAPI_Rotation.h"
diff --git a/src/FeaturesAPI/FeaturesAPI_Extrusion.cpp b/src/FeaturesAPI/FeaturesAPI_Extrusion.cpp
new file mode 100644 (file)
index 0000000..da6f0cf
--- /dev/null
@@ -0,0 +1,242 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File:        FeaturesAPI_Extrusion.cpp
+// Created:     09 June 2016
+// Author:      Dmitry Bobylev
+
+#include "FeaturesAPI_Extrusion.h"
+
+#include <ModelHighAPI_Double.h>
+#include <ModelHighAPI_Tools.h>
+
+//==================================================================================================
+FeaturesAPI_Extrusion::FeaturesAPI_Extrusion(const std::shared_ptr<ModelAPI_Feature>& theFeature)
+: ModelHighAPI_Interface(theFeature)
+{
+  initialize();
+}
+
+//==================================================================================================
+FeaturesAPI_Extrusion::FeaturesAPI_Extrusion(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+                                             const std::list<ModelHighAPI_Selection>& theBaseObjects,
+                                             const ModelHighAPI_Double& theSize)
+: ModelHighAPI_Interface(theFeature)
+{
+  if(initialize()) {
+    setBase(theBaseObjects);
+    setSize(theSize);
+  }
+}
+
+//==================================================================================================
+FeaturesAPI_Extrusion::FeaturesAPI_Extrusion(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+                                             const std::list<ModelHighAPI_Selection>& theBaseObjects,
+                                             const ModelHighAPI_Selection& theDirection,
+                                             const ModelHighAPI_Double& theSize)
+: ModelHighAPI_Interface(theFeature)
+{
+  if(initialize()) {
+    setBase(theBaseObjects);
+    setDirection(theDirection);
+    setSize(theSize);
+  }
+}
+
+//==================================================================================================
+FeaturesAPI_Extrusion::FeaturesAPI_Extrusion(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+                                             const std::list<ModelHighAPI_Selection>& theBaseObjects,
+                                             const ModelHighAPI_Double& theToSize,
+                                             const ModelHighAPI_Double& theFromSize)
+: ModelHighAPI_Interface(theFeature)
+{
+  if(initialize()) {
+    setBase(theBaseObjects);
+    setSizes(theToSize, theFromSize);
+  }
+}
+
+//==================================================================================================
+FeaturesAPI_Extrusion::FeaturesAPI_Extrusion(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+                                             const std::list<ModelHighAPI_Selection>& theBaseObjects,
+                                             const ModelHighAPI_Selection& theDirection,
+                                             const ModelHighAPI_Double& theToSize,
+                                             const ModelHighAPI_Double& theFromSize)
+: ModelHighAPI_Interface(theFeature)
+{
+  if(initialize()) {
+    setBase(theBaseObjects);
+    setDirection(theDirection);
+    setSizes(theToSize, theFromSize);
+  }
+}
+
+//==================================================================================================
+FeaturesAPI_Extrusion::FeaturesAPI_Extrusion(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+                                             const std::list<ModelHighAPI_Selection>& theBaseObjects,
+                                             const ModelHighAPI_Selection& theToObject,
+                                             const ModelHighAPI_Double& theToOffset,
+                                             const ModelHighAPI_Selection& theFromObject,
+                                             const ModelHighAPI_Double& theFromOffset)
+: ModelHighAPI_Interface(theFeature)
+{
+  if(initialize()) {
+    setBase(theBaseObjects);
+    setPlanesAndOffsets(theToObject, theToOffset, theFromObject, theFromOffset);
+  }
+}
+
+//==================================================================================================
+FeaturesAPI_Extrusion::FeaturesAPI_Extrusion(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+                                             const std::list<ModelHighAPI_Selection>& theBaseObjects,
+                                             const ModelHighAPI_Selection& theDirection,
+                                             const ModelHighAPI_Selection& theToObject,
+                                             const ModelHighAPI_Double& theToOffset,
+                                             const ModelHighAPI_Selection& theFromObject,
+                                             const ModelHighAPI_Double& theFromOffset)
+: ModelHighAPI_Interface(theFeature)
+{
+  if(initialize()) {
+    setBase(theBaseObjects);
+    setDirection(theDirection);
+    setPlanesAndOffsets(theToObject, theToOffset, theFromObject, theFromOffset);
+  }
+}
+
+//==================================================================================================
+FeaturesAPI_Extrusion::~FeaturesAPI_Extrusion()
+{
+
+}
+
+//==================================================================================================
+void FeaturesAPI_Extrusion::setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects)
+{
+  fillAttribute(theBaseObjects, mybaseObjects);
+
+  execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_Extrusion::setDirection(const ModelHighAPI_Selection& theDirection)
+{
+  fillAttribute(theDirection, mydirection);
+
+  execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_Extrusion::setSizes(const ModelHighAPI_Double& theToSize,
+                                     const ModelHighAPI_Double& theFromSize)
+{
+  fillAttribute("BySizes", mycreationMethod);
+  fillAttribute(theToSize, mytoSize);
+  fillAttribute(theFromSize, myfromSize);
+
+  execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_Extrusion::setSize(const ModelHighAPI_Double& theSize)
+{
+  fillAttribute("BySizes", mycreationMethod);
+  fillAttribute(theSize, mytoSize);
+  fillAttribute(ModelHighAPI_Double(), myfromSize);
+
+  execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_Extrusion::setPlanesAndOffsets(const ModelHighAPI_Selection& theToObject,
+                                                const ModelHighAPI_Double& theToOffset,
+                                                const ModelHighAPI_Selection& theFromObject,
+                                                const ModelHighAPI_Double& theFromOffset)
+{
+  fillAttribute("ByPlanesAndOffsets", mycreationMethod);
+  fillAttribute(theToObject, mytoObject);
+  fillAttribute(theToOffset, mytoOffset);
+  fillAttribute(theFromObject, myfromObject);
+  fillAttribute(theFromOffset, myfromOffset);
+
+  execute();
+}
+
+// TODO(spo): make add* as static functions of the class
+//==================================================================================================
+ExtrusionPtr addExtrusion(const std::shared_ptr<ModelAPI_Document>& thePart,
+                          const std::list<ModelHighAPI_Selection>& theBaseObjects,
+                          const ModelHighAPI_Double& theSize)
+{
+  std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Extrusion::ID());
+  return ExtrusionPtr(new FeaturesAPI_Extrusion(aFeature, theBaseObjects, theSize));
+}
+
+//==================================================================================================
+ExtrusionPtr addExtrusion(const std::shared_ptr<ModelAPI_Document>& thePart,
+                          const std::list<ModelHighAPI_Selection>& theBaseObjects,
+                          const ModelHighAPI_Selection& theDirection,
+                          const ModelHighAPI_Double& theSize)
+{
+  std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Extrusion::ID());
+  return ExtrusionPtr(new FeaturesAPI_Extrusion(aFeature, theBaseObjects, theDirection, theSize));
+}
+
+//==================================================================================================
+ExtrusionPtr addExtrusion(const std::shared_ptr<ModelAPI_Document>& thePart,
+                          const std::list<ModelHighAPI_Selection>& theBaseObjects,
+                          const ModelHighAPI_Double& theToSize,
+                          const ModelHighAPI_Double& theFromSize)
+{
+  std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Extrusion::ID());
+  return ExtrusionPtr(new FeaturesAPI_Extrusion(aFeature, theBaseObjects, theToSize, theFromSize));
+}
+
+//==================================================================================================
+ExtrusionPtr addExtrusion(const std::shared_ptr<ModelAPI_Document>& thePart,
+                          const std::list<ModelHighAPI_Selection>& theBaseObjects,
+                          const ModelHighAPI_Selection& theDirection,
+                          const ModelHighAPI_Double& theToSize,
+                          const ModelHighAPI_Double& theFromSize)
+{
+  std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Extrusion::ID());
+  return ExtrusionPtr(new FeaturesAPI_Extrusion(aFeature,
+                                                theBaseObjects,
+                                                theDirection,
+                                                theToSize,
+                                                theFromSize));
+}
+
+//==================================================================================================
+ExtrusionPtr addExtrusion(const std::shared_ptr<ModelAPI_Document>& thePart,
+                          const std::list<ModelHighAPI_Selection>& theBaseObjects,
+                          const ModelHighAPI_Selection& theToObject,
+                          const ModelHighAPI_Double& theToOffset,
+                          const ModelHighAPI_Selection& theFromObject,
+                          const ModelHighAPI_Double& theFromOffset)
+{
+  std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Extrusion::ID());
+  return ExtrusionPtr(new FeaturesAPI_Extrusion(aFeature,
+                                                theBaseObjects,
+                                                theToObject,
+                                                theToOffset,
+                                                theFromObject,
+                                                theFromOffset));
+}
+
+//==================================================================================================
+ExtrusionPtr addExtrusion(const std::shared_ptr<ModelAPI_Document>& thePart,
+                          const std::list<ModelHighAPI_Selection>& theBaseObjects,
+                          const ModelHighAPI_Selection& theDirection,
+                          const ModelHighAPI_Selection& theToObject,
+                          const ModelHighAPI_Double& theToOffset,
+                          const ModelHighAPI_Selection& theFromObject,
+                          const ModelHighAPI_Double& theFromOffset)
+{
+  std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Extrusion::ID());
+  return ExtrusionPtr(new FeaturesAPI_Extrusion(aFeature,
+                                                theBaseObjects,
+                                                theDirection,
+                                                theToObject,
+                                                theToOffset,
+                                                theFromObject,
+                                                theFromOffset));
+}
diff --git a/src/FeaturesAPI/FeaturesAPI_Extrusion.h b/src/FeaturesAPI/FeaturesAPI_Extrusion.h
new file mode 100644 (file)
index 0000000..3f271e7
--- /dev/null
@@ -0,0 +1,172 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File:        FeaturesAPI_Extrusion.h
+// Created:     09 June 2016
+// Author:      Dmitry Bobylev
+
+#ifndef FeaturesAPI_Extrusion_H_
+#define FeaturesAPI_Extrusion_H_
+
+#include "FeaturesAPI.h"
+
+#include <FeaturesPlugin_Extrusion.h>
+
+#include <ModelHighAPI_Interface.h>
+#include <ModelHighAPI_Macro.h>
+
+class ModelHighAPI_Double;
+class ModelHighAPI_Selection;
+
+/// \class FeaturesAPI_Extrusion
+/// \ingroup CPPHighAPI
+/// \brief Interface for Extrusion feature.
+class FeaturesAPI_Extrusion: public ModelHighAPI_Interface
+{
+public:
+  /// Constructor without values.
+  FEATURESAPI_EXPORT
+  explicit FeaturesAPI_Extrusion(const std::shared_ptr<ModelAPI_Feature>& theFeature);
+
+  /// Constructor with values.
+  FEATURESAPI_EXPORT
+  explicit FeaturesAPI_Extrusion(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+                                 const std::list<ModelHighAPI_Selection>& theBaseObjects,
+                                 const ModelHighAPI_Double& theSize);
+
+  /// Constructor with values.
+  FEATURESAPI_EXPORT
+  explicit FeaturesAPI_Extrusion(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+                                 const std::list<ModelHighAPI_Selection>& theBaseObjects,
+                                 const ModelHighAPI_Selection& theDirection,
+                                 const ModelHighAPI_Double& theSize);
+  /// Constructor with values.
+  FEATURESAPI_EXPORT
+  explicit FeaturesAPI_Extrusion(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+                                 const std::list<ModelHighAPI_Selection>& theBaseObjects,
+                                 const ModelHighAPI_Double& theToSize,
+                                 const ModelHighAPI_Double& theFromSize);
+
+  /// Constructor with values.
+  FEATURESAPI_EXPORT
+  explicit FeaturesAPI_Extrusion(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+                                 const std::list<ModelHighAPI_Selection>& theBaseObjects,
+                                 const ModelHighAPI_Selection& theDirection,
+                                 const ModelHighAPI_Double& theToSize,
+                                 const ModelHighAPI_Double& theFromSize);
+
+  /// Constructor with values.
+  FEATURESAPI_EXPORT
+  explicit FeaturesAPI_Extrusion(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+                                 const std::list<ModelHighAPI_Selection>& theBaseObjects,
+                                 const ModelHighAPI_Selection& theToObject,
+                                 const ModelHighAPI_Double& theToOffset,
+                                 const ModelHighAPI_Selection& theFromObject,
+                                 const ModelHighAPI_Double& theFromOffset);
+
+  /// Constructor with values.
+  FEATURESAPI_EXPORT
+  explicit FeaturesAPI_Extrusion(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+                                 const std::list<ModelHighAPI_Selection>& theBaseObjects,
+                                 const ModelHighAPI_Selection& theDirection,
+                                 const ModelHighAPI_Selection& theToObject,
+                                 const ModelHighAPI_Double& theToOffset,
+                                 const ModelHighAPI_Selection& theFromObject,
+                                 const ModelHighAPI_Double& theFromOffset);
+
+  /// Destructor.
+  FEATURESAPI_EXPORT
+  virtual ~FeaturesAPI_Extrusion();
+
+  INTERFACE_10(FeaturesPlugin_Extrusion::ID(),
+               baseObjects, FeaturesPlugin_CompositeSketch::BASE_OBJECTS_ID(), ModelAPI_AttributeSelectionList, /** Base objects */,
+               creationMethod, FeaturesPlugin_Extrusion::CREATION_METHOD(), ModelAPI_AttributeString, /** Creation method */,
+               toSize, FeaturesPlugin_Extrusion::TO_SIZE_ID(), ModelAPI_AttributeDouble, /** To size */,
+               fromSize, FeaturesPlugin_Extrusion::FROM_SIZE_ID(), ModelAPI_AttributeDouble, /** From size */,
+               toObject, FeaturesPlugin_Extrusion::TO_OBJECT_ID(), ModelAPI_AttributeSelection, /** To object */,
+               toOffset, FeaturesPlugin_Extrusion::TO_OFFSET_ID(), ModelAPI_AttributeDouble, /** To offset */,
+               fromObject, FeaturesPlugin_Extrusion::FROM_OBJECT_ID(), ModelAPI_AttributeSelection, /** From object */,
+               fromOffset, FeaturesPlugin_Extrusion::FROM_OFFSET_ID(), ModelAPI_AttributeDouble, /** From offset */,
+               direction, FeaturesPlugin_Extrusion::DIRECTION_OBJECT_ID(), ModelAPI_AttributeSelection, /** Direction */,
+               sketchLauncher, FeaturesPlugin_CompositeSketch::SKETCH_ID(), ModelAPI_AttributeReference, /** Sketch launcher */)
+
+  /// Modify base attribute of the feature.
+  FEATURESAPI_EXPORT
+  void setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects);
+
+  /// Modify direction_object attribute of the feature.
+  FEATURESAPI_EXPORT
+  void setDirection(const ModelHighAPI_Selection& theDirection);
+
+  /// Modify CreationMethod, to_size, from_size attributes of the feature.
+  FEATURESAPI_EXPORT
+  void setSizes(const ModelHighAPI_Double& theToSize, const ModelHighAPI_Double& theFromSize);
+
+  /// Modify creation_method, to_size, from_size attributes of the feature.
+  FEATURESAPI_EXPORT
+  void setSize(const ModelHighAPI_Double& theSize);
+
+  /// Modify creation_method, to_object, to_offset, from_object, from_offset attributes of the feature.
+  FEATURESAPI_EXPORT
+  void setPlanesAndOffsets(const ModelHighAPI_Selection& theToObject,
+                           const ModelHighAPI_Double& theToOffset,
+                           const ModelHighAPI_Selection& theFromObject,
+                           const ModelHighAPI_Double& theFromOffset);
+};
+
+/// Pointer on Extrusion object.
+typedef std::shared_ptr<FeaturesAPI_Extrusion> ExtrusionPtr;
+
+/// \ingroup CPPHighAPI
+/// \brief Create Extrusion feature.
+FEATURESAPI_EXPORT
+ExtrusionPtr addExtrusion(const std::shared_ptr<ModelAPI_Document>& thePart,
+                          const std::list<ModelHighAPI_Selection>& theBaseObjects,
+                          const ModelHighAPI_Double& theSize);
+
+/// \ingroup CPPHighAPI
+/// \brief Create Extrusion feature.
+FEATURESAPI_EXPORT
+ExtrusionPtr addExtrusion(const std::shared_ptr<ModelAPI_Document>& thePart,
+                          const std::list<ModelHighAPI_Selection>& theBaseObjects,
+                          const ModelHighAPI_Selection& theDirection,
+                          const ModelHighAPI_Double& theSize);
+
+/// \ingroup CPPHighAPI
+/// \brief Create Extrusion feature.
+FEATURESAPI_EXPORT
+ExtrusionPtr addExtrusion(const std::shared_ptr<ModelAPI_Document>& thePart,
+                          const std::list<ModelHighAPI_Selection>& theBaseObjects,
+                          const ModelHighAPI_Double& theToSize,
+                          const ModelHighAPI_Double& theFromSize);
+
+/// \ingroup CPPHighAPI
+/// \brief Create Extrusion feature.
+FEATURESAPI_EXPORT
+ExtrusionPtr addExtrusion(const std::shared_ptr<ModelAPI_Document>& thePart,
+                          const std::list<ModelHighAPI_Selection>& theBaseObjects,
+                          const ModelHighAPI_Selection& theDirection,
+                          const ModelHighAPI_Double& theToSize,
+                          const ModelHighAPI_Double& theFromSize);
+
+/// \ingroup CPPHighAPI
+/// \brief Create Extrusion feature.
+FEATURESAPI_EXPORT
+ExtrusionPtr addExtrusion(const std::shared_ptr<ModelAPI_Document>& thePart,
+                          const std::list<ModelHighAPI_Selection>& theBaseObjects,
+                          const ModelHighAPI_Selection& theToObject,
+                          const ModelHighAPI_Double& theToOffset,
+                          const ModelHighAPI_Selection& theFromObject,
+                          const ModelHighAPI_Double& theFromOffset);
+
+/// \ingroup CPPHighAPI
+/// \brief Create Extrusion feature.
+FEATURESAPI_EXPORT
+ExtrusionPtr addExtrusion(const std::shared_ptr<ModelAPI_Document>& thePart,
+                          const std::list<ModelHighAPI_Selection>& theBaseObjects,
+                          const ModelHighAPI_Selection& theDirection,
+                          const ModelHighAPI_Selection& theToObject,
+                          const ModelHighAPI_Double& theToOffset,
+                          const ModelHighAPI_Selection& theFromObject,
+                          const ModelHighAPI_Double& theFromOffset);
+
+#endif // FeaturesAPI_Extrusion_H_
index 08c2e5bda7ab3c621bc12332a84d99be0766cde6..68239201bb5ee7089f01dc92cc1cf181cb6cb0a9 100644 (file)
@@ -36,7 +36,7 @@ public:
   virtual ~FeaturesAPI_Group();
 
   INTERFACE_1(FeaturesPlugin_Group::ID(),
-              groupList, FeaturesPlugin_Group::LIST_ID()(), ModelAPI_AttributeSelectionList, /** Group list*/)
+              groupList, FeaturesPlugin_Group::LIST_ID(), ModelAPI_AttributeSelectionList, /** Group list*/)
 
   /// Set main objects.
   FEATURESAPI_EXPORT
index b9836a45e5096e2ab202c999063e27784bcb7177..bc9c57a24b967f12875114fd6f065458c6167a5c 100644 (file)
@@ -10,8 +10,9 @@
   #include <ModelHighAPI_swig.h>
 
   #include "FeaturesAPI.h"
-  #include "FeaturesAPI_Group.h"
   #include "FeaturesAPI_Boolean.h"
+  #include "FeaturesAPI_Extrusion.h"
+  #include "FeaturesAPI_Group.h"
   #include "FeaturesAPI_Placement.h"
   #include "FeaturesAPI_Rotation.h"
   #include "FeaturesAPI_Translation.h"
index e62c89ba411f4bd64df87b6e064a33cf4c2a03a8..86e1bec88a9629da335fabde88d26612157d1ac5 100644 (file)
     END_INIT() \
   public:
 
+//--------------------------------------------------------------------------------------
+#define INTERFACE_10(KIND, \
+                     N_0, AN_0, T_0, C_0, \
+                     N_1, AN_1, T_1, C_1, \
+                     N_2, AN_2, T_2, C_2, \
+                     N_3, AN_3, T_3, C_3, \
+                     N_4, AN_4, T_4, C_4, \
+                     N_5, AN_5, T_5, C_5, \
+                     N_6, AN_6, T_6, C_6, \
+                     N_7, AN_7, T_7, C_7, \
+                     N_8, AN_8, T_8, C_8, \
+                     N_9, AN_9, T_9, C_9) \
+  public: \
+    INTERFACE_COMMON(KIND) \
+    DEFINE_ATTRIBUTE(N_0, T_0, C_0) \
+    DEFINE_ATTRIBUTE(N_1, T_1, C_1) \
+    DEFINE_ATTRIBUTE(N_2, T_2, C_2) \
+    DEFINE_ATTRIBUTE(N_3, T_3, C_3) \
+    DEFINE_ATTRIBUTE(N_4, T_4, C_4) \
+    DEFINE_ATTRIBUTE(N_5, T_5, C_5) \
+    DEFINE_ATTRIBUTE(N_6, T_6, C_6) \
+    DEFINE_ATTRIBUTE(N_7, T_7, C_7) \
+    DEFINE_ATTRIBUTE(N_8, T_8, C_8) \
+    DEFINE_ATTRIBUTE(N_9, T_9, C_9) \
+  protected: \
+    START_INIT() \
+      SET_ATTRIBUTE(N_0, T_0, AN_0) \
+      SET_ATTRIBUTE(N_1, T_1, AN_1) \
+      SET_ATTRIBUTE(N_2, T_2, AN_2) \
+      SET_ATTRIBUTE(N_3, T_3, AN_3) \
+      SET_ATTRIBUTE(N_4, T_4, AN_4) \
+      SET_ATTRIBUTE(N_5, T_5, AN_5) \
+      SET_ATTRIBUTE(N_6, T_6, AN_6) \
+      SET_ATTRIBUTE(N_7, T_7, AN_7) \
+      SET_ATTRIBUTE(N_8, T_8, AN_8) \
+      SET_ATTRIBUTE(N_9, T_9, AN_9) \
+    END_INIT() \
+  public:
+
 //--------------------------------------------------------------------------------------
 #endif /* SRC_MODELHIGHAPI_MODELHIGHAPI_MACRO_H_ */
index 07df469c9510103dee6bfb1ed7e7890e3bb5645d..c3d4c31367c337a7ec87260b57552cf6d2eb8aa0 100644 (file)
@@ -25,28 +25,28 @@ class FeaturesFixture(unittest.TestCase):
 
 class FeaturesTestCase(FeaturesFixture):
 
-    def test_assert_error_on_empty_args(self):
-        features = [
-            # Implemented in C++, add* without arguments doesn't exist
-            # "addPoint", "addPlane",
-            # "addImport", "exportToFile",
-
-            "addAxis",
-            "addCut", "addFuse", "addCommon",
-            "addExtrusion",
-            # "addExtrusionCut", "addExtrusionFuse",
-            "addRevolution",
-            # "addRevolutionCut", "addRevolutionFuse",
-            "addPlacement", "addRotation", "addTranslation",
-            "addGroup",
-            "addParameter",
-            ]
-        for name in features:
-            try:
-                with self.assertRaises(AssertionError):
-                    feature = getattr(model, name)(self.part)
-            except AssertionError as e:
-                self.fail("%s does not check empty args" % name)
+    def test_assert_error_on_empty_args(self):
+        features = [
+            # Implemented in C++, add* without arguments doesn't exist
+            # "addPoint", "addPlane",
+            # "addImport", "exportToFile",
+    #
+            "addAxis",
+            "addCut", "addFuse", "addCommon",
+            "addExtrusion",
+            # "addExtrusionCut", "addExtrusionFuse",
+            "addRevolution",
+            # "addRevolutionCut", "addRevolutionFuse",
+            "addPlacement", "addRotation", "addTranslation",
+            "addGroup",
+            "addParameter",
+            ]
+        for name in features:
+            try:
+                with self.assertRaises(AssertionError):
+                    feature = getattr(model, name)(self.part)
+            except AssertionError as e:
+                self.fail("%s does not check empty args" % name)
 
     def test_addPoint(self):
         model.addPoint(self.part, 10, "20", "x + 30")
@@ -63,7 +63,7 @@ class FeaturesTestCase(FeaturesFixture):
 
         import FeaturesAPI
         FeaturesAPI.FeaturesAPI_Boolean(self.part.addFeature("Boolean"))
-        model.features.extrusion.Extrusion(self.part.addFeature("Extrusion"))
+        FeaturesAPI.FeaturesAPI_Extrusion(self.part.addFeature("Extrusion"))
         # model.features.extrusion_boolean.ExtrusionBoolean(self.part.addFeature("ExtrusionCut"))
         # model.features.extrusion_boolean.ExtrusionBoolean(self.part.addFeature("ExtrusionFuse"))
         model.features.revolution.Revolution(self.part.addFeature("Revolution"))
index decd198b7a82ab1f95f15d8ea8bc139d3af381b7..4b05bd88daac2b8ebee2f48ab1c3f083fbfb3303 100644 (file)
@@ -42,13 +42,6 @@ class FeaturesExtrusionFixture(FeaturesAddExtrusionFixture):
 
 class FeaturesAddExtrusionTestCase(FeaturesAddExtrusionFixture):
 
-    def test_add_extrusion_no_base(self):
-        try:
-            extrusion = model.addExtrusion(self.part)
-            fail("addExtrusion should assert if base is not None")
-        except AssertionError:
-            pass
-
     def test_add_extrusion_by_face_and_size(self):
         sketch = model.addSketch(self.part, model.defaultPlane("XOY"))
         circle = sketch.addCircle(0, 0, 10)
index 3d0d9ecb29024de7331d5589b38ee38d7c7d7cda..8a29931bbb1bdcac4ad1e14e18b831fd21f5a745 100644 (file)
@@ -5,7 +5,7 @@ from boolean import addAddition, addSubtraction, addIntersection
 
 from partition import addPartition
 
-from extrusion import addExtrusion
+from FeaturesAPI import addExtrusion
 from extrusion_boolean import addExtrusionCut, addExtrusionFuse
 
 from revolution import addRevolution