September 21, 2018

Enumerate dbIds on 2D views

Default blog image

Some 2D views of documents will not have the InstanceTree, if you try to enumerate leaf nodes you will get F2D files do not have an InstanceTree error.

The alternative is to use the fragmentId to dbId mapping, the following code shows the idea for Viewer v6:

var frags = _viewer.model.getFragmentList().fragments.fragId2dbId;
frags.forEach(function(frag){
  frag.forEach(function(dbId){
    if (dbId<0) return;
    // do something with the dbId
  });
});

One interesting application is to use .setThemingColor, which requires the dbId.

Related Posts

July 11, 2019

New Autodesk Forge Viewer 7.0 is Now Available

Autodesk Forge is our collection of Application Program Interfaces (APIs), documentation, sample code, and a community of cust

Read More

July 10, 2019

Look for exact property value and more

When using the search() function of the Viewer, you can only look for strings that at least partially match a given value.

Read More

July 9, 2019

Webpack and three.js in forge applications

In the newer versions of forge viewers( v6 and above) three.js is included in the forge viwer js file itself.

Read More