Top layer has the same name as a sub-layer

Hi,
For example,
I want to get only the circle in the top layer called “Layer 01” using “Reference by Layer”. But, because there is a sub-layer that is also named “Layer 01” under “Layer 02” the component outputs the rectangle in the sub-layer together.
Can anyone tell me the way to get exact match name?
image


test.3dm (37.7 KB)
test.gh (7.9 KB)

Interessting problem. :thinking:

Even with a value List it picks both circles.

Tried to find how to define an absolute layer name but couldn’t find a hint.

My workaround would be just to give the layers individual names. It comes in handy anyway if your layer tree grows to find the correct layer again…

But, I did some research and found this post:

There they use a C# Script to catch all layers. I’m not into C# but guess this would be an option.

1 Like

Hi @Teru

This is a very interesting situation. I’m not really sure how Elefront handles the layer names.

Here is a workaround with Python Script Component. (You can also save this as a UserObject)

GH_File: test_re(a).gh (9.0 KB)

HTH

~ ~ ~ ~ ~ ~ ~ ~
Kaushik LS
Chennai, IN

2 Likes

I’d say identically named parent layers and child layers is a situation most people try to avoid. Multiple child layers with identical names are not a problem and it works fine with Elefront. In case a link is required between objects on different layers I would use Object Names and/or User Attributes.

Thanks, Jess. Giving a new name to it would be reasonable workaround.

Thanks, Kaushik.

I appreciate your python script :+1:

Hi Teru, if you have nested layers, you can use the double colon “::” syntax to access objects on nested layers, even if they have the same name. They same syntax is used to create nested layers. To get to the innermost layer, you would use this string “Layer 01::Layer 01::Layer 01”

In this case, the pentagon is on the innermost Layer 01

The problem described in the first post is that the Reference by Layer component finds all layers with the text fragment “Layer 01” which in this case returns two curves. The Elefront component seems to work with a flat list of layer names whereas it should use full layer names. Or at least provide the option to work with full layer names…

@krahimzadeh

@martinsiegrist, fair enough. Right now eleFront uses pattern matching to search the layer table. Since “Layer 01” will match multiple layer names, multiple results will be returned. Aside from adding the option to reference full layer names only, one could add a filter on the results to drill down on what they are looking to reference. In the example below I used “Get Rhino Attributes” to return the full layer name and then use that to drill down on what to select.

Ultimately I would urge the use of key/value pairs on rhino objects to help with referencing and filtering or at the very least different layer names, but often enough you may have a file that comes from someone else that you need to work with and some downstream filtering often does the trick by adding an extra layer of control.

1 Like

Haha, I didn’t see you’re part of Front.

Excited for the new version.