Please advice if there any option to get mapping object faster or filter only geometry objects from there.
We have an array of objects where externalIds are stored (separate DB) and we want to add sprites based on these externalIds. I use mapping object from getExternalIdMapping to find dbIds, but time of execution depends on models size (i'm not sure here). I try to get mapping on MODEL_ROOT_LOADED_EVENT.
//callback for mapping on MODEL_ROOT_LOADED_EVENT
e => {
e.model.getExternalIdMapping(
mapping => {
dispatch(setGuidsAndModels({ model: e.model, guidsToDbids: mapping }));
},
error => {
console.error('Failed to get external ID mapping', error);
},
);
},
And after i get it i fire an useEffect to add sprites. I get expected result the only issue here is execution time. useEffect works fast, sprites appear immediately once mapping object received.
Why i asked this? We have large model where this flow takes 30 sec, but the same model with issues in ACC shows these issues on ACC viewer open.
Please advice how to impove here. Thank you.
Yes, depending on the complexity of the model, it may take a lot of time to download the data and generate the external ID map.
What you could do is, fetch the design metadata using the Model Derivative service (for example, using this API, or this API), and build the externalID/dbID index yourself.