Kangaroo Planarization while staying close to the original surface

Hello there,
I’ve been trying to planarize the panels of a free-form geometry by using Kangaroo2… the problem is that the form I get is very different from the original one as you can find in the attached photos:
The original form:

The planarized form:

The script I used:

For the highlighted number slider, I start with 1 then I increase the value as the solver runs as I’ve seen advised in other related questions on the forums.

So can anyone advice what should I add to my script to stay as close to the original form as possible?
I’m in a desperate need for help…
Thanks in advance!

Hi @Lena_Ahmed

It just isn’t geometrically possible to have flat quad panels with that grid while staying close to that form.
To be planarizable, the grid needs to follow the curvature directions.
Here it looks like you’re starting from a twisted ruled surface, and the ruling directions meet the boundaries at a skewed angle. So a planarizable grid here would need to have some panels cut diagonally at the boundary. It might need some internal irregular vertices too.

Planarize a freeform.gh (105.9 KB)

Thank you so much for your quick answer!
I attached here the script I used to create the form from the beginning and turn in into a mesh.
I would be really thankful if you could advise what should I exactly do to make it possible to planarize this form, or maybe provide me with a link to some tutorial or anything that can help.

Think K2 as an app that allows you to get the proper Lambo for you. So you input a Goal related with your wallet depth ( 0 to pos Infinity) and a Goal related with your Lambo desire (1 to 100). If these Goals point North/South … well … you’ll end up with a Skoda (at best).

Back to your Mesh. The metaphor means that you (a) should never over constrain your Goals [for instance the Anchors used] (b) you should never expect wonders most notably if the Mesh is closed in U/V. That said the close to the OEM Surf Goal is also a rabbit hole (unless you put K2 in a C# Loop > relax > measure results and deviations > evaluate the state of the solution using some MOO approach > if not OK (never is OK mind) > again > and again > …).

Other than that I have 50++ C# scripts (simple or rather complex) that attempt to planarize Meshes (BTW: I hate quads). Notify if you want the simplest available (spot that there’s no Anchor Goals nor any CloseToSomething one):

BTW: the attached (using all the guns imaginable) is Daniel’s posted a million years ago.

Daniel_PlanarQuads_V1.gh (61.9 KB)

Let me be specific… as far as I understood from your reply is that the grid needs to follow the curvature directions in order to be planarizable by using Kangaroo as in my script…
So, how can I construct a grid which follows the curvature directions for a given Brep?

Thank you so much for your answer and for the file!

yes please, I could take a look on that script if you don’t mind.

Also please advice if you know how can I construct a grid which follows the curvature directions for a given Brep… it seems that it will much simplify the process if I could do that!

If by that you mean BrepFace that’s easy. If you mean any Brep (i.e. a collection of BrepFaces) … well … that’s a bit tricky. Better describe your goal/trade: are you in the AEC market sector and you want to create a “planar” quad envelope? are you an Artist ? And why you bother about some “as close as possible” Goal? (i.e. the OnMesh IGoal (*)) What’s the purpose? Who’s gonna notice any difference/deviation?

(*) in fact that’s complex: imagine a Surface/BrepFace that yields the Mesh to planarize … AND THEN the Surf or the Underlying Surf (case BrepFace) is expanded (N/S/E/W): that would be the " template" to follow (allows some freedom to that poor K2). But what happens if the template is closed in U/V? A strangle to death situation for sure UNLESS you add a IGoal that srinks a bit the Edges (trying to avoid the obvious). That does the edgeLengthF var (edges strink if is < 1) in the pics posted above.

With regard the simplest C# … I’ll have a look on what’s available soon (I’m not in the practice right now).

NOTE: K2 deals SOLELY with Patricles. Where they come from has no meaning (so to speak). The only thing that matters is the sum of IGoals and their values (if they are bananas > bananas is what you’ll get).

All these would been avoided if the Mesh was a good old tri-Mesh (I hate quads like my sins: hard to imagine why people like’m).

The Brep I’m starting with is a building (facade+top) that is originally a result of some optimization process.
So after the optimization, I need to be able to take this result and rationalize it into planar panels in order to be easier to fabricate. I’m also planning to fabricate a small prototype using a laser cutter machine.
If I couldn’t do it with the planar quad panels I will have to try the triangular panels. But I’m trying to reach a solution first.


If you are an Engineer/Architect with some sort of rational thinking:

  1. Do some rational building. You can’t optimize logical requests into a Blob (you know that … but you try to convince yourself that’s trendy/acceptable/whatever).
  2. If you insist mastermind an envelope (YAS style) that is FAR and AWAY from the skin. Provide some fake excuse for that (like: saving the polar bears because … blah, blah). If the building is in China/UAE/etc … skip the excuses.
  3. AVOID anything other than triads. Most notably if you have some sort of W Truss in mind (kinda YAS but with thickness).

Bad news: Quads are a very expensive chimera (you’ll discover that sooner or later when you’ll become a pro [and you are on-site]).

Good news: Obviously lot’s of people like’m > more expensive > bigger (by far) design fees > elementary my dear Watson.