C# component with Split Tree Input

I’m writing a C# component that will be parsing a large data tree and I’d like the user to be able to input Split-Tree like parsing notation. For example:
to select all branches that start with 1 and end in 3, 4, or 5. Is there a simple way to go about that? Some input type I’ve missed, perhaps? I see AddPathParameter but I have no idea what it is.

The Split-Tree component uses a Text parameter for the masks. These text strings are then parsed into GH_TreeRules objects, that can be used to operate on the tree paths.

1 Like

Paths are the actual tree branch indexer types, i.e. {0;0;4;1}. They do not allow for more advanced notation like the Split Tree component inputs. Like Menno says, you just need to have a Text input parameter and then convert the strings into rules. You can use the GH_TreeRules.FromString() static method (be sure to handle exceptions thrown by this method just in case).

Once you have a valid GH_TreeRules instance, you need to iterate over the paths in your data tree and use the Apply() method on each one to see if that particular path passes the rule collection.