Brick wall

From TOI-Pedia


Introduction

LEVEL: ADVANCED
Expected Time: 30 min
Result of this tutorial

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 of your script

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 Math » Trig » Cosine
  • Connect the cosine function to the Y input of a Construct point node Vector » Point » Construct Point
  • Create a range and connect the output to the cosine input Sets » Sequence » Range
  • Define the domain with a Construct Domain node Math » Domain » Domain
  • Connect the range output to the X coordinate input


Current Rhino viewport

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 Params » Input » Number Slider


A curve from the created points

Now we translate these points in an interpolated curve:

  • Create a curve from the points Curve » Spline » Interpolate

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

Divide the curve into smaller distances

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 Curve » Division » Divide distance
  • Make a slider and connect this to the D input (distance between points) and set the slider value to 1.00 Params » Input » Number Slider


Vector display
Visualization of the vectors in the viewport

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 Display » Vector » 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.

Create vertical lines with division points

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 Curve » Primitive » Line SDL
  • Define the Direction with a Z Unit vector Vector » Vector » Unit Z
  • Specify a Length using a Number Slider Params » Input » Number Slider


Your model should look like this
  • Connect the Line output to a Divide Distance Curve input Curve » Division » Divide distance
  • Specify a Length using a Number Slider Params » Input » Number Slider


Create a horizontal XY plane

Next we create a horizontal plane for each point we just created.

  • Create a horizontal plane from the division points Vector » Plane » XY Plane


The current viewport

Your model should like the following illustration:

Change the size of the planes

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.

Flip the data matrix

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 Sets » Tree » Flip Matrix

Now the data is not structured per origin point of the original curve we created, but based on the height.

Flip the data matrix

The following image shows how the Flip Matrix component works

Align the planes

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 Vector » Plane » Align Plane
  • Connect the Data output to the Plane input
  • Connect the first Tangents output to the Direction input


Populating the bricks

Flip the matrix and dispatch the data

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 Sets » Tree » Flip Matrix
  • Dispatch the Data Sets » List » Dispatch


Flip the matrix and dispatch the data again twice

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 Sets » Tree » Flip Matrix
  • Dispatch the Data outputs Sets » List » Dispatch


Dispatched planes

If you select one of the last dispatch nodes on your canvas, the model will look like the following image:

Generate the bricks

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 Surface » Primitive » Center Box

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 Params » Input » Number Slider
  • Connect the Box outputs to a Geometry parameter Params » Geometry » Geometry


A brick wall

Depending on your X, Y and Z values, your model will probably look like this:

The final script


Personal tools
Actions
Navigation
Tools