Viewer : loading order in the console

Hello,
I’m back with a question for our geometry viewer : Géométrie pour Architectes

The objects received from TopSolid are not always loaded in the same order, which is problematic to rebuild the tree.
On the link, try to reload the page multiple times and you will see that the Ensembles tree order changes. Or look at the order in the console

Maybe it’s because the array is too big and split in three? I don’t have this problem on smaller models?
The code is here :

Thanks

Hi @RaphaelVouilloz

I don’t think I fully understand the situation, but regardless in which orders objects come in, the viewer will always respect the original hierarchy when building it’s tree. If you need a particular structure/hierarchy, you will have to create one at host-app level.

But maybe if you explain why the order of the object is important for your particular use case perhaps we could assist in less obvious ways

Cheers

Thanks @alex! Sorry indeed to have to explain further.
But I’m already glad to read that the world tree should always have the same order.
In my case, that doesn’t seem to be so. Please take a look at this file, sets.ts :
https://github.com/ENAC-CNPA/geometrie-pour-architectes/blob/f512b27627504b5ec8f42eaa8ca79f8cbcad2897/src/extensions/sets.ts
Here’s the code I use to load what I need from the world tree into the console, but it doesn’t always come in the same order (screenshot from my first post):

private receiveTopSolidItems(): any[] {
    const topSolidReceivedItems =
      this.viewer.getWorldTree().root.model.children[0].children[0].children;
    console.log(topSolidReceivedItems)
    return topSolidReceivedItems;
  }

Why order is important to us:
In TopSolid, there is an important BIM concept called sets. An entity (point, axis, sketch, etc.) can belong to one set, no set or several sets. Sets can also contain sub-sets, sub-sub-sets and so on. They form a tree in TopSolid that we want to reproduce in the viewer.
@ahmedwael94 sent me these sets (the top-level ones) from TopSolid at the same level as the entities, with an isSet property so that I could find them in the world tree. They don’t contain the entities directly, but references to the entities. (so that if a sketch belongs to several sets, you only send it once).
Then I rebuild everything from the children of these sets.