#include <GEOMAlgo_AlgoTools.hxx>
+#include <Basics_OCCTVersion.hxx>
+
#include <gp_Pnt.hxx>
#include <gp_Pnt2d.hxx>
#include <gp_Dir2d.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_MapOfShape.hxx>
#include <TopTools_DataMapOfShapeReal.hxx>
-//#include <TColgp_Array1OfPnt.hxx>
#include <TColgp_SequenceOfPnt2d.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
const int theNbPnts,
TopoDS_Compound& theCompound)
{
+#if OCC_VERSION_LARGE < 0x07050304
+ return -1;
+#else
ShapeUpgrade_ShapeDivideArea tool (theFace);
tool.SetSplittingByNumber (Standard_True);
tool.NbParts() = theNbPnts;
}
return 0;
+#endif
}
Standard_Boolean comp(const std::pair<TopoDS_Shape, Standard_Real>& theA,
Standard_Integer aNbFacesInLocalResult;
if (aNumberToSplit > 1)
{
+#if OCC_VERSION_LARGE < 0x07050304
+ aNbFacesInLocalResult = 0;
+#else
ShapeUpgrade_ShapeDivideArea aLocalTool (aUnifiedShape);
aLocalTool.SetSplittingByNumber (Standard_True);
aLocalTool.MaxArea() = -1;
aLocalTool.Perform();
aLocalResult = aLocalTool.Result();
aNbFacesInLocalResult = aNumberToSplit;
+#endif
}
else
{
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;
#include <Standard_Stream.hxx>
+#include <Basics_OCCTVersion.hxx>
+
#include <GEOMImpl_PointDriver.hxx>
#include <GEOMImpl_IPoint.hxx>
#include <GEOMImpl_Types.hxx>
#include <Precision.hxx>
#include <Standard_NullObject.hxx>
+#include <Standard_NotImplemented.hxx>
//=======================================================================
//function : GetID
}
else
{
- GEOMAlgo_AlgoTools::PointCloudInFace (F, aNbPnts, aCompound);
+#if OCC_VERSION_LARGE < 0x07050304
+ Standard_NotImplemented::Raise("Point cloud creation aborted. Improper OCCT version: please, use OCCT 7.5.3p4 or newer.");
+#else
+ if (GEOMAlgo_AlgoTools::PointCloudInFace(F, aNbPnts, aCompound) < 0)
+ Standard_ConstructionError::Raise("Point cloud creation aborted : algorithm failed");
retCompound = true;
+#endif
}
}
else if (aType == POINT_LINES_INTERSECTION) {
[Face] = geompy.ExtractShapes(Sphere, geompy.ShapeType["FACE"], True, "Sphere_face")\r
\r
# make a cloud of 100 points on the spherical face\r
-CompoundOfVertices = geompy.MakeVertexInsideFace(Face, 100, "CompoundOfVertices")\r
-\r
-# check result\r
-nb_vert = geompy.NumberOfSubShapes(CompoundOfVertices, geompy.ShapeType["VERTEX"])\r
-assert(geompy.NumberOfSubShapes(CompoundOfVertices, geompy.ShapeType["VERTEX"]) == 100)\r
+try:\r
+ CompoundOfVertices = geompy.MakeVertexInsideFace(Face, 100, "CompoundOfVertices")\r
+except Exception as err:\r
+ print(err)\r
+ # this test should not fail in case of "Improper OCCT version"\r
+ assert("Improper OCCT version" in str(err))\r
+else:\r
+ # check result\r
+ assert(geompy.NumberOfSubShapes(CompoundOfVertices, geompy.ShapeType["VERTEX"]) == 100)\r
\r
# test point cloud on a "Horse saddle"\r
OX = geompy.MakeVectorDXDYDZ(1, 0, 0, 'OX')\r
Filling_1 = geompy.MakeFilling([Translation_2, Edge_3, Translation_3])\r
geompy.addToStudy(Filling_1, 'Filling_1')\r
\r
-PointCloudOnFilling = geompy.MakeVertexInsideFace(Face, 30, "PointCloudOnFilling")\r
-assert(geompy.NumberOfSubShapes(PointCloudOnFilling, geompy.ShapeType["VERTEX"]) == 30)\r
+try:\r
+ PointCloudOnFilling = geompy.MakeVertexInsideFace(Filling_1, 30, "PointCloudOnFilling")\r
+except Exception as err:\r
+ print(err)\r
+ # this test should not fail in case of "Improper OCCT version"\r
+ assert("Improper OCCT version" in str(err))\r
+else:\r
+ assert(geompy.NumberOfSubShapes(PointCloudOnFilling, geompy.ShapeType["VERTEX"]) == 30)\r