Create a closed polyline with merge & trim

Hi all,

While I’m a quite long user of Grasshopper, I’ve been stuck on this, what seems like actually a simple problem, for a few hours now.
I want to trim the part of the polyline (or 4 line-like curves) which is at the right side of the red line, and then merge the resulting green line with the red line to a closed polyline.

Anyone have a simple solution for this?


Several possibilities spring to mind but I’d rather work on your geometry than create my own.

How were the green rectangle and red line created? Can you just create a new rectangle to match your desired dimensions?

Or scale the existing one the desired dimensions

Hi Joseph, thanks for the reply.

I just showed the problem itself, but the actual algorithm is a very large and complex one. Basically, the rectangle is a scaled rectangle of a previous one. So the rectangle its base is the area(center) output.
The red line is the line on the right, from exploding the polyline, list item and move it -x units.
I thought I was missing something because it seems a very simple problem, but I couldn’t get anything with trim and merge components.

Hope it makes sense.

Too late. Post geometry without being asked next time.

By the way, the first idea that occurred to me was to move two points of the rectangle and create a new closed polyline (rectangle). There are many ways but it all depends on what you have to start with. Making excuses about why your GH model/geometry is exceptional and exempt from posting doesn’t work for me.

That being the case, you could use the opposite edge (left side) and moved right edge with Ruled Surface or Loft to make a rectangular surface, then run it through a Crv param to get the new rectangular polyline.

“a few hours”!? There are so many ways.