If else in Grasshopper


I want to trim a curve (Curve A) by multiple regions. If the regions are empty, the result should return the Curve A:

    if (Regions == null)
        result = CurveA
       result = Trim(CurveA, regions)

How can I do this?

a condition is either true or false, so you can use this Boolean to feed a Cull component. Basically you generate both results, but hide (cull) one of them. You can check for example for list length, check if it is longer than 0, then you have your Boolean to feed a Cull component

1 Like

Similar what @Gijs have described.
Here you are 2 options:

  1. If a single curve is involved it can be done with Stream Gate

  1. If you are operating on multiple curves you can do it with Dispatch or Cull Pattern

1 Like