petrbroz / svf-utils

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

Hierarchy and Name Issue #52

Closed ffreality closed 2 years ago

ffreality commented 2 years ago

Converted GLTF/GLB files don't preserve its mesh hierarchy and names. Example CAD convert workflow

IAM > SVF (Forge API) > GLB (Forge Convert Utils) but all assemblies gone. I just have numbered static mesh components.

wallabyway commented 2 years ago

Hi ffreality... The hierarchy is stored in a instance tree json file, a separate file. The hierarchy is a collection of branch nodes and leaf nodes, each containing a unique DBID.

Here's a branch node and it's unique DBID... Screen Shot 2022-02-22 at 2 22 04 PM

Meanwhile, the leaf node DBID, points to a single mesh object.

Here's an example of a leaf node (mesh object): Screen Shot 2022-02-22 at 2 22 42 PM

When we convert SVF to glTF, we only need to deal with leaf nodes. So we put the leaf's DBID (integer) into the node name (glTF string).

Use the instance tree json, to create a Tree View UI of the complete hierarchy, and use that UI to set visibility of the leaf nodes (ie. the glTF dbids).

Does that make sense?

petrbroz commented 2 years ago

Yep, the SVF file format stores all geometries in a flat list, and it then provides a logical hierarchy on top of these geometries in a separate data structure. When converting SVF files to the glTF format we keep the flat list but you are free to add the logical hierarchy to your application if you want to, for example, by retrieving the hierarchy from the GET {urn}/metadata/{guid} endpoint, and linking the dbIDs in the hierarchy to the dbIDs in the glTF (they're embedded into the node names).