From: mbs Date: Thu, 16 Mar 2023 19:22:42 +0000 (+0000) Subject: upgraded swig support from v4.0.2 to v4.1.1 X-Git-Tag: V9_11_0a1~12 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=refs%2Ftlpr%2F5%2Fhead;p=modules%2Fshaper.git upgraded swig support from v4.0.2 to v4.1.1 --- diff --git a/src/CollectionAPI/CollectionAPI.i b/src/CollectionAPI/CollectionAPI.i index 60fb4e0cc..4a815133b 100644 --- a/src/CollectionAPI/CollectionAPI.i +++ b/src/CollectionAPI/CollectionAPI.i @@ -37,8 +37,15 @@ #endif // CollectionAPI_swig_H_ - // fix for SWIG v2.0.4 - #define SWIGPY_SLICE_ARG(obj) ((PyObject*)(obj)) +// fix for SWIG v4.1.1 +#if PY_VERSION_HEX >= 0x03020000 +# define SWIGPY_SLICEOBJECT PyObject +#else +# define SWIGPY_SLICEOBJECT PySliceObject +#endif + +// fix for SWIG v2.0.4 +#define SWIGPY_SLICE_ARG(obj) ((SWIGPY_SLICEOBJECT*)(obj)) %} %include "doxyhelp.i" diff --git a/src/ConnectorPlugin/ConnectorPlugin_ExportFeature.py b/src/ConnectorPlugin/ConnectorPlugin_ExportFeature.py index 30e01b86e..6802ff8a0 100644 --- a/src/ConnectorPlugin/ConnectorPlugin_ExportFeature.py +++ b/src/ConnectorPlugin/ConnectorPlugin_ExportFeature.py @@ -61,9 +61,9 @@ class ExportFeature(ModelAPI.ModelAPI_Feature): def exportViaXAO(self): # if part-set is active, iterate also parts for isPart in (True, False): - aResultType = model.ModelAPI_ResultBody_group() + aResultType = model.ModelAPI_ResultBody.group() if isPart: - aResultType = model.ModelAPI_ResultPart_group() + aResultType = model.ModelAPI_ResultPart.group() # iterate all results of Part, export one by one due to issue 2882 for aResIndex in range(self.Part.size(aResultType)): anObject = self.Part.object(aResultType, aResIndex) diff --git a/src/ConnectorPlugin/ConnectorPlugin_PublishToStudyFeature.py b/src/ConnectorPlugin/ConnectorPlugin_PublishToStudyFeature.py index 1209adee9..f36be7a06 100644 --- a/src/ConnectorPlugin/ConnectorPlugin_PublishToStudyFeature.py +++ b/src/ConnectorPlugin/ConnectorPlugin_PublishToStudyFeature.py @@ -64,8 +64,8 @@ class PublishToStudyFeature(ModelAPI.ModelAPI_Feature): aPartSet = aSession.moduleDocument() # check that the PartSet document current feature is the last to avoid problems with all # features update - if aPartSet.size(model.ModelAPI_Feature_group()) > 0: - aLastFeature = ModelAPI.objectToFeature(aPartSet.object(model.ModelAPI_Feature_group(), aPartSet.size(model.ModelAPI_Feature_group()) - 1)) + if aPartSet.size(model.ModelAPI_Feature.group()) > 0: + aLastFeature = ModelAPI.objectToFeature(aPartSet.object(model.ModelAPI_Feature.group(), aPartSet.size(model.ModelAPI_Feature.group()) - 1)) aCurrentFeature = aPartSet.currentFeature(True) if aLastFeature.data().featureId() != aCurrentFeature.data().featureId(): EventsAPI.Events_InfoMessage("PublishToStudy", "Not all PartSet parts are up-to-date, nothing is published. Please, make the last PartSet feature as current.", self).send() @@ -78,8 +78,8 @@ class PublishToStudyFeature(ModelAPI.ModelAPI_Feature): allProcessed = [] # iterate all parts and all results to publish them in SHAPER_STUDY - for aPartId in range(aPartSet.size(model.ModelAPI_ResultPart_group())): - aPartObject = aPartSet.object(model.ModelAPI_ResultPart_group(), aPartId) + for aPartId in range(aPartSet.size(model.ModelAPI_ResultPart.group())): + aPartObject = aPartSet.object(model.ModelAPI_ResultPart.group(), aPartId) aPartRes = ModelAPI.modelAPI_ResultPart(ModelAPI.modelAPI_Result(aPartObject)) aPartDoc = aPartRes.partDoc() if aPartDoc is None and aPartObject is not None: @@ -89,8 +89,8 @@ class PublishToStudyFeature(ModelAPI.ModelAPI_Feature): # Collects all features of exported results to find results of the same features and extend id. # Map from feature index to index of result. If index is zero (initial), no surrfix to entry is added. aFeaturesIndices = {} - for aResId in range(aPartDoc.size(model.ModelAPI_ResultBody_group())): - aResObject = aPartDoc.object(model.ModelAPI_ResultBody_group(), aResId) + for aResId in range(aPartDoc.size(model.ModelAPI_ResultBody.group())): + aResObject = aPartDoc.object(model.ModelAPI_ResultBody.group(), aResId) aRes = model.objectToResult(aResObject) #do not export images if aRes.hasTexture() is True: diff --git a/src/FeaturesPlugin/Test/Test17000.py b/src/FeaturesPlugin/Test/Test17000.py index 53be1e522..ac0b2aaac 100644 --- a/src/FeaturesPlugin/Test/Test17000.py +++ b/src/FeaturesPlugin/Test/Test17000.py @@ -235,7 +235,7 @@ model.testNbSubShapes(Partition_1, GeomAPI_Shape.VERTEX, [499]) import math from GeomAlgoAPI import * -aResultArea = GeomAlgoAPI_ShapeTools_area(Partition_1.results()[0].resultSubShapePair()[0].shape()) +aResultArea = GeomAlgoAPI_ShapeTools.area(Partition_1.results()[0].resultSubShapePair()[0].shape()) anExpectedArea = 70.18465 assert(math.fabs(aResultArea-anExpectedArea)/anExpectedArea<1e-7) diff --git a/src/FeaturesPlugin/Test/Test2738.py b/src/FeaturesPlugin/Test/Test2738.py index 240a26b22..899d4bede 100644 --- a/src/FeaturesPlugin/Test/Test2738.py +++ b/src/FeaturesPlugin/Test/Test2738.py @@ -56,7 +56,7 @@ assert(selectionList.size() == 9) assert(aFactory.validate(Group_1.feature())) # checkthat solids in the first group are small, like the origin for i in range(9): - delta = GeomAlgoAPI_ShapeTools_volume(selectionList.value(i).value()) - 8.236773528312948 + delta = GeomAlgoAPI_ShapeTools.volume(selectionList.value(i).value()) - 8.236773528312948 assert(fabs(delta) < 1.e-5) # same-plane faces should be merged @@ -66,7 +66,7 @@ assert(aFactory.validate(Group_2.feature())) # checkthat solids in the secong group are big, like the origin for i in range(9): - delta = GeomAlgoAPI_ShapeTools_volume(selectionList.value(i).value()) - 150.66735294710597 + delta = GeomAlgoAPI_ShapeTools.volume(selectionList.value(i).value()) - 150.66735294710597 assert(fabs(delta) < 1.e-5) assert(model.checkPythonDump()) diff --git a/src/FeaturesPlugin/Test/TestExtrusion.py b/src/FeaturesPlugin/Test/TestExtrusion.py index fcab77f8f..282bf2b3d 100644 --- a/src/FeaturesPlugin/Test/TestExtrusion.py +++ b/src/FeaturesPlugin/Test/TestExtrusion.py @@ -160,7 +160,7 @@ assert (anExtrusionResult is not None) # Check extrusion volume aRefVolume = 100530.96491487337 -aResVolume = GeomAlgoAPI_ShapeTools_volume(anExtrusionResult.shape()) +aResVolume = GeomAlgoAPI_ShapeTools.volume(anExtrusionResult.shape()) assert (math.fabs(aResVolume - aRefVolume) < 10 ** -5) #========================================================================= diff --git a/src/FiltersAPI/FiltersAPI.i b/src/FiltersAPI/FiltersAPI.i index f0cbd83be..0ace51f04 100644 --- a/src/FiltersAPI/FiltersAPI.i +++ b/src/FiltersAPI/FiltersAPI.i @@ -24,8 +24,15 @@ %{ #include "FiltersAPI_swig.h" + // fix for SWIG v4.1.1 + #if PY_VERSION_HEX >= 0x03020000 + # define SWIGPY_SLICEOBJECT PyObject + #else + # define SWIGPY_SLICEOBJECT PySliceObject + #endif + // fix for SWIG v2.0.4 - #define SWIGPY_SLICE_ARG(obj) ((PyObject*)(obj)) + #define SWIGPY_SLICE_ARG(obj) ((SWIGPY_SLICEOBJECT*)(obj)) %} %include "doxyhelp.i" diff --git a/src/FiltersPlugin/FiltersPlugin_TopoConnectedFaces.py b/src/FiltersPlugin/FiltersPlugin_TopoConnectedFaces.py index aa7e5c5b5..01b850ea6 100644 --- a/src/FiltersPlugin/FiltersPlugin_TopoConnectedFaces.py +++ b/src/FiltersPlugin/FiltersPlugin_TopoConnectedFaces.py @@ -102,8 +102,8 @@ class FiltersPlugin_TopoConnectedFaces(ModelAPI_Filter): def initAttributes(self, theArgs): """ Initializes arguments of a filter """ - theArgs.initAttribute("Shape", ModelAPI_AttributeSelection_typeId()) - theArgs.initAttribute("Propagation", ModelAPI_AttributeBoolean_typeId()) + theArgs.initAttribute("Shape", ModelAPI_AttributeSelection.typeId()) + theArgs.initAttribute("Propagation", ModelAPI_AttributeBoolean.typeId()) def adjacentFaces(self, theFace, theMapSA, theShapeType, theApplicableFaces, theRecursive = True): """ Find all faces neighbour to theFace """ diff --git a/src/GeomAlgoAPI/GeomAlgoAPI.i b/src/GeomAlgoAPI/GeomAlgoAPI.i index 2524c6ce8..3e75454ea 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI.i +++ b/src/GeomAlgoAPI/GeomAlgoAPI.i @@ -21,6 +21,16 @@ %module GeomAlgoAPI %{ #include "GeomAlgoAPI_swig.h" + +// fix for SWIG v4.1.1 +#if PY_VERSION_HEX >= 0x03020000 +# define SWIGPY_SLICEOBJECT PyObject +#else +# define SWIGPY_SLICEOBJECT PySliceObject +#endif + +// fix for SWIG v2.0.4 +#define SWIGPY_SLICE_ARG(obj) ((SWIGPY_SLICEOBJECT*)(obj)) %} // import other modules diff --git a/src/ModelAPI/ModelAPI.i b/src/ModelAPI/ModelAPI.i index 969ed7fd5..dab4fac4c 100644 --- a/src/ModelAPI/ModelAPI.i +++ b/src/ModelAPI/ModelAPI.i @@ -30,9 +30,15 @@ %{ #include "ModelAPI_swig.h" - // fix for SWIG v2.0.4 - #define SWIGPY_SLICE_ARG(obj) ((PyObject*)(obj)) + // fix for SWIG v4.1.1 + #if PY_VERSION_HEX >= 0x03020000 + # define SWIGPY_SLICEOBJECT PyObject + #else + # define SWIGPY_SLICEOBJECT PySliceObject + #endif + // fix for SWIG v2.0.4 + #define SWIGPY_SLICE_ARG(obj) ((SWIGPY_SLICEOBJECT*)(obj)) #define SWIGPY_UNICODE_ARG(obj) ((PyObject*) (obj)) %} diff --git a/src/ModelAPI/Test/Test2252.py b/src/ModelAPI/Test/Test2252.py index 8df731fdd..2a500a36a 100644 --- a/src/ModelAPI/Test/Test2252.py +++ b/src/ModelAPI/Test/Test2252.py @@ -61,8 +61,8 @@ model.end() assert(partSet.size("Parts") == 1) resShape = modelAPI_Result(partSet.object("Parts", 0)).shape() # height of extrusion 90 / 2 + translation 100 -assert(GeomAlgoAPI_ShapeTools_centreOfMass(resShape).x() == 145) +assert(GeomAlgoAPI_ShapeTools.centreOfMass(resShape).x() == 145) # rotated -assert(floor(GeomAlgoAPI_ShapeTools_centreOfMass(resShape).z()) == -30) +assert(floor(GeomAlgoAPI_ShapeTools.centreOfMass(resShape).z()) == -30) assert(model.checkPythonDump()) diff --git a/src/ModelHighAPI/ModelHighAPI.i b/src/ModelHighAPI/ModelHighAPI.i index 23eadeb9b..83464cbf3 100644 --- a/src/ModelHighAPI/ModelHighAPI.i +++ b/src/ModelHighAPI/ModelHighAPI.i @@ -30,9 +30,15 @@ %{ #include "ModelHighAPI_swig.h" - // fix for SWIG v2.0.4 - #define SWIGPY_SLICE_ARG(obj) ((PyObject*)(obj)) + // fix for SWIG v4.1.1 + #if PY_VERSION_HEX >= 0x03020000 + # define SWIGPY_SLICEOBJECT PyObject + #else + # define SWIGPY_SLICEOBJECT PySliceObject + #endif + // fix for SWIG v2.0.4 + #define SWIGPY_SLICE_ARG(obj) ((SWIGPY_SLICEOBJECT*)(obj)) #define SWIGPY_UNICODE_ARG(obj) ((PyObject*) (obj)) %} diff --git a/src/ParametersAPI/ParametersAPI.i b/src/ParametersAPI/ParametersAPI.i index 17c873cdc..aa9376478 100644 --- a/src/ParametersAPI/ParametersAPI.i +++ b/src/ParametersAPI/ParametersAPI.i @@ -24,9 +24,15 @@ %{ #include "ParametersAPI_swig.h" - // fix for SWIG v2.0.4 - #define SWIGPY_SLICE_ARG(obj) ((PyObject*)(obj)) + // fix for SWIG v4.1.1 + #if PY_VERSION_HEX >= 0x03020000 + # define SWIGPY_SLICEOBJECT PyObject + #else + # define SWIGPY_SLICEOBJECT PySliceObject + #endif + // fix for SWIG v2.0.4 + #define SWIGPY_SLICE_ARG(obj) ((SWIGPY_SLICEOBJECT*)(obj)) #define SWIGPY_UNICODE_ARG(obj) ((PyObject*) (obj)) %} diff --git a/src/PythonAPI/model/roots.py b/src/PythonAPI/model/roots.py index d503eac99..f8f762bd7 100644 --- a/src/PythonAPI/model/roots.py +++ b/src/PythonAPI/model/roots.py @@ -33,7 +33,7 @@ class Feature(ModelAPI.ModelAPI_Feature): def addRealInput(self, inputid): """F.addRealInput(str) -- add real attribute""" self.data().addAttribute(inputid, - ModelAPI.ModelAPI_AttributeDouble_typeId()) + ModelAPI.ModelAPI_AttributeDouble.typeId()) def getRealInput(self, inputid): """F.getRealInput(str) -- get real value of the attribute""" diff --git a/src/PythonAPI/model/tests/tests.py b/src/PythonAPI/model/tests/tests.py index 23e684461..0b49ac2a4 100644 --- a/src/PythonAPI/model/tests/tests.py +++ b/src/PythonAPI/model/tests/tests.py @@ -69,14 +69,14 @@ def generateTests(theFeature, theFeatureName, theTestsList = []): aNbResults = len(theFeature.results()) aResultsVolumes = [] for anIndex in range(0, aNbResults): - aResultsVolumes.append(GeomAlgoAPI_ShapeTools_volume(theFeature.results()[anIndex].resultSubShapePair()[0].shape())) + aResultsVolumes.append(GeomAlgoAPI_ShapeTools.volume(theFeature.results()[anIndex].resultSubShapePair()[0].shape())) print("model.testResultsVolumes({}, [{}])".format(theFeatureName, ", ".join("{:0.27f}".format(i) for i in aResultsVolumes))) if "testResultsAreas" in theTestsList or len(theTestsList) == 0: aNbResults = len(theFeature.results()) aResultsAreas = [] for anIndex in range(0, aNbResults): - aResultsAreas.append(GeomAlgoAPI_ShapeTools_area(theFeature.results()[anIndex].resultSubShapePair()[0].shape())) + aResultsAreas.append(GeomAlgoAPI_ShapeTools.area(theFeature.results()[anIndex].resultSubShapePair()[0].shape())) print("model.testResultsAreas({}, [{}])".format(theFeatureName, ", ".join("{:0.27f}".format(i) for i in aResultsAreas))) @@ -191,7 +191,7 @@ def testResultsVolumes(theFeature, theExpectedResultsVolumes, theNbSignificantDi aListSize = len(theExpectedResultsVolumes) assert (aNbResults == aListSize), "Number of results: {} not equal to list size: {}.".format(aNbResults, aListSize) for anIndex in range(0, aNbResults): - aResultVolume = GeomAlgoAPI_ShapeTools_volume(theFeature.results()[anIndex].resultSubShapePair()[0].shape()) + aResultVolume = GeomAlgoAPI_ShapeTools.volume(theFeature.results()[anIndex].resultSubShapePair()[0].shape()) aResultVolumeStr = "{:0.27f}".format(aResultVolume).lstrip("0").lstrip(".").lstrip("0") anExpectedResultVolume = theExpectedResultsVolumes[anIndex] anExpectedResultVolumeStr = "{:0.27f}".format(anExpectedResultVolume).lstrip("0").lstrip(".").lstrip("0") @@ -208,7 +208,7 @@ def testResultsAreas(theFeature, theExpectedResultsVolumes, theNbSignificantDigi aListSize = len(theExpectedResultsVolumes) assert (aNbResults == aListSize), "Number of results: {} not equal to list size: {}.".format(aNbResults, aListSize) for anIndex in range(0, aNbResults): - aResultVolume = GeomAlgoAPI_ShapeTools_area(theFeature.results()[anIndex].resultSubShapePair()[0].shape()) + aResultVolume = GeomAlgoAPI_ShapeTools.area(theFeature.results()[anIndex].resultSubShapePair()[0].shape()) aResultVolumeStr = "{:0.27f}".format(aResultVolume).lstrip("0").lstrip(".").lstrip("0") anExpectedResultVolume = theExpectedResultsVolumes[anIndex] anExpectedResultVolumeStr = "{:0.27f}".format(anExpectedResultVolume).lstrip("0").lstrip(".").lstrip("0") diff --git a/src/PythonAddons/doc/examples/rectangle/feature.py b/src/PythonAddons/doc/examples/rectangle/feature.py index d213abb6d..bd8a45e7d 100755 --- a/src/PythonAddons/doc/examples/rectangle/feature.py +++ b/src/PythonAddons/doc/examples/rectangle/feature.py @@ -74,12 +74,12 @@ class SketchPlugin_Rectangle(model.Feature): def initAttributes(self): """Override Feature.initAttributes()""" # Flag whether the rectangle is accessory - self.data().addAttribute(self.AUXILIARY_ID(), ModelAPI.ModelAPI_AttributeBoolean_typeId()) + self.data().addAttribute(self.AUXILIARY_ID(), ModelAPI.ModelAPI_AttributeBoolean.typeId()) # Creating corners of the rectangle - self.data().addAttribute(self.START_ID(), GeomDataAPI.GeomDataAPI_Point2D_typeId()) - self.data().addAttribute(self.END_ID(), GeomDataAPI.GeomDataAPI_Point2D_typeId()) + self.data().addAttribute(self.START_ID(), GeomDataAPI.GeomDataAPI_Point2D.typeId()) + self.data().addAttribute(self.END_ID(), GeomDataAPI.GeomDataAPI_Point2D.typeId()) # Creating list to store lines - self.data().addAttribute(self.LINES_LIST_ID(), ModelAPI.ModelAPI_AttributeRefList_typeId()) + self.data().addAttribute(self.LINES_LIST_ID(), ModelAPI.ModelAPI_AttributeRefList.typeId()) ModelAPI.ModelAPI_Session.get().validators().registerNotObligatory(self.getKind(), self.LINES_LIST_ID()) def isMacro(self): diff --git a/src/PythonAddons/macros/compoundVertices/feature.py b/src/PythonAddons/macros/compoundVertices/feature.py index 06733ab10..157341ac4 100755 --- a/src/PythonAddons/macros/compoundVertices/feature.py +++ b/src/PythonAddons/macros/compoundVertices/feature.py @@ -60,8 +60,8 @@ class compoundVertices(model.Feature): def initAttributes(self): """Override Feature.initAttributes()""" # Creating the input argument of the feature - self.data().addAttribute(self.FILE_ID(), ModelAPI.ModelAPI_AttributeString_typeId()) - self.data().addAttribute(self.SEPARATOR_ID(), ModelAPI.ModelAPI_AttributeString_typeId()) + self.data().addAttribute(self.FILE_ID(), ModelAPI.ModelAPI_AttributeString.typeId()) + self.data().addAttribute(self.SEPARATOR_ID(), ModelAPI.ModelAPI_AttributeString.typeId()) self.lfeatures = [] self.folder = None diff --git a/src/PythonAddons/macros/importParameters/feature.py b/src/PythonAddons/macros/importParameters/feature.py index 20b508f83..eff867389 100755 --- a/src/PythonAddons/macros/importParameters/feature.py +++ b/src/PythonAddons/macros/importParameters/feature.py @@ -56,7 +56,7 @@ class importParameters(model.Feature): def initAttributes(self): """Override Feature.initAttributes()""" # Creating the input argument of the feature - self.data().addAttribute(self.FILE_ID(), ModelAPI.ModelAPI_AttributeString_typeId()) + self.data().addAttribute(self.FILE_ID(), ModelAPI.ModelAPI_AttributeString.typeId()) # Get existing parameters names diff --git a/src/PythonAddons/macros/pipeNetwork/feature.py b/src/PythonAddons/macros/pipeNetwork/feature.py index 86e9bcdc4..005e2bed6 100755 --- a/src/PythonAddons/macros/pipeNetwork/feature.py +++ b/src/PythonAddons/macros/pipeNetwork/feature.py @@ -94,8 +94,8 @@ class pipeNetwork(model.Feature): def initAttributes(self): """Override Feature.initAttributes()""" # Creating the input argument of the feature - self.data().addAttribute(self.FILE_ID(), ModelAPI.ModelAPI_AttributeString_typeId()) - #self.data().addAttribute(self.HEXAS_ID(), ModelAPI.ModelAPI_AttributeBoolean_typeId()) + self.data().addAttribute(self.FILE_ID(), ModelAPI.ModelAPI_AttributeString.typeId()) + #self.data().addAttribute(self.HEXAS_ID(), ModelAPI.ModelAPI_AttributeBoolean.typeId()) #==================================================================================== # Retrieve parent pipe diff --git a/src/PythonAddons/macros/rectangle/feature.py b/src/PythonAddons/macros/rectangle/feature.py index 747664f0b..090d40afc 100755 --- a/src/PythonAddons/macros/rectangle/feature.py +++ b/src/PythonAddons/macros/rectangle/feature.py @@ -105,20 +105,20 @@ class SketchPlugin_Rectangle(model.Feature): def initAttributes(self): """Override Feature.initAttributes()""" # Flag whether the rectangle is accessory - self.data().addAttribute(self.AUXILIARY_ID(), ModelAPI.ModelAPI_AttributeBoolean_typeId()) + self.data().addAttribute(self.AUXILIARY_ID(), ModelAPI.ModelAPI_AttributeBoolean.typeId()) # Creating corners of the rectangle - self.data().addAttribute(self.START_ID(), GeomDataAPI.GeomDataAPI_Point2D_typeId()) - self.data().addAttribute(self.END_ID(), GeomDataAPI.GeomDataAPI_Point2D_typeId()) + self.data().addAttribute(self.START_ID(), GeomDataAPI.GeomDataAPI_Point2D.typeId()) + self.data().addAttribute(self.END_ID(), GeomDataAPI.GeomDataAPI_Point2D.typeId()) # Creating list to store lines - self.data().addAttribute(self.LINES_LIST_ID(), ModelAPI.ModelAPI_AttributeRefList_typeId()) + self.data().addAttribute(self.LINES_LIST_ID(), ModelAPI.ModelAPI_AttributeRefList.typeId()) ModelAPI.ModelAPI_Session.get().validators().registerNotObligatory(self.getKind(), self.LINES_LIST_ID()) # Type of rectangle - self.data().addAttribute(self.RECTANGLE_TYPE_ID(), ModelAPI.ModelAPI_AttributeString_typeId()) + self.data().addAttribute(self.RECTANGLE_TYPE_ID(), ModelAPI.ModelAPI_AttributeString.typeId()) # Center and corner of the rectangle - self.data().addAttribute(self.CENTER_ID(), GeomDataAPI.GeomDataAPI_Point2D_typeId()) - self.data().addAttribute(self.CORNER_ID(), GeomDataAPI.GeomDataAPI_Point2D_typeId()) + self.data().addAttribute(self.CENTER_ID(), GeomDataAPI.GeomDataAPI_Point2D.typeId()) + self.data().addAttribute(self.CORNER_ID(), GeomDataAPI.GeomDataAPI_Point2D.typeId()) - self.data().addAttribute(self.CENTER_REF_ID(), ModelAPI.ModelAPI_AttributeRefAttr_typeId()) + self.data().addAttribute(self.CENTER_REF_ID(), ModelAPI.ModelAPI_AttributeRefAttr.typeId()) ModelAPI.ModelAPI_Session.get().validators().registerNotObligatory(self.getKind(), self.CENTER_REF_ID()) def isMacro(self): diff --git a/src/SketchAPI/SketchAPI.i b/src/SketchAPI/SketchAPI.i index cc87fa94a..a4cbce863 100644 --- a/src/SketchAPI/SketchAPI.i +++ b/src/SketchAPI/SketchAPI.i @@ -25,9 +25,15 @@ #include "SketchAPI_swig.h" #include "ModelHighAPI_swig.h" - // fix for SWIG v2.0.4 - #define SWIGPY_SLICE_ARG(obj) ((PyObject*)(obj)) + // fix for SWIG v4.1.1 + #if PY_VERSION_HEX >= 0x03020000 + # define SWIGPY_SLICEOBJECT PyObject + #else + # define SWIGPY_SLICEOBJECT PySliceObject + #endif + // fix for SWIG v2.0.4 + #define SWIGPY_SLICE_ARG(obj) ((SWIGPY_SLICEOBJECT*)(obj)) #define SWIGPY_UNICODE_ARG(obj) ((PyObject*) (obj)) %}