MCPcopy Create free account
hub / github.com/assimp/assimp / ProcessGeometricItem

Function ProcessGeometricItem

code/AssetLib/IFC/IFCGeometry.cpp:744–825  ·  view source on GitHub ↗

------------------------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

742
743// ------------------------------------------------------------------------------------------------
744bool ProcessGeometricItem(const Schema_2x3::IfcRepresentationItem& geo,
745 unsigned int matid,
746 std::set<unsigned int>& mesh_indices,
747 ConversionData& conv) {
748 bool fix_orientation = false;
749 std::shared_ptr< TempMesh > meshtmp = std::make_shared<TempMesh>();
750 if(const Schema_2x3::IfcShellBasedSurfaceModel* shellmod = geo.ToPtr<Schema_2x3::IfcShellBasedSurfaceModel>()) {
751 for (const std::shared_ptr<const Schema_2x3::IfcShell> &shell : shellmod->SbsmBoundary) {
752 try {
753 const ::Assimp::STEP::EXPRESS::ENTITY& e = shell->To<::Assimp::STEP::EXPRESS::ENTITY>();
754 const Schema_2x3::IfcConnectedFaceSet& fs = conv.db.MustGetObject(e).To<Schema_2x3::IfcConnectedFaceSet>();
755
756 ProcessConnectedFaceSet(fs, *meshtmp, conv);
757 } catch(std::bad_cast&) {
758 IFCImporter::LogWarn("unexpected type error, IfcShell ought to inherit from IfcConnectedFaceSet");
759 }
760 }
761 fix_orientation = true;
762 } else if(const Schema_2x3::IfcConnectedFaceSet* fset = geo.ToPtr<Schema_2x3::IfcConnectedFaceSet>()) {
763 ProcessConnectedFaceSet(*fset, *meshtmp, conv);
764 fix_orientation = true;
765 } else if(const Schema_2x3::IfcSweptAreaSolid* swept = geo.ToPtr<Schema_2x3::IfcSweptAreaSolid>()) {
766 ProcessSweptAreaSolid(*swept, *meshtmp, conv);
767 } else if(const Schema_2x3::IfcSweptDiskSolid* disk = geo.ToPtr<Schema_2x3::IfcSweptDiskSolid>()) {
768 ProcessSweptDiskSolid(*disk, *meshtmp, conv);
769 } else if(const Schema_2x3::IfcManifoldSolidBrep* brep = geo.ToPtr<Schema_2x3::IfcManifoldSolidBrep>()) {
770 ProcessConnectedFaceSet(brep->Outer, *meshtmp, conv);
771 fix_orientation = true;
772 } else if(const Schema_2x3::IfcFaceBasedSurfaceModel* surf = geo.ToPtr<Schema_2x3::IfcFaceBasedSurfaceModel>()) {
773 for(const Schema_2x3::IfcConnectedFaceSet& fc : surf->FbsmFaces) {
774 ProcessConnectedFaceSet(fc, *meshtmp, conv);
775 }
776 fix_orientation = true;
777 } else if(const Schema_2x3::IfcBooleanResult* boolean = geo.ToPtr<Schema_2x3::IfcBooleanResult>()) {
778 ProcessBoolean(*boolean, *meshtmp, conv);
779 } else if(geo.ToPtr<Schema_2x3::IfcBoundingBox>()) {
780 // silently skip over bounding boxes
781 return false;
782 } else {
783 std::stringstream toLog;
784 toLog << "skipping unknown IfcGeometricRepresentationItem entity, type is " << geo.GetClassName() << " id is " << geo.GetID();
785 IFCImporter::LogWarn(toLog.str().c_str());
786 return false;
787 }
788
789 // Do we just collect openings for a parent element (i.e. a wall)?
790 // In such a case, we generate the polygonal mesh as usual,
791 // but attach it to a TempOpening instance which will later be applied
792 // to the wall it pertains to.
793
794 // Note: swep area solids are added in ProcessExtrudedAreaSolid(),
795 // which returns an empty mesh.
796 if(conv.collect_openings) {
797 if (!meshtmp->IsEmpty()) {
798 conv.collect_openings->push_back(TempOpening(geo.ToPtr<Schema_2x3::IfcSolidModel>(),
799 IfcVector3(0,0,0),
800 std::move(meshtmp),
801 std::shared_ptr<TempMesh>()));

Callers 1

Calls 14

ProcessConnectedFaceSetFunction · 0.85
ProcessSweptAreaSolidFunction · 0.85
ProcessSweptDiskSolidFunction · 0.85
ProcessBooleanFunction · 0.85
TempOpeningClass · 0.85
GetClassNameMethod · 0.80
strMethod · 0.80
IsEmptyMethod · 0.80
RemoveDegeneratesMethod · 0.80
ToMeshMethod · 0.80
GetIDMethod · 0.45

Tested by

no test coverage detected