I'm interested to get the properties of all dbId elements. For this purpose I'm simply looping over my array of dbIds and use the getProperties
function provided by the Forge Viewer.
someFunction() {
const instanceTree = this.viewer.model.getData().instanceTree;
const allDbIds = Object.keys(instanceTree.nodeAccess.dbIdToIndex);
console.log('all DbIds');
console.log(allDbIds);
// This will give the correct Properties
// this.viewer.getProperties(5, (result) => {
// console.log(result)
// })
allDbIds.forEach((dbId) => {
this.viewer.getProperties(dbId, (result) => {
console.log('result:');
console.log(result);
}, (err) => {
console.log('err');
console.log(err);
});
});
}
When I access a specific dbId directly I get the correct property array. However when looping over all dbIds and calling the getProperties
function only the first two dbIds are returning properties and all the others are only returning empty arrays. Additionally the first two arrays are way to big and seem to contain the other properties. --> Link to console output
Does somebody know what I'm doing wrong here? Thanks already!