Problem with hinge in folding meshes in kangaroo 2


I am trying to fold a mesh using engine in kangaroo 2.

Meanwhile, I encounter a few problems. Firstly, two mesh faces didn’t weld properly when I am setting up for hinge component. As a result, when I extract the exterior edge it gave me the interior edge as well. I tried to solve this by isolating the unweld mesh, culling out the interior edge and replacing the path.

Apart from that, after grouping two adjacent mesh faces, some remain non-quadrilateral faces. I tried to solve this by culling out faces that have only 3 segments.

Currently, the maximum number of hinge faces that I can control is 69, anything more than that return an error at the hinge component.

Eventually, the folding behavior is also weird with the values I used in the engine.

Please find the gh code in the attachment.
Thank you.

A3_TLam (question to ask rod).gh (62.5 KB)

Hi Timothy,

There are several issues here.

First regarding the mesh joining - Weld won’t join vertices that are almost coincident within some tolerance. In Rhino you can use the AlignMeshVertices command for this, or in Kangaroo the Combine&Clean component. It also looks like you have many meshes on separate paths, so you’d need to flatten them to join.

As for the hinges - the sets of points being selected need to be on pairs of adjacent triangles. The cull pattern here is picking points all over the place, which is why the simulation is crumpling oddly (you can check this visually by drawing a line between tip1 and tip2)

Have a look at this definition for an example of setting up hinges. I think the easiest way is to use the HingePoints component to get the right sets of 4 points for all possible hinge edges in your mesh, then cull or assign different angles to these as needed (43.5 KB)

Thank you Daniel!
It helps a long just by replacing mesh joining with Combine and Clean.
the HingePoint is also another powerful component that simplify my task!!