petrbroz / svf-utils

Utilities for working with the SVF file format used by Autodesk Platform Services.
https://petrbroz.github.io/svf-utils/
MIT License
131 stars 56 forks source link

Support reproduce the object hierarchy #60

Closed dykarohora closed 2 years ago

dykarohora commented 2 years ago

I would like to reproduce the object hierarchy of the source design in gltf.

To do this, I think need to parse "InstanceTree.bin", is that the right?

Also, I don't know how to parse InstanceTree.bin. I tried using the PackFileReader Class, but although I could read the file, I could not retrieve the data. Can you tell me how to parse it?

wallabyway commented 2 years ago

You can retrieve the hierarchy using Model Derivative API, like this: GET https://developer.api.autodesk.com/modelderivative/v2/designdata/:urn/metadata/:guid

API doc for hierarchy: https://forge.autodesk.com/en/docs/model-derivative/v2/reference/http/urn-metadata-guid-GET/

Source code for retrieving the hierarchy, using the 5 properties json files: https://github.com/wallabyway/propertyServer/blob/b7b4222acbc9e1e45f66928fb354e360e44fc0b9/server/properties.js#L588-L628

petrbroz commented 2 years ago

As @wallabyway explained, the object hierarchy can be retrieved directly from the public Model Derivative APIs. This approach is preferable to parsing the InstanceTree.bin file.