ModelGraphics and ReadyPromise

Is it possible to use the ReadyPromise with a ModelGraphics? Ultimately, I am trying to set a model on an entity. This model needs to have some of its properties be of type TimeIntervalCollectionProperty. Therefor, I am using (new ModelGraphics()) to instantiate the model. However, I would like to draw a point or fallback billboard if the model fails to load, so I was hoping to have the ReadyPromise available, like it is in the standard "Model" object.

Is there any way to have both the properties implement the "Property" interface AND have the ReadyPromise callback when using models?

Thanks!

Hello,

Unfortunately, it doesn’t look like the model readyPromise is available through the Entity API.

-Hannah

Thanks, Hannah, I was afraid that was the case :slight_smile: I appreciate your reply anyway!

I had this same problem. I was able to get a hold of the Model by using the ModelVisualizer like this:

this.modelViz = this.dataSourceDisplay.defaultDataSource._visualizers[12];

...

if (this.modelViz._modelHash[object.id]) {
    Cesium.when(this.modelViz._modelHash[abject.id].modelPrimitive.readyPromise).then(function(model) {
    model.activeAnimations.removeAll();
});
}

This is not a very clean way of accessing the Model, but it works.. (Until there is a better/supported way of accessing the Model from Entity/ModelGraphics.)

Thanks! I will give it a shot!

Hi Joy Foster,

Have you tried Matt Wintercorn solution?

May I know the status please.

Regards,

Premkumar

Hi Premkumar,
No, unfortunately I was pulled onto other priorities a few months ago and never got the chance to try out the solution. I still have this flagged as important so that I can go back and try it whenever I am freed up again.

Joy

By the way, I finally got back to this and was able to use your solution.

However, I had to put it in a timeout as modelHash wasn't immediately available. In addition, I looped through the visualizers (instead of hard-coding "12" and checked for a ModelVisualizer in case they ever change the position.

Thanks again!
Joy