diff --git a/code/IFCGeometry.cpp b/code/IFCGeometry.cpp index 7e35999d8..4fa4fda06 100644 --- a/code/IFCGeometry.cpp +++ b/code/IFCGeometry.cpp @@ -1721,18 +1721,6 @@ void ProcessSweptAreaSolid(const IfcSweptAreaSolid& swept, TempMesh& meshout, ConversionData& conv) { if(const IfcExtrudedAreaSolid* const solid = swept.ToPtr()) { - // Do we just collect openings for a parent element (i.e. a wall)? - // In such a case, we generate the polygonal extrusion mesh as usual, - // but attach it to a TempOpening instance which will later be applied - // to the wall it pertains to. - if(conv.collect_openings) { - boost::shared_ptr meshtmp(new TempMesh()); - ProcessExtrudedAreaSolid(*solid,*meshtmp,conv); - - conv.collect_openings->push_back(TempOpening(solid,IfcVector3(0,0,0),meshtmp)); - return; - } - ProcessExtrudedAreaSolid(*solid,meshout,conv); } else if(const IfcRevolvedAreaSolid* const rev = swept.ToPtr()) { @@ -1976,14 +1964,14 @@ bool ProcessGeometricItem(const IfcRepresentationItem& geo, std::vector meshtmp = boost::make_shared(); if(const IfcShellBasedSurfaceModel* shellmod = geo.ToPtr()) { BOOST_FOREACH(boost::shared_ptr shell,shellmod->SbsmBoundary) { try { const EXPRESS::ENTITY& e = shell->To(); const IfcConnectedFaceSet& fs = conv.db.MustGetObject(e).To(); - ProcessConnectedFaceSet(fs,meshtmp,conv); + ProcessConnectedFaceSet(fs,*meshtmp.get(),conv); } catch(std::bad_cast&) { IFCImporter::LogWarn("unexpected type error, IfcShell ought to inherit from IfcConnectedFaceSet"); @@ -1991,25 +1979,25 @@ bool ProcessGeometricItem(const IfcRepresentationItem& geo, std::vector()) { - ProcessConnectedFaceSet(*fset,meshtmp,conv); + ProcessConnectedFaceSet(*fset,*meshtmp.get(),conv); } else if(const IfcSweptAreaSolid* swept = geo.ToPtr()) { - ProcessSweptAreaSolid(*swept,meshtmp,conv); + ProcessSweptAreaSolid(*swept,*meshtmp.get(),conv); } else if(const IfcSweptDiskSolid* disk = geo.ToPtr()) { - ProcessSweptDiskSolid(*disk,meshtmp,conv); + ProcessSweptDiskSolid(*disk,*meshtmp.get(),conv); fix_orientation = false; } else if(const IfcManifoldSolidBrep* brep = geo.ToPtr()) { - ProcessConnectedFaceSet(brep->Outer,meshtmp,conv); + ProcessConnectedFaceSet(brep->Outer,*meshtmp.get(),conv); } else if(const IfcFaceBasedSurfaceModel* surf = geo.ToPtr()) { BOOST_FOREACH(const IfcConnectedFaceSet& fc, surf->FbsmFaces) { - ProcessConnectedFaceSet(fc,meshtmp,conv); + ProcessConnectedFaceSet(fc,*meshtmp.get(),conv); } } else if(const IfcBooleanResult* boolean = geo.ToPtr()) { - ProcessBoolean(*boolean,meshtmp,conv); + ProcessBoolean(*boolean,*meshtmp.get(),conv); } else if(geo.ToPtr()) { // silently skip over bounding boxes @@ -2020,14 +2008,23 @@ bool ProcessGeometricItem(const IfcRepresentationItem& geo, std::vectorRemoveAdjacentDuplicates(); + meshtmp->RemoveDegenerates(); + + // Do we just collect openings for a parent element (i.e. a wall)? + // In such a case, we generate the polygonal extrusion mesh as usual, + // but attach it to a TempOpening instance which will later be applied + // to the wall it pertains to. + if(conv.collect_openings) { + conv.collect_openings->push_back(TempOpening(geo.ToPtr(),IfcVector3(0,0,0),meshtmp)); + return true; + } if(fix_orientation) { - meshtmp.FixupFaceOrientation(); + meshtmp->FixupFaceOrientation(); } - aiMesh* const mesh = meshtmp.ToMesh(); + aiMesh* const mesh = meshtmp->ToMesh(); if(mesh) { mesh->mMaterialIndex = ProcessMaterials(geo,conv); mesh_indices.push_back(conv.meshes.size()); diff --git a/code/IFCUtil.h b/code/IFCUtil.h index 22cc747fa..6323a032b 100644 --- a/code/IFCUtil.h +++ b/code/IFCUtil.h @@ -76,7 +76,7 @@ struct delete_fun struct TempMesh; struct TempOpening { - const IFC::IfcExtrudedAreaSolid* solid; + const IFC::IfcSolidModel* solid; IfcVector3 extrusionDir; boost::shared_ptr profileMesh; @@ -96,7 +96,7 @@ struct TempOpening } // ------------------------------------------------------------------------------ - TempOpening(const IFC::IfcExtrudedAreaSolid* solid,IfcVector3 extrusionDir,boost::shared_ptr profileMesh) + TempOpening(const IFC::IfcSolidModel* solid,IfcVector3 extrusionDir,boost::shared_ptr profileMesh) : solid(solid) , extrusionDir(extrusionDir) , profileMesh(profileMesh)