Autodesk Forge is now Autodesk Platform Services

6 Oct 2016

Get all database id's in the model

Default blog image

There is already a blog post which includes a solution for this as well, but things change and now there is an even simpler way:

// Used in blog post http://adndevblog.typepad.com/cloud_and_mobile/2016/10/get-all-database-ids-in-the-model.html
function getAllDbIds(viewer) {
var instanceTree = viewer.model.getData().instanceTree;
var allDbIdsStr = Object.keys(instanceTree.nodeAccess.dbIdToIndex);
return allDbIdsStr.map(function(id) { return parseInt(id)});
}
view raw GetAllDbIds.js hosted with ❤ by GitHub

Tags:

Related Article