Reputation: 67
I need to get all the dbId elements of the model for my project. I looked at all the ways to get dbId, but none of them solved my problem. I load two models and I need to compare the differences to display them. If the two models differ from each other in the size of one wall, then I must paint this wall in a different color. My solution algorithm looks like this: I load 2 models in one scene, after which I try to get the dbId of all the elements of the two models, and if there is a difference among the received dbId, then I paint it in a different color. I can't get a list of all dbId.
[Link on of my code][1]
https://codepen.io/anon/pen/KENKrE
Upvotes: 0
Views: 180
Reputation: 5342
Try the code below:
var frags = _viewer.model.getFragmentList().fragments.fragId2dbId;
frags.forEach(function(frag){
frag.forEach(function(dbId){
if (dbId<0) return;
dbids.push(dbId);
});
});
Alternatively you can iterate the instance tree via the Model Derivative APIs to process the comparison on server side - see more details here
Upvotes: 1