Defend against surface not created from invalid face

This commit is contained in:
bgbsww
2023-11-09 08:16:46 -05:00
committed by Adrián Insaurralde Avalos
parent 59b64ebab0
commit 8cc48c488f

View File

@@ -65,6 +65,7 @@
# endif
#endif
#include <Base/Exception.h>
#include <Base/Vector3D.h>
#include "Tools.h"
@@ -640,8 +641,10 @@ Handle (Poly_Triangulation) Part::Tools::triangulationOfFace(const TopoDS_Face&
selectRange(v1, v2);
Handle(Geom_Surface) surface = BRep_Tool::Surface(face);
if ( surface.IsNull() ) {
FC_THROWM(Base::CADKernelError, "Cannot create surface from face");
}
BRepBuilderAPI_MakeFace mkBuilder(surface, u1, u2, v1, v2, Precision::Confusion() );
TopoDS_Shape shape = mkBuilder.Shape();
shape.Location(loc);