Grasshopper - Intro to the Path Mapper

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey guys this is gonna be a tutorial on the path method now this is a tutorial I've wanted to do for a long time but we sort of needed to lay quite a solid formwork of using grasshopper before we could get into it because the path map we can get quite complex terms of what you can do with it so okay let's start by grabbing the path map the path map is found in the sits tab under tree path mapper and this can basically replace the functions of your graft tree your flattened tree your your flip matrix your shift paths and your simplify and a couple of other things but these are the main ones we're going to look at in this tutorial I'm going to start by just creating a series component and so the way we'd use the path method is we plug something in and generally you always want to see what your data structure is looking like before and after the path knepper so by default it is not gonna change anything that that's all well and good we also anytime we want to use the path pepper we need to create null mapping and so that'll basically take our index input and that'll that'll plug plug the values in here and out and spit up the exact same thing so we have 0 0 and a and B correspond to these two numbers respectively so what can we do with the path that but let's say we wanted to graft in the same boat if we plug that into our list we'll see we get 10 lists each with one item if we right click on the path map and we create graft mapping we plug that in you can see we get an identical result and so what's actually happening here with this with this graph mapping this is probably the the best way th to actually visualize what the graft tree does it takes okay it takes each item index so anytime you want access the item index in the data tree you need to create this open Open bracket a closed bracket outside the curly braces because this is where the item index is located and then we're basically putting that on its own on its own branch so for every single index number it gets its own branch which is exactly what we see there now the simplify let's say we were to plug this into here and then plug that into there you'll see that gets rid of out our zeros in the beginning and we could quite similarly do that just by jumping in here and getting rid of our a and B and there we go that's how you simplify now how about flattening when you flatten something all you're doing is completely removing that data structure so we could take this we could swipe quite simply just set it to 0 of course because this is oh that's that's all the flatten output can do but maybe we wanted to make this 57 and you can just as easily do that now the flip matrix and path shift we need we need a bit more we need some data structure in order to be able to work with that that's what we're gonna do we're gonna cross reference the series component against itself three times and using that we are going to create some points at this point I'm also going to I'm gonna throw down two slides one of them for my count set that to 10 and another one for my step size which will just be a floating point slider and maybe I want that down around 5:00 somewhere then I can plug in my XY and Z actually it'll make that a little bit bigger all right so you plug that into there and we will create our No mapping so the best way to visualize what's going to happen here it is with a polyline and we'll also bring in a point list component I'm gonna plug these points in here and turn the point preview off point preview still on somewhere where isn't on that's alright we'll just get rid of us keep our path there okay so what the polyline has done at the moment is it is created polyline through all 1000 points and you know maybe that's not necessarily what we want so we can do is we can use the we can use the information that we know about this data tree we know that there are 10 by 10 by 10 items in this list so we could do is we could use the what's called the modular function looks like a percentage sign because you are using accented sign and what this what modular basically does is it finds the remainder so if I were to take 6 modulo 10 that would return 6 if I were to take 16 modulo 10 that would also give me 6 if I were to take 26 modulo 10 that would also return 6 and so sorry I have forgot to bring in my eye on my index number on this side as soon as we do that we should now get 10 branches each with a hundred points and you know that's not quite what I wanted what I wanted was a hundred lists with 10 points like so so there we go there is our list of vertical lines now we could also we could also take this and we could go I divided by 10 now this might do something a bit funky at first but I'll show you how to fix that don't worry you can see that it's it's messing up our data structure live and we're getting six points followed by 911 911 and then right at the bottom we get five and that's just because of a weird sort of rounding issue so what we need to do is we need to take the four of I over ten as soon as we take the floor Avaya over ten it's gonna it's gonna basically round these to their lowest integer value which is actually going to fix the problem there we go hundred branches each with ten items listen as we plug that in we now get a list of polylines in a different direction we could also if we wanted to create polylines so we have polylines going in the vertical direction or in the Z we have polylines going in the X what if we want polylines going in the Y what we need to do is floor of I overt and or is it I think it'll be I over one hundred semicolon I modulo ten let's see looks to be working so far and there we go there are our Y Direction polylines all right so now now we can talk about the shift paths and the flip matrix so the flip matrix is quite a useful component if you've only got a two-dimensional data structure two-dimensional data structure is one such as this where we have one list of index numbers and we have one one list of path indices and one list of item indices so if we were to flip this matrix I'm gonna turn my points office on my yeah I'm gonna turn this off from now if we were to flip that matrix and then plug it in here what its gonna do is it's gonna turn these a hundred lists a hundred branches of ten items each into ten branches each with a hundred items and so that's all well and good that might have been what we wanted but with this three dimensional data structure that is most definitely not what we want so we're gonna try plug in this path member here which has created a three dimensional data structure you can see we've got there we go we've got one index here another index here and our third index here but as soon as we plug this into a flip Matrix it's gonna throw an error and the error is all parts must only differ at a single locus so this diff is a single locus because it's only a two-dimensional data structure but if you plug in a three dimensional data structure the flip matrix doesn't know which way you want to flip that whether you want to swap these two or this this this and this it really doesn't know so it kind of becomes useless at this point and that's where this is where the paths pepper really comes into its own because we can create null mapping here and then we'll bring in how I like we did before and then we can just change this any which way we want so I might go B I so this puts every Indyk or every index item number on its own list but it also um completely dismantles the structure that we have in this first item so you can see we've turned these Y directional lines yes these Y directional lines into these Z directional lines alternatively we could go I semicolon a and that'll turn actually I should have made a copy of that yeah so we have so we now have Y Direction Z direction and X direction all right now what about the shift paths I mean should you want to these shift the shift paths requires you to do is if we create our null mapping all you need to do is just get rid of either your a or your B value with the shift paths we only have sorry this one here with shift paths we only have the option of how far to offset the branch whereas with the path method we can choose which one of these branches we are offsetting so if I were to put a polyline through all of these you'll see they're going in this direction but with the path pepper I can create them either in the same direction as the shift paths or I can create them in the opposite direction or I could go even further and I could create them in the third direction because we've got that three dimensional data structure and there you go so I hope this is actually before I before I wrap this up I'll also show you that water you might you might be thinking well if I change my um like my count over here this is really gonna mess up the data structure well thankfully there's a way around that you see we have these um these item count paths count and path index numbers here so I could go in here and got my a B I let me see so if I wanted to keep my data structure I just need to take V let's see it would be I over the item count raised to the power of one over three if you are yes raising anything to a fraction we'll find the root of that number so this is trying to find the cubic root because we've got that three dimensional data structure so as soon as I plug these polylines in here you'll be able to see that if I if I sort of vary these numbers that this will update automatically whereas if I were to plug this in here my daughter structure completely breaks because I've assigned a fixed number so this is a really good way to keep your your path map of parametric as well we'll probably look at this method a little a little bit greater detail and some further tutorials but this is just the first use of the path necklace so that's that's about all I want to show for now before we get into some other tutorials cool thanks for watching
Info
Channel: Daniel Christev
Views: 12,158
Rating: 4.942029 out of 5
Keywords: grasshopper, path, mapper, tutorial, data, structure, lists, yt:quality=high
Id: Tlme9tkpYHo
Channel Id: undefined
Length: 14min 20sec (860 seconds)
Published: Mon Feb 15 2016
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.