[bos #43278][EDF 25230] MakeVertexInsideFace too long. Added ShapeFix for result created by ShapeUpgrade_ShapeDivideArea.

This commit is contained in:
Konstantin Leontev 2024-10-25 16:41:33 +01:00
parent c4da8107c8
commit ad427fadef
3 changed files with 47 additions and 0 deletions

View File

@ -101,6 +101,7 @@
#include <ShapeUpgrade_ShapeDivideArea.hxx>
#include <ShapeUpgrade_UnifySameDomain.hxx>
#include <ShapeFix.hxx>
#include <GEOMAlgo_PassKeyShape.hxx>
@ -1015,6 +1016,13 @@ Standard_Integer GEOMAlgo_AlgoTools::PointCloudInFace(const TopoDS_Face& theFace
tool.NbParts() = theNbPnts;
tool.Perform();
TopoDS_Shape res = tool.Result();
if (res.IsNull())
return -1;
// Splitting algorithm can produces invalid shapes that results in
// infinite loop on ShapeUpgrade_UnifySameDomain::build() call.
// Here is a fix from OCCT DRAW: SWDRAW_ShapeUpgrade: splitbynumber().
ShapeFix::SameParameter(res, Standard_False);
BRep_Builder aBB;
TopoDS_Compound aGlobalRes;
@ -1528,6 +1536,12 @@ void ModifyFacesForGlobalResult(const TopoDS_Face& theInputFace,
aLocalTool.SetNumbersUVSplits (1, aNumberToSplit);
aLocalTool.Perform();
aLocalResult = aLocalTool.Result();
// Splitting algorithm can produces invalid shapes that results in
// infinite loop on ShapeUpgrade_UnifySameDomain::build() call.
// Here is a fix from OCCT DRAW: SWDRAW_ShapeUpgrade: splitbynumber().
ShapeFix::SameParameter(aLocalResult, Standard_False);
aNbFacesInLocalResult = aNumberToSplit;
#endif
}
@ -1608,6 +1622,11 @@ void ModifyFacesForGlobalResult(const TopoDS_Face& theInputFace,
aLocalTool.SetNumbersUVSplits (1, aNumberToSplit);
aLocalTool.Perform();
aLocalResult = aLocalTool.Result();
// Splitting algorithm can produces invalid shapes that results in
// infinite loop on ShapeUpgrade_UnifySameDomain::build() call.
// Here is a fix from OCCT DRAW: SWDRAW_ShapeUpgrade: splitbynumber().
ShapeFix::SameParameter(aLocalResult, Standard_False);
#endif
}
else

View File

@ -0,0 +1,27 @@
# Point Cloud on Face Cone
from salome.geom import geomBuilder
geompy = geomBuilder.New()
# Create one closed cone face
O = geompy.MakeVertex(0, 0, 0)
OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
Cone_1 = geompy.MakeConeR1R2H(50, 100, 50)
[Face_1] = geompy.SubShapes(Cone_1, [3])
geompy.addToStudy( O, 'O' )
geompy.addToStudy( OX, 'OX' )
geompy.addToStudy( OY, 'OY' )
geompy.addToStudy( OZ, 'OZ' )
geompy.addToStudy( Cone_1, 'Cone_1' )
geompy.addToStudyInFather( Cone_1, Face_1, 'Face_1' )
# Make a cloud of given number of points in range 1-30 on the cone face
try:
for i in range(1, 31):
PointCloudOnFilling = geompy.MakeVertexInsideFace(Face_1, i, "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))

View File

@ -24,6 +24,7 @@ SET(ALL_TESTS
IF(${OpenCASCADE_VERSION}.${OpenCASCADE_SP_VERSION} VERSION_GREATER "7.5.3.3")
LIST(APPEND ALL_TESTS
test_point_cloud_on_face_cone.py
test_point_cloud_on_face.py
test_CR.py
test_conformity.py