Grasshopper Tutorial 07 | List Basics

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
alright let us start talking about lists now we've already encountered lists in our exercises for example when we created this paneled surface so I'm going to start by just displaying the selected objects so we have this curve and we divided it and so we put one curve in and on the other side we get this list of points so let's look at them with a panel you can see now that we have because we're dividing it into eight segments we get nine points and each of these points of course has got an X a Y and the Z coordinate and this list has got indices so the number here at the beginning is not part of the coordinate it's simply where that coordinate comes in the list so the first item of a list will always have the index of 0 because the counting firm the index starts at zero and grasshopper so go 0 1 2 3 and if we have nine elements on our list the largest index will be eight and you can already see that we're dealing with a list as an output because the line which connects the blocks hair looks different see if we have a single curve we get a solid line if we have a list of coordinates for example we get this double line and you can see this as we continue so we take this point and turn them into a polyline so we've got a double line going in and a single line going out because what's coming out is a single polyline curve alright and then we explode it again so we go in with the single polyline and out comes a list of line light curves and when we then extrude them we get another list of untrim surfaces and now when we do our linear array what happens is that we are going to get hang on i'm going to put up another panel here we go we get this list of lists all right so previously we had these eight untrained surfaces and now for each of these eight trimmed eight untrimmed surfaces we've created a linear array of four so what we've got is a list of Lists kind of and a grasshopper this is called a tree so what's happened is that out of these seven list items we've created seven branches of a tree and then each of these branches has got a list attached to the end with four entries and you can see this tree if you get take the param viewer tool you can see it says okay I've got eight branches and each of these has got four entries in its final list and if you go right click drawer tree you see what why they talk about a tree here but all this tree stuff is something we're going to be getting into later during the course for now it's just to let you know why this looks different from this and why sometimes you get these lines which are dashed instead of simply double that means it's a tree okay so I'm going to hide all of this and we're going to talk a little bit about generating lists hide it let's go down here now I was going to cover a few ways of generating a list these are not all the ways to generate a list and you can see a lot more options for generating lists here for example in there in the sequence panel so what I'm going to start with is the range now the range takes a domain so a start and an end and then a number of steps so if we put a panel on the other side you can see the default ranges from 0 to 1 and we've got 10 steps alright so the step is the disc between every single item so because we've got 10 steps we end up with 11 values that's something to keep in mind and I'm going to add a slider here to change the number of steps so you can see as we change the number of steps that same domain from 0 to 1 gets divided into the calling number of steps so if you've only got one step it goes 0 to 1 now the next question you'll probably have is well how do you change the start and the end for that we have to construct a domain and for that you go to the math tab and you can see this domain section and we can go construct domain and all the domain once is where do I start and where do I end so if we take two more sliders and let's go to four we go put then their domain start domain end and then plug this domain into here you can see that now we're taking five steps between two and four and we can change this anyway we like you can even go and have the end be lower than the start so now instead of going from one to nine we're going from nine to one alright so the direction doesn't matter now let's compare this to another command for generating this actually just let me maximize the grasshopper here get a little bit more space okay so let's compare that with the series command now series unlike the range commands actually has got three inputs alright so I'm going to let's start here we've got and what it takes is it takes a start and step size and then a number of values in the series all right so let's start it at zero and then say that each step is supposed to be three wide and that we want to have five entries then what we get out in the other end is exactly five value because we set a count of five and each of these values will be free away from the previous value all right so if we increase the step size the final the highest number the last number will grow so here we've divided a domain we've divided something between a start and an end and here we just give it a start and then how big the steps are and how many steps is supposed to take these are two of the most basic and probably most often used ways of creating a series or a range of numbers of course there is a third way and that is simply to type it manually if you simply do a panel double-click into it and then start writing values so too and we're going to have a 35 maybe and a seven point a and then 42 we can create our lists arbitrarily by hand alright problem is this doesn't look the same way as that and actually this will be interpreted as to carriage return 35 carriage returns 7.8 carriage return and then 42 so if you get a list of these values we have to go right click and then deselect multi-line data and then we've got a list which we can use for whatever purpose we intend right so that's just three useful ways for creating lists there's a lot of other ways to create one you can create random lists and you can create sequences you can repeat things and we'll probably run into a few of those doing later videos but for now I would like to show you a few two commands which are very important namely obtaining information from a list so if you've got a list how do we get at the data inside that list and one thing that's very important usually is to be able to determine the list length so how long is that list and this could for example be useful if you've got a list of for example line segments or you've got a list of floors or something and you need to generate some form of geometry which has got the same amount of entries or maybe half that amount of those entries then of course if you want to create a fully parametric you would have to determine how many items have I God and how many items do I have to create now and for that you can use this length command so if you plug it in here you can see six entries the length is six straight forward so how do we now get at the data inside of these lists well we use the index and for that I would actually like to show you an example say we have a surface and a command you're already familiar with is the deconstruct breath all right so if we've got a geometry or in this case a breath now let's go set one geometry here we go let's hide this visibility hide objects there we go so we've got this actually let's also hide that line there we go so if we plug this geometry into the deconstruct rep command we get three things out on the other side so I'm going to use another geometry poweramp block and then hide these two so that we can look at them individually so the first one is the face so the actual surface and the next thing is the edges and then you've got the vertices so the four corners here and let's say we want to use these edges and divide them to create a division of the surface or we want to have the corners to create some form of other geometry from this maybe we only need two of the edges or a single edge well what we are getting here of course is a list right you can see we've got four curves here and to get at those individual curves what we can use is the list item block so we plug a list in and then give it an index and outcomes that item from the list so let's do this here so right now by default that item index is 0 so i'm going to put slider here and there we go and now we can actually go through those four curves so i can go 0 that's the second one so index one index to index three and actually i can go to index for even though this doesn't have an index for go to five six seven eight nine ten and the reason that i can do that is because but the rap is set to true so once it reaches this it starts at the beginning again so if you so full user toggle to change that value so now it's false and you can see that for these first four indices i actually get a result and as soon as i go beyond that this will give me a warning saying supplied index is too high all right now this item list item block has got a very useful feature if you zoom in on it these plus icons will appear and if you click on them what you can actually do is if you just leave this at the default value of zero we can actually just get index 0 1 2 3 and that makes it very very easy to then access the individual things so you don't actually have to copy paste this block you just create one zoom in hit plus a few times and there you go and so now we could say okay I want to have the top and the bottom curve so i'm going to use index 0 and index 2 and i'm going to use shift to put both of these in the final geometry block hide this and now I've got those two or I could take these two right or do the same thing with the vertices and now I could take that and go line here we go and create one line between those two points let's delete this and create a second line between the other two there we go diagonal cross bracing done all right so that's how you can get at the different items in a list I've also sewn showing you how to determine length of a list how to create a range a series and how to manually create lists thank you for watching
Info
Channel: Individualized Production in Architecture
Views: 12,905
Rating: 5 out of 5
Keywords: Grasshopper, RWTH
Id: _a9wIr7DAz0
Channel Id: undefined
Length: 14min 56sec (896 seconds)
Published: Thu Nov 17 2016
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.