14 Apr 2023

Selective explode

The explode functionality does not provide any way to specify which objects should be included in the explode. However, it does provide an event that you can respond to and revert the change for the object fragments you want to keep in place.

In the case of the below sample code I keep the objects in place that are currently selected, but it could be based on object properties or any other logic - see image on top.

viewer.addEventListener(Autodesk.Viewing.EXPLODE_CHANGE_EVENT, function (event) {
  let dbIds = viewer.getSelection();
  let pt = new THREE.Vector3();
  let fragList = viewer.model.getFragmentList();
  for (let dbId of dbIds) {
    viewer.model.getInstanceTree().enumNodeFragments(dbId, fragId => {
      fragList.updateAnimTransform(fragId, null, null, pt);


Related Article