How to get the children of IFC file?

Hi All,

I have an IFC file with 6 faces as a box. When I import it and try to get the children, I get an empty array, and when I tried the traverse function on it, I get just the same object, I mean, I got one child.

How can I get the children for this object?

I used web-ifc-three to import the object.

        // Setup IFC Loader
        ifcLoader = new IFCLoader();
        await ifcLoader.ifcManager.setWasmPath(
          "https://cdn.jsdelivr.net/npm/web-ifc@0.0.36/",
          true
        );
        
        await ifcLoader.ifcManager.parser.setupOptionalCategories({
          [IFCSPACE]: false,
        });
        
        await ifcLoader.ifcManager.applyWebIfcConfig({
          USE_FAST_BOOLS: true,
        });

It seems that you just have a single mesh here, based on the screenshot. Do you have other information to suggest that this file should have children?

Also note the multiple materials. It might be that mesh.geometry.groups is how the 6 faces are being represented.

This is the log of an example IFC model of a three.js example with the name rac_advanced_sample_project.ifc in this example three.js examples

Here, I also got an empty array for the children, but on the Speckle website, when I import the IFC object, I can select every child.

And mesh.geometry.groups gives me this information for the same object in the example:

The ability to select things doesn’t necessarily mean those things are represented as distinct children in a scene graph. For large IFC files in particular, the number of objects is often much too large for that. So you might represent them in a single Mesh and find other ways to highlight or move parts of that mesh. Groups within a geometry are one possible representation, THREE.BatchedMesh is another.

If you’d like to convert groups to separate meshes you could use SceneUtils.createMeshesFromMultiMaterialMesh. If it’s <100 objects like this screenshot, the performance should be fine either way, at least in terms of draw calls.

2 Likes