Learn How to Manage Data By Modelling a Twisted Voxel Tower

Bradenkoh
All Things Computational
7 min readApr 6, 2022

Hi there,

In keeping with last week’s theme, we are going to be creating a twisted voxel tower. Since we were briefly introduced to data management skills in the last article, I thought we build on that by using a bigger dataset. Instead of managing multiple lists of floor profiles, we are going to be managing voxels (which are cube-like shapes) and each floor has many voxels. There is a lot of data to manage which should help you get acquainted with some more data management skills.

1. Create a Grid of rectangles

I start off by first creating the grid which will serve as the floor profile for the podium and the base shape for the voxels.

You can control the number of cells created in either the X or the Y direction by changing the Ey or the Ex input. I am leaving mine at 20 each at the moment but if you find that your computer starts to struggle later, you can lower this number and increase the size of each cell to compensate.

I can also take a look at what the data looks like after Grasshopper has created the grid. This is always a good idea when you use a component that generates a lot of data for you. I will first hover my mouse over the output to see what the tree structure looks like.

I can also see how Grasshopper is organizing the data by using a combination of the List Item and the Tree Branch components to get a better idea of how the data is organized.

When I use the List Item component to see the first index of each branch. I can see that Grasshopper is storing the X cells in the index of all the branches.

Then, I use the Tree Branch component and analyse the first tree branch, I get the cells in the Y direction.

2. Extrude Upwards and create the floors

Then I make our first floor by first making the squares a surface and then extruding that surface by a certain distance.

I can then follow the same steps that I did last week by using the LinearArray component to make the floors. Let’s see what happens when I do that.

The results look quite promising, I can then take a look at the data structure that Grasshopper gave me.

So, even though the output looks good, the data structure isn’t in a format that I can easily use. It is not going to be easy for me to rotate each floor with that data, so I have to do perform some data manipulation so that the data is in a useable format.

3. Restructure the data

So to do that, I am going to make use of one of Grasshopper’s features, groups. Which allows me to group geometric objects together and treat them as one entity. I am going to group all the voxels per floor into a group and then pass it through the linear array again.

And by grouping the data beforehand, it has given the same output as before but in a data format that is easier to use. The output of the LinearArray component now is a simple list of the groups and I know each group represents each floor.

I can even treat this as a simple list like before and apply a rotation to each floor. To do that, I have to first figure out the center of rotation as the Voxels are not built with the origin at their center.

4. Rotate Floors

To calculate the rotation origin, I can use the base grid that I made at the start of the script. I can first get all the centroids of each square by using the Area component.

Then, I can get the average point which will be the center of the floor using the Average component.

Then I can continue applying the rotation to each floor using the newly found rotation center.

I now have the podium for the tower. Before I move on to creating the rest of the tower. It is a good time to reorganize the script because I have just completed a chunk of logic and it would be good to separate out the rest of the logic from the one that I just did.

So, to do that, I am going to make use of data containers just to keep things organized. I’ll use them to pull out all the relevant variables that I am going to need for the rest of the tower.

5. Organize the script

After a bit of thinking, these are the variables that I know I am going to need to create the body of the tower.

I know this because the body of the tower has to start at the top of the podium. It has to have the same rotation as the last floor of the podium and it also has to be smaller than the podium itself.

At this point, I also like to use the Scribble component to leave a note that this portion of the script is responsible for generating the podium

6. Create the body

I then move the variables down the canvas to make more room for myself. I will also start creating the body by taking that initial floor of voxels and move them to the last floor of the podium. I can also apply the final rotation to it.

I can then use the ScaleNU component to scale this level of voxels in the X and Y direction to create a smaller footprint. I don’t use the normal scale component because I don’t want to scale the height of the voxels

This will be the first floor of the body of the tower. Then following the very similar steps as before, I can create the body of the tower

and I have my full twisted voxel tower with a podium too. And this is how the final script looks.

You can see that with a bit of organization, I can come back to this script at any time and instantly know how this script works. By organizing the script now, I can leave breadcrumbs for my future self or anyone else on how this script is used.

Final Thoughts

The type of data management introduced here is different from before. Where, before we wanted the numbers of the data to match, here, we want the data in a format that we can easily manipulate and control instead.

As usual, you can find the Youtube version of this Newsletter below.

You can also download the Grasshopper script that I use for free through the link below. (Just set 0 dollars, but happy to get a tip too :) )

If you found this helpful, consider subscribing to the Newsletter and the Youtube channel, it really does help me out.

but as always, Thanks for reading

Braden

You can find the Youtube version of this Newsletter here :

You can find the Grasshopper Script for this model for free here

(Just Set a Price of 0 dollars)

Read the Previous Edition here :

Originally published at https://allthingscomputational.substack.com on April 6, 2022.

--

--

Bradenkoh
All Things Computational

Engineer. Programmer. Computational Designer. Currently in Sydney.