Grasshopper Rhino components - filter by type, name

I know how to filter referenced geometry manually the hard way. But.

Is there something planned to add components to filter referenced geometry similar to how it’s possible with EleFront?

Andy Payne has been working on just such workflows & will be refining a bit more before getting into the wip.

4 Likes

I created a filter by type node that works with Rhino 8 model objects. It takes a string input like “curve” and then returns all curves and all other separately, similar to the Elefront component.

I’ll share tomorrow in case it helps you in the mean time.

1 Like

I’m currently playing around with a python script.

The problem is that it does not work when objects are imported with the Import Content component. The imported objects do not have a GUID.

import_content_query_model_objects.gh (27.5 KB)

https://mrtn.ch/div/query_model_objects.3dm

Edited*
Like this?
FilterTest_v2.gh (3.2 KB)

import rhinoscriptsyntax as rs
import scriptcontext as sc
import Rhino
import Rhino.Geometry as rg

objl = []
sc.doc = Rhino.RhinoDoc.ActiveDoc

objl = [i for i in sc.doc.ActiveDoc.Objects if i.ObjectType.ToString() == type]
a = [i.Id for i in objl]

sc.doc = ghdoc

Thanks Adam that’s interesting but it does not work with the Grasshopper Rhino Import Content component.

I’m still working in R7. What is the output you get from the Import Content component?

As mentioned above the Import Content component does not seem to output GUIDs.

Are you trying to get the Rhino guid, or just filter the object types in gh?

Here is another filter that might work, but it doesnt get the original guid.
FilterTest_v3.gh (7.6 KB)

I’m experimenting the new Grasshopper Rhino components in different screnarios and would like to filter geometry based on type or layer. I guess we just have to be patient and wait for @AndyPayne new components.

Until then, for anyone else that might be interested, this could be an option that doesnt use the Import Content component:
FilterTest_v4.gh (3.8 KB)

@martinsiegrist here’s a couple clusters I created, they aren’t python but they should let you filter by name, filter by type, get user text values, and create trees from unique values. I was using the “Get Detail Groups By Name” for a different purpose but in essence it’s just a name filter.

EDIT: Native Version Of Clusters:
20230622_filter_by_name_filter_by_type_get_value_create_unique_tree_set_01b.gh (137.8 KB)

Nice. Works fine except for a Shift Paths component from treesloth I’m not using…

Oh goodness, I thought it was all native components. (Currently in the process of eradicating all non-native components from my scripts) I’ll reupload that when I change it. Treesloth put its icons in the native Tree & List tabs of GH so it get’s confusing. I’m going to delete it entirely soon.

1 Like

This version should be all native, please let me know if it isn’t.

20230622_filter_by_name_filter_by_type_get_value_create_unique_tree_set_01b.gh (137.8 KB)

I just had a quick look at R8. This Python version seems to work:
import_content_query_model_objects_v2.gh (13.0 KB)

@michaelvollrath It might also help you with your question here: Rhino 8 WIP - Python - Get Geometry From Model Object? - #3 by michaelvollrath

2 Likes

Nice! Thank you Adam

Solved. Thank you @jeremy5 and @AndyPayne