I have a external Id and i want to retrieve element of it to set theming color but i can't search method to do this. I tested, but it's not run.
viewer.getElementById(externalId);
viewer.getElementById() is right ? I search in document of forge but get no result. Seem document of forge is difficult than document of revit api. Many thanks !
I am not sure if getElementById()
exist in Forge or where it is documented.
If you would like to set colors of an object in your model, you need to use dbId instead of externalId. Fortunately, there is a really nice function to get dbId from externalId which is called getExternalIdMapping()
.
You can find it here in the documentation: https://forge.autodesk.com/en/docs/viewer/v2/reference/javascript/model/
getExternalIdMapping(onSuccessCallback,onErrorCallback)
Returns an object with key values being dbNodeIds and values externalIds.
Useful to map LMV node ids to Fusion node ids.
Example usage could be:
viewer.model.getExternalIdMapping(data => console.log(data))
With this you can retrieve dbId to set its color.