Any way to retain node id?

We heavily rely on node id’s to identify something and display something on a pop-up window based on that node. And all’s good when we try to import a scene from a sketchup file as is, but if we update or remove elements from the sketchup file and import it into shapespark, new node ids then get generated and we don’t want that happening, is there any way to make these node id’s static or have them not update?

In case of importing a SketchUp model, the Shapespark node names are taken from SketchUp component/group names. So, the same SketchUp component/group should have the same Shapespark node name across imports.

Could you describe in more detail the scenario in which the node name changes for you in Shapespark? Does it involve removing the corresponding SketchUp component/group at some point?

This just clears up a bunch of my intended follow-up questions, so nodes are named after component and group names within SketchUp. Thank you!

Whats happening is that;

  1. We have a SketchUp scene.
  2. When we import that scene into Shapespark, all’s good, nodes are all setup, and we reference those nodes for a custom pop-up page.
    3a. We then would like to remove a material in the latter SketchUp scene, import the newly modified scene into Shapespark.
    3b. Problem now is that the node ids are now different from the initial import, and in turn messes up our implementation for the custom page.

What you describe might be related to how multi-material meshes are represented in Shapespark which supports only single-material meshes.

Let’s consider a simple SketchUp model that contains a single group called “Box” and the box uses two materials: “Wood Bamboo” and “Default”.

Multi-material mesh of the “Box” group needs to be split into two meshes in Shapespark, so the imported model in Shapespark has the following structure:

As you can see the import created “{Default}Group#2” and “{[Wood Bamboo]}Group#2” sub-nodes to handle multiple materials in the SketchUp’s “Box” group. The node IDs of such sub-nodes should not be treated as persistent, because if you change materials inside the “Box” group in SketchUp, the next import will produce different node IDs for such sub-nodes.

Does it apply to your case? If so, the solution is to refer to nodes by their IDs only for the Shapespark nodes corresponding to a SketchUp group/component, but not for the nodes that are automatically created sub-nodes.

Thank you for the well documented response. Yes, unfortunately this is the case.

Question is; there a way to programmatically get these SketchUp-to-Shapespark IDs, through Shapespark and not the sub-nodes on click? API is very sparse and we can’t seem to find any way to do it.

It’s not possible. However, when handling a click you can traverse the node tree upwards to the root, to find if the clicked mesh belongs to a larger node for which you’d like to trigger a custom action. See Sticky notes 🤔 or somethink similar - #7 by jan for an example.

That’s what we did and agreed upon, we are now adjusting everything to a standard format. Thank you so much for the initial hint!

1 Like