ThatOpen / engine_components

MIT License
299 stars 116 forks source link

FragmentHider with FragmentClassifier.byModel ignore certain elements #261

Closed Manriss closed 2 months ago

Manriss commented 7 months ago

Describe the bug 📝

If the model is classified using the FragmentClassifier.byModel() method, and an attempt is made to hide the entire model through FragmentHider.Set() using the resulting classification, certain elements are ignored. this code is executed after the model is classified:

     const hider=viewer.tools.get(OBC.FragmentHider)
         for (const model in classifier.get()['model']){
            const modelFragmentsFromClassifier=classifier.get()['model'][model]
            console.log(modelFragmentsFromClassifier)
            hider.set(false,modelFragmentsFromClassifier)
           // hider.set(false) //this works ok
         }

elements ignored: image It looks like Fragments from model and classifier are different: From the FragmentGroup: image From classifier: image the IFC file is the one named: NAV-IPI-ET1_E07-ZZZ-M3D-EST.ifc from the master BIM software developer If I try to hide one of those elements using the id from the highligther event nothing happens:

highlighter.events.select.onHighlight.add((fragmentMap) => {
          const expID = [...Object.values(fragmentMap)[0]][0];
          const hider=viewer.tools.get(OBC.FragmentHider)
         const selectedFragmentMap= model.getFragmentMap([Number(expID)])
         const selectedFragmentIdMap=map2IDMap(selectedFragmentMap)
       // hider.isolate(selectedFragmentIdMap) //This works OK
         hider.set(false,selectedFragmentIdMap)
        });
        highlighter.events.select.onClear.add(() => {
          setSelectedProperties(null)
        })
      } catch (error) {
        console.warn(error);
      }
    }

Reproduction ▶️

No response

Steps to reproduce 🔢

No response

System Info 💻

System:
    OS: Windows 10 10.0.19045
    CPU: (24) x64 12th Gen Intel(R) Core(TM) i7-12850HX
    Memory: 45.93 GB / 63.69 GB
  Binaries:
    Node: 18.16.0 - C:\Program Files\nodejs\node.EXE
    npm: 9.5.1 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Chromium (120.0.2210.133)
    Internet Explorer: 11.0.19041.3636
  npmPackages:
    openbim-components: 1.2.0 => 1.2.0

Used Package Manager 📦

npm

Error Trace/Logs 📃

No response

Validations ✅

agviegas commented 2 months ago

This should be solved with the latest version of the library. let us know otherwise!