Search code examples
autodesk-forgeautodesk-viewer

Autodesk Forge Viewer. Selecting large number of elements (updating question)


Following this discussion Autodesk Forge Viewer - Selecting large number of elements (performance). Today is November 2022, maybe something has changed in the situation with the selection of a large number of elements? For example, in my case, I may need to select one million elements in the model (a model of a large building)


Solution

  • In case you're not using this feature yet, consider looking at the "selection type" that can now be passed to selection methods such as toggleSelect. The selection type can be one of the following:

    • Autodesk.Viewing.SelectionType.OVERLAYED
      • Nodes are tinted with the selection color and shown on top of the not selected geometry.
      • This does not scale for larger number of selected elements as they are rendered twice - once using their original shader, and then again using the highlight shader
    • Autodesk.Viewing.SelectionType.REGULAR
      • Nodes are tinted with the selection color.
      • This is better for performance reason - selected objects are only rendered once, with a color tint applied to their shader
    • Autodesk.Viewing.SelectionType.MIXED
      • Leaf nodes are selected using the overlayed selection type, and inner nodes are selected using regular selection type.