Visualisation of building a masonry wall. Built with pygame. The supported bonds are stretcher bond, English Cross bond, Flemish bond, wild bond.
The visualization is a python3 script depending on pygame. If you already have python installed, use the following commands on a unix machine to run the visualization inside a venv.
python3 -m venv venv
source venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txt
python runme.pyThis will run the visualization for stretcher bond for a 2300mm wide by 2000mm in height wall (basic requirements). It will look like this.
Press enter to lay a brick. Press backspace to remove the latest brick. Bricks have stride numbers of them. The dark gray rectangle behind the bricks represents the current envelope — 800mm wide and 1300mm high area within which the machine can reach the bricks.
By default the config for the visualization is read from the file stretcher_bond.wallconfig. You can change the input file for the config with the --wallconfig option. Example:
python runme.py --wallconfig flemish_bond.wallconfigThere are 4 pre-made configuration files (1 for each supported bond).
The visualization works in 3 steps:
- Generate the brick pattern
- Generate the steps to lay the pattern
- Visualize
It is possible to produce artifacts on steps 1 and 2 and load them into the visualization instead of generating the brick pattern and the steps from scratch every time. This is useful if you want to debug a specific case of a generated wild bond pattern or save these annoying seconds on generating the bricklaying steps.
To do so, run the steps separately. Using --mode option to choose the step and --brickpattern and --bricksteps options to pass the generated pattern and steps files.
Example step 1:
python runme.py --wallconfig wild_bond.wallconfig --mode pattern > pattern.txtExample step 2:
python runme.py --wallconfig wild_bond.wallconfig --brickpattern pattern.txt --mode steps > steps.txtExample step 3:
python runme.py --wallconfig wild_bond.wallconfig --brickpattern pattern.txt --bricksteps steps.txtIt looks like there are several flavors of wild bond. My algorithm implements the following restrictions:
- The even and odd courses are shifted by 1/4 of a brick relative to each other. It is achived by using a drieklezoor brick in the beginning of odd courses (numbered from 0) and a drieklezoor brick in the end of even courses. The rest of the bricks in the wall are full bricks and half bricks.
- Full bricks and half bricks are mixed randomly.
- No two half bricks next to each other, either horizontally (in the same course) or vertically (in the different courses)
- No more than 5 staggered steps.
4.1 A "left" staggered steps of length
$n$ is defined as a sequence of bricks$b_1, b_2, ..., b_n$ such than they are located in courses$k, k+1, ..., k + n - 1$ and the brick$b_{i - 1}$ is shifted to a distance of a quater brick to left relative to the brick$b_i$ , i. e.$x_{i - 1} + joint - x_i = -q$ . Trivia: one brick forms a staggered steps of len 1. 4.2 A "right" staggered step of length$n$ is defined as a sequence of bricks$b_1, b_2, ..., b_n$ such than they are located in courses$k, k+1, ..., k + n - 1$ and the brick$b_{i - 1}$ is shifted to a distance of a quater brick to right relative to the brick$b_i$ , i. e.$x_{i - 1} - joint - x_i = q$ . 4.3 A staggered steps is either a left staggered steps of a right staggered steps.
My algorimthm for choosing the order of laying bricks is the same for all bonds.
For each stride I iterate through the
The pattern for wild bond is generated brick by brick. I generate options for the next brick: full brick if possible (i. e. doesn't create staggered steps) and half brick if possible (i. e. doesn't create staggered steps and isn't adjacent to an already layed half brick). If the list of options is empty, I go 5 bricks back and generate them again. If this doesn't help, I regenerate from the previous course.
