#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"
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)
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()
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:
# 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:
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)
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
# 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())
# 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)
#=========================================================================
%{
#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"
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 """
%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
%{
#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))
%}
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())
%{
#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))
%}
%{
#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))
%}
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"""
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)))
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")
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")
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):
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
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
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
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):
#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))
%}