Get a list of all objects from loaded model

2019-08-18 19:29发布

问题:

I need to get all the properties from all the objects in the currently loaded model.

If I have a list of all the dbIds, I can use the Autodesk.Viewing.Viewer3D.getProperties(dbid,onSuccessCallback,onErrorCallback) method to retrieve them.

Is there a way to get a list of the dbIds of all the objects in the viewer? Or is there a better way to achieve this?

回答1:

Here is how you can get all the dbIds in the model: Get all database id's in the model

Now we also have a function to retrieve properties for multiple elements in the Viewer: getBulkProperties method

I think the above two things are all you need.



回答2:

You can also use the following Model Derivatives API endpoint to get the list of all the properties for a model: GET :urn/metadata/:guid/properties

This can be done without loading the model in the viewer but needs to be performed server side for security reason. You can expose an endpoint from your own server to your webpage.