Sketchup::InstancePath.persistent_id_path bug?

Here is a transcript from a ruby console session, with some comments. The model is attached. It is a component instance inside a group

model = Sketchup.active_model
sel = model.selection
g = sel[0] #after selecting the group
c = sel[0] #after selecting the instance
ip =[g, c])
[#<Sketchup::Group:0x0000000c1572f8>, #<Sketchup::ComponentInstance:0x0000000bdd6750>]
4750 # <<--- shoudld be 4750.4749
ip =[g, c, c])

So do I need to duplicate the last entity to get a valid path? Or append ‘.’ + c.persistent_id?

persistent_id.skp (134.1 KB)

Sorry, I now read the example to the end and saw persistent_id_path → String.
I cannot reproduce your example for nested groups. Are you sure your selections are nested?

I can reproduce the example. It is necessary before assigning variable “c” to go into edit mode on the group and select the component inside first.

As a side note, the group is non-standard, in that it contains a single entity, the component. I don’t know how to do that with the built-in tool set. (Clicking a single geometry object, and then right clicking it, results in a right click menu that does not include a group menu option). I suspect that the group was created with Ruby code.

I started from scratch with a new Sketchup drawing and drew a single rectangle and made it into a component. I then drew a single edge on top of the rectangle, which was not part of the component. After selecting both edge and component objects, I was able to group them as an outer group. I still encountered the same results. InstancePath is new for Sketchup 2017, and I’m not familiar with it.

I thought that perhaps being in edit mode resulted in a shortened path and active path has to be accounted for. I exited edit mode and still encountered the same results.

you can even group a single edge from the edit menu item…


1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.