From b792aba95fee67b1a0cf06a0326bc22468e802c7 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Tue, 21 Jun 2016 11:19:51 +0200 Subject: [PATCH] Support for *BrepWithVoids --- src/ifcgeom/IfcGeomShapes.cpp | 22 +++++++++++++++++++++- src/ifcgeom/IfcRegister.h | 6 +++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/ifcgeom/IfcGeomShapes.cpp b/src/ifcgeom/IfcGeomShapes.cpp index 22751c56fa..b6436d38cb 100644 --- a/src/ifcgeom/IfcGeomShapes.cpp +++ b/src/ifcgeom/IfcGeomShapes.cpp @@ -260,11 +260,31 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcRevolvedAreaSolid* l, TopoDS_S return !shape.IsNull(); } -bool IfcGeom::Kernel::convert(const IfcSchema::IfcFacetedBrep* l, IfcRepresentationShapeItems& shape) { +bool IfcGeom::Kernel::convert(const IfcSchema::IfcManifoldSolidBrep* l, IfcRepresentationShapeItems& shape) { TopoDS_Shape s; const SurfaceStyle* collective_style = get_style(l); if (convert_shape(l->Outer(),s) ) { const SurfaceStyle* indiv_style = get_style(l->Outer()); + + IfcSchema::IfcClosedShell::list::ptr voids(new IfcSchema::IfcClosedShell::list); + if (l->is(IfcSchema::Type::IfcFacetedBrepWithVoids)) { + voids = l->as()->Voids(); + } +#ifdef USE_IFC4 + if (l->is(IfcSchema::Type::IfcAdvancedBrepWithVoids)) { + voids = l->as()->Voids(); + } +#endif + + for (IfcSchema::IfcClosedShell::list::it it = voids->begin(); it != voids->end(); ++it) { + TopoDS_Shape s2; + /// @todo No extensive shapefixing since shells should be disjoint. + /// @todo Awaiting generalized boolean ops module with appropriate checking + if (convert_shape(l->Outer(), s2)) { + s = BRepAlgoAPI_Cut(s, s2).Shape(); + } + } + shape.push_back(IfcRepresentationShapeItem(s, indiv_style ? indiv_style : collective_style)); return true; } diff --git a/src/ifcgeom/IfcRegister.h b/src/ifcgeom/IfcRegister.h index 305c0c9f5e..8308ec0748 100644 --- a/src/ifcgeom/IfcRegister.h +++ b/src/ifcgeom/IfcRegister.h @@ -45,7 +45,11 @@ SHAPES(IfcShellBasedSurfaceModel); SHAPES(IfcFaceBasedSurfaceModel); SHAPES(IfcRepresentation); SHAPES(IfcMappedItem); -SHAPES(IfcFacetedBrep); +// IfcFacetedBrep included +// IfcAdvancedBrep included +// IfcFacetedBrepWithVoids included +// IfcAdvancedBrepWithVoids included +SHAPES(IfcManifoldSolidBrep); SHAPES(IfcGeometricSet); #ifdef USE_IFC4