model.end()
### Check result
-model.testNbResults(PC_1, 1)
-model.testNbSubResults(PC_1, [0])
-model.testNbSubShapes(PC_1, GeomAPI_Shape.SOLID, [0])
-model.testNbSubShapes(PC_1, GeomAPI_Shape.FACE, [0])
-model.testNbSubShapes(PC_1, GeomAPI_Shape.EDGE, [0])
-model.testNbSubShapes(PC_1, GeomAPI_Shape.VERTEX, [100])
-
-assert(model.checkPythonDump())
+err = PC_1.feature().error()
+if err != "":
+ print(err)
+ # this test should not fail with old OCCT
+ assert("Improper OCCT version" in err)
+else:
+ model.testNbResults(PC_1, 1)
+ model.testNbSubResults(PC_1, [0])
+ model.testNbSubShapes(PC_1, GeomAPI_Shape.SOLID, [0])
+ model.testNbSubShapes(PC_1, GeomAPI_Shape.FACE, [0])
+ model.testNbSubShapes(PC_1, GeomAPI_Shape.EDGE, [0])
+ model.testNbSubShapes(PC_1, GeomAPI_Shape.VERTEX, [100])
+
+ assert(model.checkPythonDump())
#include <BRepBuilderAPI_MakeEdge.hxx>
#include <TopTools_DataMapOfShapeReal.hxx>
+#include <Standard_Version.hxx>
+// code from KERNEL_SRC/src/Basics/Basics_OCCTVersion.hxx
+#ifdef OCC_VERSION_SERVICEPACK
+# define OCC_VERSION_LARGE (OCC_VERSION_MAJOR << 24 | OCC_VERSION_MINOR << 16 | OCC_VERSION_MAINTENANCE << 8 | OCC_VERSION_SERVICEPACK)
+#else
+# ifdef OCC_VERSION_DEVELOPMENT
+# define OCC_VERSION_LARGE ((OCC_VERSION_MAJOR << 24 | OCC_VERSION_MINOR << 16 | OCC_VERSION_MAINTENANCE << 8)-1)
+# else
+# define OCC_VERSION_LARGE (OCC_VERSION_MAJOR << 24 | OCC_VERSION_MINOR << 16 | OCC_VERSION_MAINTENANCE << 8)
+# endif
+#endif
+
#include <algorithm>
Standard_Boolean comp(const std::pair<TopoDS_Shape, Standard_Real>& theA,
TopoDS_Shape aUnifiedShape = aUnifier.Shape();
//Splitting
TopoDS_Shape aLocalResult = aUnifiedShape;
- Standard_Integer aNbFacesInLocalResult;
+ Standard_Integer aNbFacesInLocalResult = 1;
if (aNumberToSplit > 1)
{
+#if OCC_VERSION_LARGE < 0x07050304
+ aNbFacesInLocalResult = 1;
+#else
ShapeUpgrade_ShapeDivideArea aLocalTool (aUnifiedShape);
aLocalTool.SetSplittingByNumber (Standard_True);
aLocalTool.MaxArea() = -1;
aLocalTool.Perform();
aLocalResult = aLocalTool.Result();
aNbFacesInLocalResult = aNumberToSplit;
+#endif
}
else
{
- aNbFacesInLocalResult = 1;
if (aNumberToSplit == 0)
{
theExtremalFaces.Add (theFacesAndAreas[theNbExtremalFaces].first);
Standard_Integer aNumberToSplit = (theIsToAddFaces)? aMaxNbFaces + (aDiff-aSum) : aMaxNbFaces - (aDiff-aSum);
if (aNumberToSplit > 1)
{
+#if OCC_VERSION_LARGE < 0x07050304
+ aNumberToSplit = 1;
+#else
ShapeUpgrade_ShapeDivideArea aLocalTool (aUnifiedShape);
aLocalTool.SetSplittingByNumber (Standard_True);
aLocalTool.MaxArea() = -1;
aLocalTool.SetNumbersUVSplits (1, aNumberToSplit);
aLocalTool.Perform();
aLocalResult = aLocalTool.Result();
+#endif
}
else
aNumberToSplit = 1;
GeomShapePtr thePoints,
std::string& theError)
{
- #ifdef _DEBUG
+#ifdef _DEBUG
std::cout << "GeomAlgoAPI_PointCloudOnFace::PointCloud" << std::endl;
- #endif
+#endif
+
+#if OCC_VERSION_LARGE < 0x07050304
+ theError = "Improper OCCT version: please, use OCCT 7.5.3p4 or newer.";
+ return false;
+#else
if (!theFace.get()) {
theError = "Face for point cloud calculation is null";
thePoints->setImpl(new TopoDS_Shape(aCompound));
return true;
+#endif
}