Alternative Model Tree

We have added a few additional features to the model tree to support an upcoming BIM related demo:

  1. There is now a default right-click context menu with functionality similar to the context menu in the default HOOPS Communicator model tree (Isolate/zoom/show/hide). You can provide your own right-click menu functionality by specifying a callback function as in the code below. For more information on the required format for the returned items please see the JStree docs here: link
 scTree2.setMenuCallback(
      async function (nodeid) {
	
          let items = {
              isolateItem: { 
                  label: "MyIsolate",
                  action: function () {
                      hwv.view.isolateNodes([nodeid], 500, true);
                  }
              }
          };
          return items;
      });
  1. When right-clicking an IFCSPACE element the context menu now contains the option to select all nodes related to this SPACE. If you also include the ClippingBox code into your project (which can be found here) and register it with the Model Tree via the function below the user also has the option to clip to the IFCSPACE’s bounding box:
 myClippingBox = new ClippingBox(hwv);
 ScTree.setClippingBox(myClippingBox);
  1. You can now restrict the nodes that will be displayed in the model tree to a set of predefined nodes with the function below. The model tree will not show the tree hierarchy below the restricted nodes.

myTree.setRestrictToNodes([400,401,402])

As always feel free post any questions around this class here in the forum.
ScTree.js (35.1 KB)

1 Like