The Complete Magazine on Open Source

Using the Automasonry Python Script in Blender

, / 66 0

The Automasonry Python script extends Blender’s functionality to make creation of buildings easy, comparable to what is done in commercial software like 3DS Max or AutoCAD. Let’s use it to make a castle.

The term automasonry applies to creating anything related to the construction of houses and buildings. However, this script makes a particular job easier for us the creation of virtual sets for animations with Maya, Blender or any other animation software. This script becomes more significant when you want virtual sets with an ancient or medieval appearance.

Basically, this script creates straight walls that can be fine-tuned to look like what you want. Different variables can be set to create a variety of walls, as required. The wall, once created, has no limitations; it could be set to follow a curved object or path. Various combinations of settings could be used to create differing effects and illusions that a particular setting might require. Castles, towers and other ancient buildings could be easily created using this script, which could also be used to create sets for games.

Getting started
Download the script from:
Copy the downloaded script to the Blender default scripts folder. On starting Blender, you can run the script from the Scripts/Wizards menu; the script displays a default GUI with the various parameters represented in sliders, numeric inputs and buttons. The Make this wall! button creates the mesh, and the Exit button exits the script. The WALL inputs let you change the length of the wall (Wall Width), its height (Wall Height), and select straight (Straight Edges) or offset edges. The STONES inputs let you change the X axis scale (Width), the Y axis scale (Depth), the Z axis scale (Height), the bevel on the stones’ edges (Bevel), the width and depth for the grout (Grout W/D), the stone’s height/width symmetry (Row Width), etc. Other options include adding doors (you can specify whether to angle door edges, the door’s size and its position along the mesh), windows (the new input is Spacing for the window array), and crenels.

Creating the default wall
To create your first default wall, simply invoke Add > Mesh > Masonry > Wall. With a few intelligent tweaks here and there, it is easy to make a castle wall in Blender, thanks to the creator of this wonderful script. You could modify the walls using built-in Blender functions however, once you have completed the wall, you cannot return to the properties. Completion, in this case, means changing mode, or adding another object to modify the look of the wall. Figure1 shows you the first wall created with the default parameters of the script.

Creating a tower
Once you are comfortable creating the default wall, having practised it over and over again, you will reach the task of creating a circular tower for your castle. You will be initially surprised to learn that your tower can come to life just by fine-tuning the default wall and setting it up in combination with another element that will modify it quite drastically. For this, first create a Bezier circle in the top viewport (press numeric 7 to go to the top viewport). While the circle is still in edit mode, create a wall using the automasonry script. Now go ahead and scale up the circle to a great extent, so that you are able to get the shape of your tower, as shown in Figure 2.

The appearance of the tower in the camera view shows whether you have been able to arrive at an approximate shape. Once you are satisfied with tweaking the height and width of the tower, apply the modifier and move the tower aside. After the tower wall is created, you now need to create a roof for it. That is done in a similar fashion, but to make a cone-shaped roof, you would have to rotate the newly created circular wall in the X direction to get the cone shape. Try to rotate it till you get a conical roof like the one shown in Figure 3. Once you are satisfied with tweaking the shape of the conical roof, apply the modifier in the stack, and move the roof to position it just above the circular wall. You have managed to create the tower of your castle rather quickly, see Figure 4.

Now create a plain wall intersecting the tower. Once you have created it, duplicate it with Alt+D four times. Place the four walls and four towers in the correct positions to form the simple castle boundary (Figure 5), which can thus be created in a few minutes. You could add other elements to the building and make it as detailed as you like.

This small exercise was to briefly guide you on how to use the automasonry script to make a simple castle boundary. Human imagination has no limits. With further experiments using this script, you could arrive at marvellous structures never dreamt of before.

Sri Ravishankar Sarma
The author is good at handling programs like Adobe Photoshop and Blender. He is also skilled at programming in Linux software.