Modify layer name with cache component

Hi

I want to rename a bunch of layers. The Grasshopper script has the correct name and data structure, but when when ‘pushed’ via the cache component, the results are not as expected.

Before

After

I’m not sure what is happening here. Seems like two possible issues:

  1. It is modifying the layer in sequence but becuase the parent layer is first, the later layers are failing becuase they can no longer be found. But the query model layers component is not live-streaming to not sure why this would be happening.

  2. The model layer component doesn’t like full layer names (i.e. nested layers).

One possible solution is to just modify the lowest element in the layer hierarchy but there must be an easier solution. Any thoughts?

RenameLayers.3dm (49.3 KB)
Rename layers.gh (37.8 KB)

This is an improvement, but it still can’t do multiple levels at once (can’t rename both a child and its parent, but can rename a top level layer and a sub-layer of a different parent).

Rename layers 2.gh (19.6 KB)

1 Like

@Measure Nice new picture. You look good!


Rename layers vr1.gh (8.6 KB)

How about renaming the root without the “TEST_” and reassigning the child layer parent to the renamed layers?

The name attribute of the Model Layer component only renames the layer’s name. If you give it the full layer name path, it will start making new sub layers starting at that layer effectively duplicating the layer path structure preceding it.

If you rename the root, the children remain tied to original parent. So you just have to reassign the parent. I believe. @Kike will know most about this.

1 Like

Hi @parametricmonkey1, @Volker_Rakow, @Measure,

I’m working on adding this input to allow set the Full Path in one shot.

It will be in v8.18.

4 Likes

Thanks @kike that would be great. But is there a reason that it is part of Content Identity and not the Model Layer?

@parametricmonkey1,

The Name input sets the name of the Layer, it should be a way to rename a Layer or get just the Layer name.

I’m working on this…

A modifier on the input-output to switch between the two modes, like angles have to say your input is in degrees instead of radians.

Names inside this parameter are defined as a path using :: separator.

1 Like

Content Information is a generalization for more objects than just Layers.