Search code examples
autodesk-forgeforge

Get properties value from dbId or externalid - Autodesk Forge


I have dbId and externalId in forge viewer. I want to get some value of properties object from this dbId and externalId. For example: Perimeter, Area, Volume, ...

What is the syntax to do that?

View Image


Solution

  • Once you have the DBID for the element which you can obtain with a viewer call to the selection of the object. viewer.getSelection() will give you that DBID that we will use later.

    You can use the method getProperties(dbid, callback) For example something like this.

    var myDbid = viewer.getSelection();
    viewer.getProperties(myDbid, function(e){
          console.log('Entire object response ',e);
          console.log('Properties ',e.properties)
    });
    

    This should give you the information of the category you are looking for.