From a4f6b08c913dc94916557b256572ab91478bd61f Mon Sep 17 00:00:00 2001 From: spo Date: Fri, 30 Oct 2015 10:43:41 +0300 Subject: [PATCH] Add ModelAPI_AttributeIntArray to SWIG --- src/ModelAPI/ModelAPI.i | 4 ++++ src/PythonAPI/model/tools.py | 9 ++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/ModelAPI/ModelAPI.i b/src/ModelAPI/ModelAPI.i index 7da97d0c1..8da7ce250 100644 --- a/src/ModelAPI/ModelAPI.i +++ b/src/ModelAPI/ModelAPI.i @@ -22,6 +22,7 @@ #include "ModelAPI_AttributeDocRef.h" #include "ModelAPI_AttributeDouble.h" #include "ModelAPI_AttributeInteger.h" + #include "ModelAPI_AttributeIntArray.h" #include "ModelAPI_AttributeString.h" #include "ModelAPI_AttributeReference.h" #include "ModelAPI_AttributeRefAttr.h" @@ -83,6 +84,7 @@ %shared_ptr(ModelAPI_AttributeDocRef) %shared_ptr(ModelAPI_AttributeDouble) %shared_ptr(ModelAPI_AttributeInteger) +%shared_ptr(ModelAPI_AttributeIntArray) %shared_ptr(ModelAPI_AttributeString) %shared_ptr(ModelAPI_AttributeReference) %shared_ptr(ModelAPI_AttributeRefAttr) @@ -114,6 +116,7 @@ %include "ModelAPI_AttributeDocRef.h" %include "ModelAPI_AttributeDouble.h" %include "ModelAPI_AttributeInteger.h" +%include "ModelAPI_AttributeIntArray.h" %include "ModelAPI_AttributeString.h" %include "ModelAPI_AttributeReference.h" %include "ModelAPI_AttributeRefAttr.h" @@ -156,6 +159,7 @@ template std::shared_ptr shared_ptr_cast(std::shared_ptr %template(modelAPI_AttributeDocRef) shared_ptr_cast; %template(modelAPI_AttributeDouble) shared_ptr_cast; %template(modelAPI_AttributeInteger) shared_ptr_cast; +%template(modelAPI_AttributeIntArray) shared_ptr_cast; %template(modelAPI_AttributeString) shared_ptr_cast; %template(modelAPI_AttributeReference) shared_ptr_cast; %template(modelAPI_AttributeRefAttr) shared_ptr_cast; diff --git a/src/PythonAPI/model/tools.py b/src/PythonAPI/model/tools.py index e9fc59b93..220fdee4f 100644 --- a/src/PythonAPI/model/tools.py +++ b/src/PythonAPI/model/tools.py @@ -78,11 +78,10 @@ def fill_attribute(attribute, value): else: attribute.setValue(value) -# TODO: ModelAPI_AttributeIntArray should be added to SWIG -# elif isinstance(attribute, ModelAPI.ModelAPI_AttributeIntArray): -# attrubute.setSize(len(value)) -# for i in range(len(value)): -# attrubute.setValue(i, value[i]) + elif isinstance(attribute, ModelAPI.ModelAPI_AttributeIntArray): + attrubute.setSize(len(value)) + for i in range(len(value)): + attrubute.setValue(i, value[i]) elif isinstance(attribute, ModelAPI.ModelAPI_AttributeRefAttr): assert(isinstance(value, ModelAPI.ModelAPI_Attribute) or -- 2.39.2