#include <ShapeFix_Face.hxx>
#include <ShapeFix_Shell.hxx>
#include <ShapeFix_Wire.hxx>
+#include <Standard_NullValue.hxx>
#include <Standard_Type.hxx>
#include <TColGeom2d_Array1OfBSplineCurve.hxx>
#include <TColGeom2d_HArray1OfBSplineCurve.hxx>
static Handle(Geom_Surface) ClearRts(const Handle(Geom_Surface)& aSurface)
{
- if (aSurface->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface)))
- {
- Handle(Geom_RectangularTrimmedSurface) rts =
- Handle(Geom_RectangularTrimmedSurface)::DownCast(aSurface);
- return rts->BasisSurface();
- }
- return aSurface;
+ const Handle(Geom_RectangularTrimmedSurface) aRTS =
+ Handle(Geom_RectangularTrimmedSurface)::DownCast(aSurface);
+ return aRTS.IsNull() ? aSurface : aRTS->BasisSurface();
}
//=======================================================================
TopExp_Explorer exp;
for (exp.Init(theInpShape, TopAbs_FACE); exp.More(); exp.Next())
{
-
- TopoDS_Face aFace = TopoDS::Face(exp.Current());
-
+ const TopoDS_Face aFace = TopoDS::Face(exp.Current());
if (aProcessed.Contains(aFace))
+ {
continue;
+ }
+
+ const Handle(Geom_Surface) aBaseSurface = ClearRts(BRep_Tool::Surface(aFace));
+ // Bug 33894: Prevent crash when face has no surface
+ if (aBaseSurface.IsNull())
+ {
+ continue;
+ }
// Boundary edges for the new face
TopTools_SequenceOfShape edges;
faces.Append(aFace);
// surface and location to construct result
- TopLoc_Location aBaseLocation;
- Handle(Geom_Surface) aBaseSurface = BRep_Tool::Surface(aFace);
- aBaseSurface = ClearRts(aBaseSurface);
+ TopLoc_Location aBaseLocation;
TopAbs_Orientation RefFaceOrientation = aFace.Orientation();
// Take original surface
--- /dev/null
+puts "========================================================================"
+puts "Bug 33894: unifysamedom crashes on tessellated geometry without surfaces"
+puts "No crash expected"
+puts "========================================================================"
+
+pload XDE MODELING
+
+stepread [locate_data_file gh624_tessellated_tetrahedron_ap242.step] anInputShape *
+
+# Check what kind of shape we get
+checknbshapes anInputShape_1 -t
+
+# Validate shape - will show BRepCheck_NoSurface errors
+puts "REQUIRED All: Faulty shapes in variables faulty_1 to faulty_6"
+checkshape anInputShape_1
+
+# Unify shapes. No crash expected.
+unifysamedom aUnified anInputShape_1
+
+# Check result.
+checknbshapes aUnified -face 4 -shell 1 -solid 1 -shape 6 -t