# Deform orthogonal 3d grid like foam with mesh

Hello all,

New to Kangaroo here and trying to learn by using it for a small project. I want to deform a 3d orthogonal grid with the load of a mesh. Now I managed to get somewhere but can’t figure out how to have the whole grid behave more like a soft foam, distributing the deformation more across the grid. Now it is more crumbling/collapsing under the weight. So how can I maybe keep the angles in the corners a bit more stiff and the mesh edges a bit more flexible so they can compress & stretch a bit more? And now lower edges will only start compressing after the edges above have reached LowerLimit.

You can lower the mesh in the attached GH file by dragging the slider.

As I said, Kangaroo beginner so probably doing this all wrong but 90% of tutorials generally focus only on a pieces of falling cloth

Thanks!

Sketch 2b_Cleaned.gh (47.9 KB)

Here’s a version using the 6dof nodes and beam elements
crushbeams.gh (48.2 KB)

1 Like

Thanks @DanielPiker for the example using Beams (and for Kangaroo!). Seeing this possibility, I realise I should give a bit more detail into what I’m trying to achieve. I need to keep the edges straight as I want to use the output to generate a physical model using connector nodes & tubes.

So something like this, but deformed…

So you want the struts to be straight (and keeping their original length?), but have the angles at the nodes change? One way to do this with the above definition would be to change the `N` input to the Perp Frames component to 1.
Depending what this is for, you might also be able to do it all with simple 1D springs without the beams, just be triangulating all the cells (without including those diagonals in the output).

Yes, struts should remain straight but angles change (preferably also within some range/stiffness as if the connectors are rubbery). Keeping the original lengths is not a necessity, that’s why I was trying to get it to work with ClampLength and give it some min/max stretch if I understand that function correctly. I don’t think I can get interesting enough results when keeping the lengths equal although that would massively simplify constructions if it does so interesting to experiment with.
I tried reducing N on Perp Frames and indeed this makes them rigid but the whole grid now becomes VERY stiff and intersects with the Mesh. All-in-all it does feel more like the foam behaviour I as looking for where the whole grid more or less compresses, more locally around the mesh than further away.

If you say 1D springs, what goal are you referring to? If I understand you correctly you also suggest to triangulate all the faces so they are less prone to collapse? That makes sense.

One option is just to reduce the E input of the beam goal, or increase the Strength of the SolidPtCollide Goal.

By 1d springs I mean the `Length` goal. Yes, if you add diagonals (either to the faces or the internal diagonals of the cubes, or both), it will make them more resistant to collapse. You probably want to use one Length goal component for the main orthogonal edges, and another for the diagonals, to make it easier to view them and control their stiffness separately.

Seems like I need to reduce E close to 0 (0,0001) and increase SolidPtCollide Strength to a very high value to get it to relax a little bit. I started watching some tutorials using beams but need to test out a bit more.

One option I was thinking about is to keep Prep Frames N at 3 (as that behaves kind of like what I had in mind) and to then somehow remove all the nodes with valency of 2 (using Sandbox?) and replace with a single line after the Kangaroo Solver. But maybe that’s too much of a hack…

OK, have been trying to skip V1 tutorials were springs are used a lot. Does Length replace SpringsFromLine completely or are other goals needed to cover all it’s functions. Maybe I’m struggling conceptually with ‘spring’ as the behaviour of Length seems to be to iterate by all means to the original length (or whatever you set at Length input) and so there’s isn’t much compression happening by the collision? So I would love to see the ‘springs’ compress by the collision vs buckling and twisting at the nodes. So rather have the nodes be stiffer, diverging less from the orthogonal grid and the edges compress (or expand) something like ±50%.

But that’s maybe best solved using 6dof? Just trying to understand to wrap my head around this and understand the higher level differences between the different approaches.

Yes, you could use the 6dof nodes and beams subdivided into 3, but output the straight lines between the nodes - no need to do this with post processing - just connect the subdivided lines to the beam goal and put the non subdivided lines into a Show component.
I don’t think beams are what you need though, as explained below.

Springs and the Length goal are the same thing - I changed the name when I rewrote the solver because I was emphasising the use for geometric constraints, but they minimise exactly the same energy.

I think this is the main issue, since what you describe is inherently non-physical behaviour.
Think about a rod being bent - it is being stretched on the outside of the curve, and compressed on the inside. The resistance to this stretching and compression gives it bending resistance.

So a member which is highly axially compressible, yet simultaneously strongly resisting bending and twisting doesn’t make sense physically (unless we think of it not as a single material, but some sort of mechanism like a scissor linkage or a telescoping rod, but that is a different system that would need to be simulated differently).

It’s sounding like the `direction` goal (which keeps lines close to the world orthogonal axes if no input is given for the alignment direction) might be what you need, or perhaps angle goals at the nodes, but it’s hard to say without understanding what the actual exercise is here, since it seems it is more about shaping than simulating.

1 Like

Excellent, already did it the hack-way and looks kind of interesting so will try your shortcut next.

But that brings me to your excellent observation:

I started to sense the smell of non-physical behaviour around here
Thanks for confirming & explaining to my visually oriented brain. What I have in mind is probably pseudo physics.

Yes, more of a form-finding exercise trying to mix two of our earlier projects, support structures generated by 3d scanned glass (actual support generated with Materialise eStage):

with some of this:

Thanks for the great input @DanielPiker, more than enough material to chew on and experiment with for now.