Way to find components, that use "Flatten"?

Hi, is there a function or a package I can install that can search the canvas for components that use Flatten in their inputs or outputs? Or more generally, that use anything that might mess up data trees.

Motivation being here that it would help when converting algorithms to work with multiple inputs instead of singular. Or at least give me better estimate at a glance how much work it is going to be.

How big is your definition that you can’t see what is flattened?

Also wires show what’s in a stream. Single line wire means one object, double line wire = multiple objects in a list, dashed wire shows you have a tree.

1 Like

Google Gemini suggests this:

Gemini_Count_Components_with_at_least_one_Flatten_mod.gh (16.0 KB)

it should count the amount of Components on current gh canvas that have one or more Flatten mod applied to their inputs or to their outputs (for instance, one component with 3x Flatten mods on different inputs/outputs will still count a single +1)

count will only update when the button is clicked

2 Likes

Varies, but if I they were small enough to see in on glance, I’d just rewrite them.

Code seems to work. Just needs a bit of polish, like highlighting components in question or some other way to locate them easily

adding the line
obj.Attributes.Selected = True
will select the nodes with a flatten

1 Like