From the course: Grasshopper: Tips, Tricks, and Techniques

Fabrication: Ivy fundamentals

- [Instructor] Welcome. I have my exercise file open already. In this video, we're going to focus on the Ivy plugin. Ivy is an amazing tool that lets you take a mesh object, develop a mesh graph that tracks the connectivity between all the faces, and then divide that graph in such a way that allows you to unfold the underlying mesh flat. And this works with very complex meshes where you can break them up into pieces. In this video we're going to focus on the fundamentals, the basic steps of going from mesh, to mesh graph, to unfolded graph, and then back to a mesh. As an example, I have a surface here and I'm using that surface to generate a whole bunch of boxes with open backs. And we're just going to unfold one of these boxes. So here's our box. The first step is to convert this mesh into a graph or generate a graph based on the mesh. So we'll go graph from mesh. The next step is you want to figure out which face to start unfolding from. And we want to start unfolding from one of these two front triangles, which represent the front face of the box. To do this, we'll go to mesh, face boundaries, and we're going to use the boundary length, which is a proxy for boundary area. We could convert the boundary into a surface and find the area, but the length will work fine in this instance. So we'll go to curve, length, and then what we really need is the index of that face in order to use that index to do everything else. So, we'll go to sets, series, and this is a trick. If you need the index of something within a list and what you're getting is the actual geometry, like if I have a list of curves here but I want to know which of the curves based on index, not the curve itself, you can just go get the length of that set. So I have 10 curves and now I have 10 integers. Each of these integers represents the index of the curve, the corresponding curve. So I'm going to sort these by length and then plug in the index, or the integers. And so, this will tell me which of the curves is the shortest or which of the curves is the longest. But what I'm getting is the actual index of that curve. So to get that, I want to go list item, I'm going to plug in the indices, and item by default will give me the first item, which is the shortest curve. But what I really want is the longest curve and that'll be the last item in my list. So face nine is going to be the starting point for the unfold. Now, as I'm doing this unfold, I need to break apart this graph. So you can see the graph is connected around the corners and I actually want these, all these flaps to unfold so I want to break the graph at these corners. I don't want that connection to cross that corner. And so to do that, I need to create weights for the edges. So I can tell Ivy that these edges are more costly to actually unfold. So I'll go back Ivy. And I'm going to create custom edge weights. And so I'll plug in my graph. But how do I actually get those weights? So if I go back into mesh and I get my mesh edges, and I'll focus on these interior edges because the exterior edges aren't connected in the graph. So it's only the interior edges that matter. And we get the length again, so the curve, length. And these lengths are going to become my weights. So I can just plug this in. What this does is it says, okay, the longer the curve, the greater the weight. The problem is, I want it to break at the short curves. So I want there to be more weight or more cost at these short curves. So I'm actually going to do an expression here. I'm going to just multiply this by negative one. So now they are all negative. So these will be the costliest edges and these will be the least costly edges. So now I have my weights, my graph with my custom weights, so let me go back into Ivy and I want to do my segmentation. This is what actually breaks the graph up or moves segments within the graph to allow it to unfold. Without getting into the weeds of how each of these algorithms work, I know that I'm applying custom edge weights so I'm going to pick an algorithm that's focused on edge weights. I'm going to use this Multi Root MST edge weight. So I plug in my graph with those custom edge weights. And I want to tell it here's where we're going to start, the face will be starting with the index of the mesh face where it will grow, which is that number nine mesh face. So we're going to turn that off. So now we see this new graph starting at this face index nine and then it's connecting all the faces, but it's not connecting around the corners. And that's what's going to allow this to actually unfold properly. So now to actually see the unfold, we'll go to mesh graph visual unroll. This will actually take the graph and unroll it flat. So we want the starting face, again. And here, this is a coefficient that lets you partially unroll if you want to, instead of completely unrolling. And this actually controls which faces will unfold so you can unfold them incrementally, just unfold some of the faces. But we're going to leave all of those set to completely unfold. And now, here is the graph that's being unfolded. So we can see that graph, but we want the actual mesh, not the graph. So we'll go back into our mesh graph area and go graph to mesh. And there we go. So you can see Ivy is a complex plugin. If you really want to get into the details of it, each of these algorithms are really interesting and interesting to read through and understand completely. But even without understanding it completely, you can use Ivy as a really simple tool to quickly unfold and unroll complex geometry.

Contents