• Skip to primary navigation
  • Skip to main content

Horst Sondermann

Parametric BIM School

Facebook
Instagram
LinkedIn
Twitter
YouTube
  • Rhino/Grasshoppper
  • Archicad
  • Cinema4D
  • Adobe
  • Youtube
  • Print/EBook
  • About
  • Datenschutzerklärung
  • Impressum
Startseite » Rhino/Grasshoppper » Rhino3D Grasshopper: Dispatch List Match Text
Rhino3D Grasshopper: Dispatch List Match Text

Rhino3D Grasshopper: Dispatch List Match Text

In Grasshopper, you can extract list items by their name. Match Text looks for strings resulting in a True/False pattern.

New to Grasshopper? I suggest you read this article in the first place.

Need more learning resources? Check this out.

Disclaimer

As you will see in my screenshots most components carry a title above them displaying their name. This is because I use a plugin called Bifocals.

Also you’ll see my Grasshopper tab titles abbreviated because there’s not enough horizontal space. I will mention the titles in full in my script though.

As with everything Grasshopper, the technique I show you is no way my own discovery. This time, I got the idea from the McNeel forum.

Match Text: Why?

The other day I did some Surface Morphing taking 2 sorts of elements – Breps and Surfaces. As it goes, some flattening before Morphing led to a 1-Path-List of items containing both of these elements:

sondermann horstsondermann grasshopper rhino3d tutorial matchtext match text dispatch string sorting list datatree

My plan was to deal with the 2 types of elements separately furtheron. (In this case, utilizing them in ARCHICAD.)

I couldn’t figure out how to extract Breps and Surfarces separately in the first place.

I tried to tweak my flattening before Surface Morphing to recreate a suitable tree structure as a result – which would have allowed me to take things apart as described here.

This didn’t work for me – whenever I changed things my morphing went sideways.

Anyway I was curious how to get a list separated by the names of its items. The usual List and Cull components seem to be completely index-fixated. (I am glad to be told otherwise.)

On Discourse.McNeel I found the solution with Match Text (Set – Text):

sondermann horstsondermann grasshopper rhino3d tutorial matchtext match text dispatch string sorting list datatree

When you connect it to your list output …

sondermann horstsondermann grasshopper rhino3d tutorial matchtext match text dispatch string sorting list datatree

… and feed it with a Text Panel containing the text *Brep:

sondermann horstsondermann grasshopper rhino3d tutorial matchtext match text dispatch string sorting list datatree

… then you’ll see that Match Text produces a True/False pattern. This True/False pattern matches the occurrence of list items containing the string Brep at the end.

* is considered a wildcard that allows for any value. Place it before, after or on both sides of the string you enter, depending on the position your string has in each list item. I could as well have written:

  • *Bre*
  • Closed*

You get the idea.

Now the sorting issue – by list item names – is done. We can proceed by utilizing Match Text’s True/False output in a suitable list wrangler. Dispatch comes to mind:

sondermann horstsondermann grasshopper rhino3d tutorial matchtext match text dispatch string sorting list datatree

We have to connect it this way:

sondermann horstsondermann grasshopper rhino3d tutorial matchtext match text dispatch string sorting list datatree

Done.

For a good introduction on Grasshopper’s Data Trees read this page from TU Delft.

New to Grasshopper? I suggest you read this article in the first place.

Need more learning resources? Check this out.

 

© Horst Sondermann 2019 // All Rights reserved

 

 

Reader Interactions

Leave a Reply Cancel reply

You must be logged in to post a comment.

Copyright © 2023 · Genesis Sample on Genesis Framework · WordPress · Log in