# Weird result from getBranchVisibility

**URL:** <https://forum.techsoft3d.com/t/weird-result-from-getbranchvisibility/5032>\
**Category:** Help\
**Tags:** code, webviewer\
**Created:** [December 23, 2025, 9:43pm UTC](https://forum.techsoft3d.com/t/weird-result-from-getbranchvisibility/5032 "2025-12-23T21:43:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nick.wong](https://avatars.discourse-cdn.com/v4/letter/n/f0a364/32.png) [@nick.wong](https://forum.techsoft3d.com/u/nick.wong)\
**Post date:** [December 23, 2025, 9:43pm UTC](https://forum.techsoft3d.com/t/weird-result-from-getbranchvisibility/5032/1 "2025-12-23T21:43:44Z")

</div>

I am using HOOPS\_communicator\_2024.3.0. In the sample application, the result from getBranchVisibility is always Mixed. No matter I hidden the whole model by toggling the visibility icon of the root node in the model browser or toggle it back to show the model. So is the behavior normal? Thank you

I attached the log in the screen shot below.

> visibilityChanged: (shownBodyIds, hiddenBodyIds) =\> {
> 
> ```auto
> console.log(shownBodyIds, hiddenBodyIds)
> 
> console.log(BranchVisibility\[this._viewer.model.getBranchVisibility(-2)]);
> 
> this._tree.getVisibilityControl().updateModelTreeVisibilityState();
> 
> },
> 
> ```

 ![image](https://us1.discourse-cdn.com/flex020/uploads/techsoft3d/original/2X/c/c734c2bf96ea49eef61e5fc6dddfa980d6153f08.png)

---

<div class="post-metadata">

**Author:** ![tino](https://avatars.discourse-cdn.com/v4/letter/t/9dc877/32.png) [@tino](https://forum.techsoft3d.com/u/tino)\
**Post date:** [December 23, 2025, 10:08pm UTC](https://forum.techsoft3d.com/t/weird-result-from-getbranchvisibility/5032/2 "2025-12-23T22:08:48Z")

</div>

Hello @nick.wong,

I tested on a couple of models from HC 2024.3.0 and I’m getting the expected results.

I don’t think this call:

```auto
this._tree.getVisibilityControl().updateModelTreeVisibilityState();

```

…is part of the Web Viewer API.

What are you getting when you make this call:

```auto
await this._viewer.model.getVisibilityState(-2);

```

Thanks,  
Tino

---

<div class="post-metadata">

**Author:** ![nick.wong](https://avatars.discourse-cdn.com/v4/letter/n/f0a364/32.png) [@nick.wong](https://forum.techsoft3d.com/u/nick.wong)\
**Post date:** [December 24, 2025, 2:05pm UTC](https://forum.techsoft3d.com/t/weird-result-from-getbranchvisibility/5032/3 "2025-12-24T14:05:33Z")

</div>

Thank you for your reply.

```auto
this._tree.getVisibilityControl().updateModelTreeVisibilityState();

```

Yes. It is not directly related to API. It is from the sample source code in VisibilityControl.js

```auto
  updateModelTreeVisibilityState() {
    if (this._assemblyTreeReadyOccurred) {
      this._clearStyles();
      const model = this._viewer.model;
      const nodeQueue = [model.getAbsoluteRootNode()];
      for (const nodeId of nodeQueue) {
        const nodeStatus = model.getBranchVisibility(nodeId);
        if (nodeStatus === BranchVisibility.Hidden) {
          this._fullHiddenParentIds.push(nodeId);
        } else if (nodeStatus === BranchVisibility.Mixed) {
          this._partialHiddenParentIds.push(nodeId);
          const nodeChildren = model.getNodeChildren(nodeId);
          for (const child of nodeChildren) {
            nodeQueue.push(child);
          }
        }
      }
      this._applyStyles();
    }
  }

```

It uses the getBranchVisibility API to determine the visibility icon in the model browser

 ![image](https://us1.discourse-cdn.com/flex020/uploads/techsoft3d/original/2X/d/d54a31420e1b4f9d5531d77206d41254750e3b89.png)

While getVisibilityState can determine the visibility for a node, it cannot be used to determine if there are some children are hidden and some children are visible. From my expectation and based on the sample source code, the getBranchVisibility is for this purpose. However, it returns Mixed even the model is first loaded and thus some icons are showed as partial hidden in the above screenshot. (I am using model arboleda in the sample).

So I would like to know the expected behavior of getBranchVisibility. Thank you.

---

<div class="post-metadata">

**Author:** ![tino](https://avatars.discourse-cdn.com/v4/letter/t/9dc877/32.png) [@tino](https://forum.techsoft3d.com/u/tino)\
**Post date:** [December 24, 2025, 4:07pm UTC](https://forum.techsoft3d.com/t/weird-result-from-getbranchvisibility/5032/4 "2025-12-24T16:07:13Z")

</div>

The arboleda model is an interesting model. By default, certain nodes are set to hidden. More specifically, those nodes associated with `IFCSPACE` are not visible as these objects represent **bounding volumes** instead of physical parts of the building.

When calling `getBranchVisibility` on the absolute root node (-2), a single child node that is set as hidden will return `Mixed` for the function.

If you want to toggle all the nodes to visible, you can run this snippet:

```auto
let visState = await hwv.model.getVisibilityState(-2);
const arr = Array.from(visState.visibilityExceptions);
await hwv.model.setNodesVisibility(arr, true);

```

All this is to say that `getBranchVisibility` should work. If you have a particular model in addition to the arboleda model, it might be better if you create a support ticket in our [portal](https://partner.support.techsoft3d.com/servicedesk/customer/portal/12) and send us the file.
