Brick wall
Contents
Introduction
Expected Time: 30 min
This tutorial will be about creating a curved brick wall using a 'stretcher bond' brick pattern that consists of bricks of the same size laid from the mid of each bricks above and below. In this tutorial you will you will use mathematical functions to generate the wall and will use the dispatch function to achieve the 'stretcher bond' pattern.
The Design
As said before, the task of this tutorial is to make a curve brick will with a 'stretcher bond' brick pattern. The variables of the definition will be:
- the wall height
- the wall length
- the brick dimensions
- the vertical and horizontal distances between the bricks
Creating a cosine curve
The first step will do is to generate the basic curve shape of the wall with a cosine function. We first make a list of points with the cosine function. Then we translate these points to a curve with the 'Interpolated curve' function.
- Add a cosine node to the canvas
- Connect the cosine function to the Y input of a Construct point node
- Create a range and connect the output to the cosine input
- Define the domain with a Construct Domain node
- Connect the range output to the X coordinate input
Create two sliders and connect them to the a and b input of the domain. Set the a input of the domain to zero and the b input of the domain to 30. Define the amount of bricks in the y direction with the Steps input using a Number Slider.
- Connect Number Sliders to the Domain start, end and Steps input
Now we translate these points in an interpolated curve:
- Create a curve from the points
Now you will have the basic curve that will be used to define the shape of the wall. In the next step we will create the basic location and rotation data for the bricks.
Defining the location and rotation data for the bricks
We will use the cosine curve from the previous step and divide this with a preset distance between each division point. This distance will be related to the distance between the center of each brick. The first thing we do this step is creating a series of vertical lines. The height of these lines will be our height of the wall. First divide the cosine curve with the 'Divide distance' component.
- Divide the curve into smaller distances
- Make a slider and connect this to the D input (distance between points) and set the slider value to 1.00
In the next few steps, we will use the tangents of the curve to define the directions of the bricks. You can visualize them using the Vector Display component.
- Visualize the tangents using Vector Display
If the Vector arrows are not visible, you can make them larger by right-clicking on the icon and setting a default size in the arrow tab.
Now we will create a vertical line using the divided points as Start. After that, divide the individual lines again using the Divide Distance component. The vertical division parameter will define the vertical distance between the center of each brick.
- Connect the Divide Distance Points output to a Line SDL
- Define the Direction with a Z Unit vector
- Specify a Length using a Number Slider
- Connect the Line output to a Divide Distance Curve input
- Specify a Length using a Number Slider
Next we create a horizontal plane for each point we just created.
- Create a horizontal plane from the division points
Your model should like the following illustration:
If the planes are too big or small, you can change the settings in the display tab of Grasshopper. This does not influence the outcome of the script, but only changes the visuals.
Before continuing, we first need to flip the data. Currently, the branches and lists of the branches are structured in the wrong way. Therefore we can use the 'Flip Matrix' component. Feel free to connect some panels to find out how it works!
- Flip the Plane output matrix
Now the data is not structured per origin point of the original curve we created, but based on the height.
The following image shows how the Flip Matrix component works
We now connect the flipped data to the input of an Align Plane component. The direction is based on the Tangents we found in the first Divide Distance outputs.
- Add an Align Plane component to the canvas
- Connect the Data output to the Plane input
- Connect the first Tangents output to the Direction input
Populating the bricks
Last step is populating the bricks according the planes. We use a 'Center Box' component that will use the aligned planes a basis to generate the bricks. But before we do this we have to achieve the 'stretcher bond' brick pattern. We will use a 'Dispatch' to get this result.
The 'Dispatch' component tests a list of data according a true false pattern. The true values will be listed in the A output and the false values in the B output. Before we use the dispatch function we have to flip the matrix of the Plane output of the 'Align Plane' component from step two. Connect the output of this flipped matrix to the List input of a dispatch function. Since the internalized pattern already is correct, we don't have to add any input.
- Connect a Flip Matrix component to the Plane output
- Dispatch the Data
Copy the 'Dispatch' component with the 'flip matrix component' and connect one of the copied groups to the A output of the first 'Dispatch' and the second group to the B output of the Dispatch.
- Connect a Flip Matrix component to the List A and List B output
- Dispatch the Data outputs
If you select one of the last dispatch nodes on your canvas, the model will look like the following image:
Now we generate the bricks. As said before, we will use the 'Center Box' component for this.
- Create a Center Box from the List A output from the top Dispatch and another one from List B of the bottum List B output
Now create tree sliders to define the X, Y, and Z Dimensions of the box. You will see brick shaped boxes populated according the planes and you finished your 'Stretcher bond' cosine wall.
- Define X, Y and Z with a Number Slider
- Connect the Box outputs to a Geometry parameter
Depending on your X, Y and Z values, your model will probably look like this: