Search code examples
javascriptautodesk-viewer

Forge Viewer - Load second SVF and replace parts


Is it possible to load second (or multiple) SVF file/s and then replace some parts of the old model with the loaded part?

For example: let's say that we have a chair with a default decoration like red back and i want to load .SVF file with green back only (not whole chair) and replace it.


Solution

  • Yes, this can be done.

    Aggregation of multiple models is explained in this blog post for example: https://forge.autodesk.com/blog/multi-model-refresher.

    If you only want to load a specific set of objects from a model, you can do that by specifying their IDs to the loadDocumentNode method: https://forge.autodesk.com/blog/minimizing-viewer-workloads-loading-models-partially-selected-components-and-features-only.

    To hide an object from an already loaded model, you could for example use the viewer.hide method (this would require disabling the "show ghosted elements" option in the viewer though). Alternatively, you could modify the fragments of this object to hide them or move them out of the camera view: https://forge.autodesk.com/blog/working-2d-and-3d-scenes-and-geometry-forge-viewer.