Grasshopper R8 - referencing geometry by layer (automatically)

I community,

Am I missing something, I want to automatically reference the geomteries (on my layers) inside grasshopper. I use to do it with Elefront, but I wanted to try new native rhino components.

Is it what the “query object component” is suppose to do ?

When I use the component query object it is like there is no objects/geometries within these layers… which isn’t…

Any clues ?

Thanks!
C.
Untitled.3dm (44.5 KB)
test123.gh (9.1 KB)

The matching is for a text match, the Model Layer input is too complex in this case.

1 Like

In this case, the geometry is on ‘Layer 04’, not ‘Layer 01’. Took me awhile to realize that…

This doesn’t work. Is there any way to get all geometry in the Rhino file by layer?


R8_layers_2024Oct2a.gh (8.9 KB)

P.S. Oh :exclamation: Sorry, text needed to be trimmed.


R8_layers_2024Oct2b.gh (9.9 KB)

Initially I tried using “:(space colon space) as the separator but results were unsatisfactory as it split on all single space characters. Like this:

R8_layers_2024Oct2b2

1 Like

Thank to you both,

Still have an issue if I do have sub layers with objects on them. The solution doesn’t work anymore. (I do have many sub layers in the model I use)

I don’t understand why the query layer component does have the "model layer : " before layer name… It would be great to have only the layer name. Is it possible to add this to whichlist ? Or at least adjust the “content info component” to output layer name with sub-layers on the same string.

Thank you :slight_smile:
C.

1 Like

layer and sublayer objects rhino.3dm (44.5 KB)
layer and sublayer objects.gh (12.0 KB)

You have to supply the path details to the query model objects component.
I have been using this method and its working quite well for me. Refer the layer once at the start of the project and you can perfectly detect any object in any layer.

2 Likes

Yes, I realized after I posted that sub layers would fail. That’s because text split fails using multi-letter separators (space colon space). Python fixes that.


R8_layers_2024Oct3a.gh (20.0 KB)

This is the single line of Python inside the tSplit component:

a = T.split(C)

Still seems like a lot of trouble… :thinking:

The Content Details component looks very useful! Not sure yet about Model Layer, I haven’t used the R8 ‘Rhino’ tab features much yet, the word “Model” confuses me.

1 Like

I guess this is the proper R8 way using Content Details instead of tSplit?


R8_layers_2024Oct3b.gh (25.0 KB)

There we go! it will do the job. Thanks @Joseph_Oster and @Kyuubimode

Any tutorials for this “rhino” section of grasshopper for the basics would be great for beginners :slight_smile: . Powerfull features. Some I recognize similar to Elefront plugin.

Simple and pleasant to use with the “item selector component” of human plugin to quickly filter the wanted layer.

Regards,
C.

There are a number of Guides/Discussion as well as formal documentation, more documentation on Grasshopper components is being built but not yet public.

https://mcneel.github.io/grasshopper-api-docs/api/grasshopper/html/N_Grasshopper_Rhinoceros_Model.htm

1 Like

You should do it like this:


You can set the text split to cull empties, which solves your problem. You can convert layer paths to model layer paths with a model layer container.

E: Cull ends is Wombat, you can cull the first and last item in the list as well.

I already solved my problem two ways:

  1. Using a simple one-line Python component called tSplit, here.

  2. Using Content Details instead of tSplit, here.

Posting only images of code without the GH file is useless to me.
And I have zero interest in Wombat.

‘Group Content’ may help here.

3 Likes

Still, I think to this day for me the easiest way to import layers and their objects/geometries inside Grasshopper is with Elefront and simple value list. (option B)

Native components to replace what elefront allow is not there (yet).

  1. lag / bug can occur in GH script (with the quiery component) if you add new layers inside Rhino. (the new layers will be added at the end of the query list… unwanted in some cases, like with list item component)
  2. the “update” button that Elefront provide, can avoid unwanted calculations each time you modifiy something inside rhino.

To me this a crucial workflow as the design task need to make quick modifications to the geometry inside rhino and to quickly take this inside grasshopper, and not need to each time reference manually the geometries from rhino inside GH.

Are you aware of the Synchronize option in the RMB menu?

Also a component which limits what triggers an update for the component has been requested. @kike what is the state of that?

1 Like