简体   繁体   中英

Autodesk Forge GetBulkProperties2

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?

没关系,我刚刚发现您需要将externalId指定为属性才能获取它。

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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM