diff --git a/src/ifcgeom/IfcGeom.h b/src/ifcgeom/IfcGeom.h index b3731ff072..5f6689ee4b 100644 --- a/src/ifcgeom/IfcGeom.h +++ b/src/ifcgeom/IfcGeom.h @@ -352,7 +352,8 @@ public: IfcSchema::IfcSurfaceStyleShading* get_surface_style(IfcSchema::IfcRepresentationItem* item); const IfcSchema::IfcRepresentationItem* find_item_carrying_style(const IfcSchema::IfcRepresentationItem* item); bool create_solid_from_compound(const TopoDS_Shape& compound, TopoDS_Shape& solid); - bool create_solid_from_faces(const TopTools_ListOfShape& face_list, TopoDS_Shape& solid); + bool shape_to_face_list(const TopoDS_Shape& s, TopTools_ListOfShape& li); + bool create_solid_from_faces(const TopTools_ListOfShape& face_list, TopoDS_Shape& solid, bool force_sewing=false); bool is_compound(const TopoDS_Shape& shape); bool is_convex(const TopoDS_Wire& wire); TopoDS_Shape halfspace_from_plane(const gp_Pln& pln,const gp_Pnt& cent); diff --git a/src/ifcgeom/IfcGeomFunctions.cpp b/src/ifcgeom/IfcGeomFunctions.cpp index c2cfa9712b..2b98875e6e 100644 --- a/src/ifcgeom/IfcGeomFunctions.cpp +++ b/src/ifcgeom/IfcGeomFunctions.cpp @@ -529,22 +529,25 @@ void IfcGeom::Kernel::set_rotation(const std::array &p_rotation) { offset_and_rotation = combine_offset_and_rotation(offset, rotation); } -bool IfcGeom::Kernel::create_solid_from_compound(const TopoDS_Shape& compound, TopoDS_Shape& shape) { - TopTools_ListOfShape face_list; - TopExp_Explorer exp(compound, TopAbs_FACE); +bool IfcGeom::Kernel::shape_to_face_list(const TopoDS_Shape& s, TopTools_ListOfShape& li) { + TopExp_Explorer exp(s, TopAbs_FACE); for (; exp.More(); exp.Next()) { TopoDS_Face face = TopoDS::Face(exp.Current()); - face_list.Append(face); + li.Append(face); } + return true; +} +bool IfcGeom::Kernel::create_solid_from_compound(const TopoDS_Shape& compound, TopoDS_Shape& shape) { + TopTools_ListOfShape face_list; + shape_to_face_list(compound, face_list); if (face_list.Extent() == 0) { return false; } - return create_solid_from_faces(face_list, shape); } -bool IfcGeom::Kernel::create_solid_from_faces(const TopTools_ListOfShape& face_list, TopoDS_Shape& shape) { +bool IfcGeom::Kernel::create_solid_from_faces(const TopTools_ListOfShape& face_list, TopoDS_Shape& shape, bool force_sewing) { bool valid_shell = false; if (face_list.Extent() == 1) { @@ -565,7 +568,7 @@ bool IfcGeom::Kernel::create_solid_from_faces(const TopTools_ListOfShape& face_l // found a case where this actually improves boolean ops later on. // if (!faceset_helper_ || !faceset_helper_->non_manifold()) { - for (face_iterator.Initialize(face_list); face_iterator.More(); face_iterator.Next()) { + for (face_iterator.Initialize(face_list); !force_sewing && face_iterator.More(); face_iterator.Next()) { // As soon as is detected one of the edges is shared, the assumption is made no // additional sewing is necessary. if (!has_shared_edges) { diff --git a/src/ifcgeom/IfcGeomShapes.cpp b/src/ifcgeom/IfcGeomShapes.cpp index 81dca71450..5dd6187ed3 100644 --- a/src/ifcgeom/IfcGeomShapes.cpp +++ b/src/ifcgeom/IfcGeomShapes.cpp @@ -240,18 +240,12 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcExtrudedAreaSolidTapered* l, T TopoDS_Shape result = builder.Shape(); - BRepOffsetAPI_Sewing sewer; - sewer.SetTolerance(getValue(GV_PRECISION)); - sewer.SetMaxTolerance(getValue(GV_PRECISION)); - sewer.SetMinTolerance(getValue(GV_PRECISION)); - - sewer.Add(result); - sewer.Add(BRepBuilderAPI_MakeFace(w1).Face()); - sewer.Add(BRepBuilderAPI_MakeFace(w2).Face().Moved(end_profile)); - - sewer.Perform(); - - result = sewer.SewedShape(); + TopTools_ListOfShape li; + shape_to_face_list(result, li); + li.Append(BRepBuilderAPI_MakeFace(w1).Face().Reversed()); + li.Append(BRepBuilderAPI_MakeFace(w2).Face().Moved(end_profile)); + + create_solid_from_faces(li, result, true); // @todo ugly hack