Recent Changes - Search:

G3 Wiki Read First

* HomePage

* What is Gauge 3?

How To Contribute Content

Contact Administrator


* Pop Rivets and Underframes

* Modify your Sieg C2A Lathe

* Assembling a low cost CNC Router / Laser Etcher

* OpenSCAD and Sample 3D Print Files

* Extended Guide to 3D Printing


This is script based CAD design "language". It is about as hard to master as "BBC Basic" although it borrows from "Pascal" in its methodology. This is a good thing as both are "teaching languages". The former teaches how to write simple programs, the latter teaches how to make simple repeatable modules. It is freely available under GPL in Win, MACOS and Linux versions. OpenSCAD is used to design the object to be printed and to generate the .STL file from the script. This then is used by the production software.


In the centre of a world that is 512mm high (+/- 256), 512mm wide (+/- 256) , and 512mm long (+/- 256), exists the point (0,0,0) from which all things are measured. The script allows for a few "primitives" from which everything can be made.

CUBE This means a rectangular shape.

CYLINDER This means a cylindrical object -can be a cone, frustrum, or cylinder.

SPHERE This means a shape made only of curves -can be smartie, zeppelin or sphere.

POLYHEDRON This means shape with hard edges- can be prism, pyramid, duodecagon etc.


cube(10,10,10); creates a cube that is 10mm x 10mm x 10mm.

The command TRANSLATE moves the origin point of the object.






produces an identical cube that is 100mm to the right of the initial cube.

The following script produces a "Stop Lamp" made from a cube, a cylinder, and a sphere.

//base of lamp


//top of lamp





//lamp bulls eye





The command UNION sticks all the commands together under one name that can be referenced by other scripts. Thus having written the commands for a Stop Lamp. union(stoplamp) will enable you to stick a stop lamp on any future script by simply telling it to stick a stoplamp THERE. In this case at the top of the five barred gate for my level crossings. The command MIRROR produces the mirror image of the union(5bargate) thus rhs and lhs...

3D Modelling using Open SCAD.

Get the software.

The software is available free under GNU 2.0 from the following URL

The software runs under Windows, MacOSX and Linux. The download system will detect which OS you use and push the correct version to you to download. I use version of Linux called Debian and all the screen shots will show a typical Debian screen front end known as Gnome.

After the loader has unpacked and installed the software you will end up with a screen that looks like this:

The programming list is in the white column on the left and the visual display screen is on the right. This shows the centre of the “universe” 0,0,0 which is a cube of (+/-256mm) by (+/-256mm) by (+/-256mm). Holding down the Left mouse key allows you to move the universe through any rotation. Holding down the Right mouse key allows you to move the universe through any axis.

All the objects are initially begun at 0,0,0 and new objects are added at a reference point in “Three Space” with the command TRANSLATE. So, if I translate the start position to 10,10,10 the object is positioned at: 0+10mm in the X axis, 0+10mm in the Y axis, and 0+10mm in the Z axis. All the commands have a series of brackets and braces around them which is used to define parameters such as; three space position (X,Y, Z), rotational position (Xdeg) yaw (Ydeg) pitch and (Zdeg) roll. The DIFFERENCE command turns the second object on its list { … } into antimatter and removes that object from the first -in effect turning it into a cut out shape. To cut a cylindrical hole through a cube use the DIFFERENCE command between { CUBE and CYLINDER }. The ROTATE command can produce an inclined cylinder cut. Altering the initial and final radii of the cylinder produces a cone or frustrum to cut into the cube with. Unless specified -all objects merge with each other.

This is the “Cheat Sheet” which can be found in the HELP section

Yes, it looks initially frightening -but if you study it there is actually very little to learn as most of the commands repeat themselves in various forms.

First steps.

This is a simple program to produce a stop lamp. It consists of three objects. The first is a rectangular object formed by the command CUBE with the X,Y,Z lengths in mm. The next is a cylindrical object produced by the command CYLINDER with the radius at top and bottom and height. The last object is a spherical one produced by the command SPHERE using only the radius.

The top of the lamp has been formed by merging the cylinder 50% into the cube. The bullseye by moving the centre of the sphere to merge at 50% on the top of the cube.

Second steps.

This is an iron roof truss. It has been made by merging rectangles and rotating rectangles to form a unified object. Everything thing between the leading { and trailing } is treated as one object -regardless!

F5 and translation key F6 to STL file.

As you progress building your design in Three Space it is useful to press the F5 key that will give a quick viewpoint on the progress so far. The compiler will often point out errors in logic and syntax but these are normally down to “spelling”...

Once you have finished your design it now needs to be translated into an STL (Stereo Lithography) File. In Open SCAD you do this by pressing the F6 key. You should now have a file with the suffix .STL and this is the one that you use for the production of your design on a 3D printer.

With a little Practice…

This is something that I have been working with on and off for a few months now, although when it is going to be complete is anyone’s guess. This is the nose of an NK50000 shuttle EMU of the Japanese Railways. I plan to use my RepRap to produce the raw shape from with a lot of smoothing and filling to get the correct curves. Like the US GG1 locomotive all of the panels were hand made on “english wheels”. Each of the panels is thus unique and they were rolled into the correct joined form, the rivet things are ornamental!

Using the basic blocks of Cube, Cylinder and Sphere with the Difference command to cut and shape with I am beginning to get a form that I can start with.

The green areas show the “cutting scars” for the use of the DIFFERENCE command. The front peaked nose is a cube hacked into with a cylinder, similarly the glass viewport is a sphere cut with a cube.

Despite the seeming complexity of the total shape, the script consists of one command per line with the parameter numbers to the command. In the script the commands between each set of semi colons (;) is a shape. This is for programming neatness, as I beautify my scripts for ease of reading.

The Pre-Written Program Scripts for you to play with.

All of these are OpenSCAD files .SCAD. These arere all used to produce the station exhibited at the AGM called "Brassica". I have written them all and they are given to you to edit and experiment with under GNU 2.0. Being an M.I.A.A.P. they are written with a distinct commercial style with short lines and plenty of comments. I have sorted them into alphabetical order for you to work from. The browser will open up a text file for you to copy and use. If you have a good script then please send it to be included here for others to use!

Level Crossing Five Bar Gateview
10 Gallon Milk Churnview
135 deg canopy bracketview
Arched Coving Stonesview
Arch support ringview
Arch seat stoneview
Axle box pt1view
Axle box pt2view
Boiler Ringview
90 deg Bracket 3view
90 deg Bracket 4view
Brake Blockview
Brake Holderview
Brake leverview
Bridge gantryview
Buffer plateview
Canopy Bracketview
Chuff camview
Coving stonesview
Cylinder rearview
Flemish brick wallview
Foot bridge bracketview
Foot bridge bracket 2view
Hook Plateview
Johnson motor mountview
Lattice bridge baseview
Lattice bridge sideview
BR Oleoview
Park benchview
Q sensor bracketview
Quoin wallview
Quoin wall 2view
Quoin wall LHSview
Quoin wall RHSview
Roof trussview
Brake shuttleview
Wheel Splasherview
Stairs LHSview
Stairs RHSview
Trestle Bracketview
Trestle seatview
U axis connectorview
Brake Vee hangerview
Window 2 blocksview
Wall pillerview
Wall piller cornerview
Wall piller endview
Window blocksview
Window north lightview
Window Piller endview
Window grillview

The following SCAD files are designed for the window frames of the 2-NOL design by Chris Barron. These are very delicate as they range from 1mm to 1.5mm thick. I recommend that you print them at 50% frame rate with a bed temperature of 70C and a nozzle temperature of 210C using standard PLA filament.

Compartment Windowview
Door Windowview
Door Window panelview
Double Window panelview
Driver Windowview
End Window panelview
Front Window panelview
Luggage Windowview

The following SCAD files are to produce a ballast filled stockade type buffer. Again I would recommend that you print them at 50% frame rate. Use a bed temperature of 60C with a nozzle of 210C using standard PLA filament. I used a 0.4mm nozzle and a layer height of 0.2mm to obtain a rough finish.

Buffer frontview
Buffer LHSview
Buffer RHSview
Buffer rearview

You will need to print the "Stop lamp", eight of the "large 90 degree 4 brackets" and two "BR OLEOs" to complete the assembly. All of these are found in the files above.

These SCAD files are something you would not expect to find here! BUT I am building the NYC "Black Bug" a gas turbine powered locomotive. This is a pure thrust loco having no powered wheels. The jet pod that was fastened to the roof was an inverted jet pod from a B-36 intercontinental bomber... So, if you would like to build a pure thrust loco -or a B-36 intercontinental bomber -these will help you.

Jet podview
Jet pod rear baseview
Jet pod rear topview
Jet pod Topview

These files are to build a simple 4 aspect BR era colour signal. The lamps are 8mm LEDS. Remember the order from top to bottom is Yellow, Green, Yellow, Red. The sequence is Red, Yellow, double Yellow, and then Green. The Red lamp should be a (scale) 22 feet above ground level for a gantry or a (scale) 10 feet above the left hand railhead.

4 Aspect Hoodview
4 Aspect Baseview

Edit - History - Print - Recent Changes - Search
Page last modified on June 21, 2020, at 06:34 PM