Autodesk Forge GetBulkProperties2

Viewed 165

I'm currently trying to viewer.model.getBulkProperties2() because I need the externalIds of the model. I've been using a loop with getProperties() to get the externalId but whenever I try it with very large NWDs firefox / chrome crashes.

The thing is, even if I specify in the options object that I need the external ids with needsExternalId:true, the function is not returning them. This is the affected portion of my code :

viewer.model.getBulkProperties2(dbids,{propFilter:params,needsExternalId:true,ignoreHidden:false,categoryFilter:null},(res)=>{
    console.log(res)
});

The property I'm using is just Name, and this is the returned res variable:

[
    {
        "dbId": 2,
        "properties": [
            {
                "displayName": "Nombre",
                "displayValue": "Nivel 1",
                "displayCategory": "Datos de identidad",
                "attributeName": "Name",
                "type": 20,
                "units": "",
                "hidden": false,
                "precision": 0
            }
        ]
    },
    {
        "dbId": 3,
        "properties": [
            {
                "displayName": "Nombre",
                "displayValue": "Nivel 2",
                "displayCategory": "Datos de identidad",
                "attributeName": "Name",
                "type": 20,
                "units": "",
                "hidden": false,
                "precision": 0
            }
        ]
    }
]

Am I messing anything up?

2 Answers

Nevermind, I just found out that you need to specify the externalId as a property to get it.

Adding to Sebastian's answer:

In order to retrieve external IDs for a list of objects in bulk, you'll need to do both:

  1. Set the options.needsExternalId property to true (the table of external IDs can be quite large and therefore is excluded by default; setting this flag will ensure that the table is loaded)

  2. Include externalId in the list of properties to retrieve (in the options.propFilter array)

Related