Split a surface in Grasshopper (e.g., using brep).
Send the trimmed surfaces into a GH Python component.
Bake the surface.
Use _Squish on the baked geometry and retrieve the result back into GH.
Problem
Even though the split works correctly and I pass the trimmed surfaces to Python, the _Squish command always processes the original (pre-split) surface — not the trimmed result.
What I tried
I confirmed that the srfs input into Python shows only the trimmed surfaces.
I bake the surface, then try to select and squish it using its Id.
I tried using both:
Grouping baked geometry and selecting it
Baking with attributes (Name) and using _SelName
But Squish seems to still act on the wrong geometry.
How can I ensure that the Squish command only acts on the baked version of the currently selected trimmed surface?
Is there a more reliable way to bake, fetch, and squish the geometry—perhaps using Squisher() directly in RhinoCommon?
Any help or sample patterns would be much appreciated
Trimmed surfaces are “Breps” and not “Surfaces” in Rhino and Grasshopper.
Since Grasshopper itself is quite liberal with input, performing implicit type conversions for you, you likely feed in a Brep (=Trimmed surface) to a Surface (=Raw surface) input.
The trick is to make sure you are setting your input type to Brep in GH, calling the Squisher.SquishSurface() method like this:
squisher = rg.Squisher()
marks = list(edge_crvs) + dots
squished_marks = [_ for _ in marks]
squished_marks = System.Collections.Generic.List[rg.GeometryBase]()
squished_brep = squisher.SquishSurface(
rg.SquishParameters(),
brep.Faces[0],
marks,
squished_marks
)
Note that this method can accept Rhino.Geometry.Surface as its second parameter, which is a generic type for trimmed and untrimmed surfaces, including a single BrepFace.
I didn’t look very carefully at the rest of the script after that.
It only supports Rhino.Geometry.Surface, which is (almost?) the same as GH’s Surface parameter type, but different to GH’s Surface input type in Python script components. (Yes, I know, confusing)
For reasons that I’ve forgotten, selecting Surface as a type hint in a GH Python Script component will convert almost everything to a Rhino.Geometry.NurbsSurface, which does not support trims (and is a subclass of Rhino.Geometry.Surface).