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

Posted By

Adam Nagy

Follow @AdamTheNagy Adam Nagy joined Autodesk back in 2005 and has been providing programming support, consulting, training and evangelism to external developers. He started his career in Budapest, then worked in Prague for 3 years and now lives in South England, UK. At the moment focusing on Inventor and Fusion 360, plus cloud and mobile related technologies. Adam has a degree in Software Engineering and has...