mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-27 20:30:32 +05:00
Provide compatibility with old OCCT versions
This commit is contained in:
parent
dd2ea7185d
commit
4ce47452de
@ -25,6 +25,8 @@
|
|||||||
|
|
||||||
#include <GEOMAlgo_AlgoTools.hxx>
|
#include <GEOMAlgo_AlgoTools.hxx>
|
||||||
|
|
||||||
|
#include <Basics_OCCTVersion.hxx>
|
||||||
|
|
||||||
#include <gp_Pnt.hxx>
|
#include <gp_Pnt.hxx>
|
||||||
#include <gp_Pnt2d.hxx>
|
#include <gp_Pnt2d.hxx>
|
||||||
#include <gp_Dir2d.hxx>
|
#include <gp_Dir2d.hxx>
|
||||||
@ -87,7 +89,6 @@
|
|||||||
#include <TopTools_ListOfShape.hxx>
|
#include <TopTools_ListOfShape.hxx>
|
||||||
#include <TopTools_MapOfShape.hxx>
|
#include <TopTools_MapOfShape.hxx>
|
||||||
#include <TopTools_DataMapOfShapeReal.hxx>
|
#include <TopTools_DataMapOfShapeReal.hxx>
|
||||||
//#include <TColgp_Array1OfPnt.hxx>
|
|
||||||
#include <TColgp_SequenceOfPnt2d.hxx>
|
#include <TColgp_SequenceOfPnt2d.hxx>
|
||||||
|
|
||||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||||
@ -1058,6 +1059,9 @@ Standard_Integer GEOMAlgo_AlgoTools::PointCloudInFace(const TopoDS_Face& theFace
|
|||||||
const int theNbPnts,
|
const int theNbPnts,
|
||||||
TopoDS_Compound& theCompound)
|
TopoDS_Compound& theCompound)
|
||||||
{
|
{
|
||||||
|
#if OCC_VERSION_LARGE < 0x07050304
|
||||||
|
return -1;
|
||||||
|
#else
|
||||||
ShapeUpgrade_ShapeDivideArea tool (theFace);
|
ShapeUpgrade_ShapeDivideArea tool (theFace);
|
||||||
tool.SetSplittingByNumber (Standard_True);
|
tool.SetSplittingByNumber (Standard_True);
|
||||||
tool.NbParts() = theNbPnts;
|
tool.NbParts() = theNbPnts;
|
||||||
@ -1199,6 +1203,7 @@ Standard_Integer GEOMAlgo_AlgoTools::PointCloudInFace(const TopoDS_Face& theFace
|
|||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
Standard_Boolean comp(const std::pair<TopoDS_Shape, Standard_Real>& theA,
|
Standard_Boolean comp(const std::pair<TopoDS_Shape, Standard_Real>& theA,
|
||||||
@ -1531,6 +1536,9 @@ void ModifyFacesForGlobalResult(const TopoDS_Face& theInputFace,
|
|||||||
Standard_Integer aNbFacesInLocalResult;
|
Standard_Integer aNbFacesInLocalResult;
|
||||||
if (aNumberToSplit > 1)
|
if (aNumberToSplit > 1)
|
||||||
{
|
{
|
||||||
|
#if OCC_VERSION_LARGE < 0x07050304
|
||||||
|
aNbFacesInLocalResult = 0;
|
||||||
|
#else
|
||||||
ShapeUpgrade_ShapeDivideArea aLocalTool (aUnifiedShape);
|
ShapeUpgrade_ShapeDivideArea aLocalTool (aUnifiedShape);
|
||||||
aLocalTool.SetSplittingByNumber (Standard_True);
|
aLocalTool.SetSplittingByNumber (Standard_True);
|
||||||
aLocalTool.MaxArea() = -1;
|
aLocalTool.MaxArea() = -1;
|
||||||
@ -1541,6 +1549,7 @@ void ModifyFacesForGlobalResult(const TopoDS_Face& theInputFace,
|
|||||||
aLocalTool.Perform();
|
aLocalTool.Perform();
|
||||||
aLocalResult = aLocalTool.Result();
|
aLocalResult = aLocalTool.Result();
|
||||||
aNbFacesInLocalResult = aNumberToSplit;
|
aNbFacesInLocalResult = aNumberToSplit;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1605,6 +1614,9 @@ void ModifyFacesForGlobalResult(const TopoDS_Face& theInputFace,
|
|||||||
Standard_Integer aNumberToSplit = (theIsToAddFaces)? aMaxNbFaces + (aDiff-aSum) : aMaxNbFaces - (aDiff-aSum);
|
Standard_Integer aNumberToSplit = (theIsToAddFaces)? aMaxNbFaces + (aDiff-aSum) : aMaxNbFaces - (aDiff-aSum);
|
||||||
if (aNumberToSplit > 1)
|
if (aNumberToSplit > 1)
|
||||||
{
|
{
|
||||||
|
#if OCC_VERSION_LARGE < 0x07050304
|
||||||
|
aNumberToSplit = 1;
|
||||||
|
#else
|
||||||
ShapeUpgrade_ShapeDivideArea aLocalTool (aUnifiedShape);
|
ShapeUpgrade_ShapeDivideArea aLocalTool (aUnifiedShape);
|
||||||
aLocalTool.SetSplittingByNumber (Standard_True);
|
aLocalTool.SetSplittingByNumber (Standard_True);
|
||||||
aLocalTool.MaxArea() = -1;
|
aLocalTool.MaxArea() = -1;
|
||||||
@ -1614,6 +1626,7 @@ void ModifyFacesForGlobalResult(const TopoDS_Face& theInputFace,
|
|||||||
aLocalTool.SetNumbersUVSplits (1, aNumberToSplit);
|
aLocalTool.SetNumbersUVSplits (1, aNumberToSplit);
|
||||||
aLocalTool.Perform();
|
aLocalTool.Perform();
|
||||||
aLocalResult = aLocalTool.Result();
|
aLocalResult = aLocalTool.Result();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
aNumberToSplit = 1;
|
aNumberToSplit = 1;
|
||||||
|
@ -22,6 +22,8 @@
|
|||||||
|
|
||||||
#include <Standard_Stream.hxx>
|
#include <Standard_Stream.hxx>
|
||||||
|
|
||||||
|
#include <Basics_OCCTVersion.hxx>
|
||||||
|
|
||||||
#include <GEOMImpl_PointDriver.hxx>
|
#include <GEOMImpl_PointDriver.hxx>
|
||||||
#include <GEOMImpl_IPoint.hxx>
|
#include <GEOMImpl_IPoint.hxx>
|
||||||
#include <GEOMImpl_Types.hxx>
|
#include <GEOMImpl_Types.hxx>
|
||||||
@ -57,6 +59,7 @@
|
|||||||
#include <Precision.hxx>
|
#include <Precision.hxx>
|
||||||
|
|
||||||
#include <Standard_NullObject.hxx>
|
#include <Standard_NullObject.hxx>
|
||||||
|
#include <Standard_NotImplemented.hxx>
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : GetID
|
//function : GetID
|
||||||
@ -318,8 +321,13 @@ Standard_Integer GEOMImpl_PointDriver::Execute(Handle(TFunction_Logbook)& log) c
|
|||||||
}
|
}
|
||||||
else
|
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;
|
retCompound = true;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (aType == POINT_LINES_INTERSECTION) {
|
else if (aType == POINT_LINES_INTERSECTION) {
|
||||||
|
@ -12,11 +12,15 @@ Sphere = geompy.MakeSphereR(10, "Sphere")
|
|||||||
[Face] = geompy.ExtractShapes(Sphere, geompy.ShapeType["FACE"], True, "Sphere_face")
|
[Face] = geompy.ExtractShapes(Sphere, geompy.ShapeType["FACE"], True, "Sphere_face")
|
||||||
|
|
||||||
# make a cloud of 100 points on the spherical face
|
# make a cloud of 100 points on the spherical face
|
||||||
CompoundOfVertices = geompy.MakeVertexInsideFace(Face, 100, "CompoundOfVertices")
|
try:
|
||||||
|
CompoundOfVertices = geompy.MakeVertexInsideFace(Face, 100, "CompoundOfVertices")
|
||||||
# check result
|
except Exception as err:
|
||||||
nb_vert = geompy.NumberOfSubShapes(CompoundOfVertices, geompy.ShapeType["VERTEX"])
|
print(err)
|
||||||
assert(geompy.NumberOfSubShapes(CompoundOfVertices, geompy.ShapeType["VERTEX"]) == 100)
|
# this test should not fail in case of "Improper OCCT version"
|
||||||
|
assert("Improper OCCT version" in str(err))
|
||||||
|
else:
|
||||||
|
# check result
|
||||||
|
assert(geompy.NumberOfSubShapes(CompoundOfVertices, geompy.ShapeType["VERTEX"]) == 100)
|
||||||
|
|
||||||
# test point cloud on a "Horse saddle"
|
# test point cloud on a "Horse saddle"
|
||||||
OX = geompy.MakeVectorDXDYDZ(1, 0, 0, 'OX')
|
OX = geompy.MakeVectorDXDYDZ(1, 0, 0, 'OX')
|
||||||
@ -30,5 +34,11 @@ Translation_3 = geompy.MakeTranslation(Translation_2, 0, -200, 0, 'Translation_3
|
|||||||
Filling_1 = geompy.MakeFilling([Translation_2, Edge_3, Translation_3])
|
Filling_1 = geompy.MakeFilling([Translation_2, Edge_3, Translation_3])
|
||||||
geompy.addToStudy(Filling_1, 'Filling_1')
|
geompy.addToStudy(Filling_1, 'Filling_1')
|
||||||
|
|
||||||
PointCloudOnFilling = geompy.MakeVertexInsideFace(Face, 30, "PointCloudOnFilling")
|
try:
|
||||||
assert(geompy.NumberOfSubShapes(PointCloudOnFilling, geompy.ShapeType["VERTEX"]) == 30)
|
PointCloudOnFilling = geompy.MakeVertexInsideFace(Filling_1, 30, "PointCloudOnFilling")
|
||||||
|
except Exception as err:
|
||||||
|
print(err)
|
||||||
|
# this test should not fail in case of "Improper OCCT version"
|
||||||
|
assert("Improper OCCT version" in str(err))
|
||||||
|
else:
|
||||||
|
assert(geompy.NumberOfSubShapes(PointCloudOnFilling, geompy.ShapeType["VERTEX"]) == 30)
|
||||||
|
Loading…
Reference in New Issue
Block a user