Version 0.55.1

The make Command

A major concept of trCAD is that the execution of each script creates one final 3d object as output. This "output object" is ubiquitously present during the script execution, although it does not contain any content when the script starts running. Then the scrip code continuously "fills up" the object during execution until the final 3d object is created.

The most important command for this "filling up" process is the make command. It must be followed by a solid object expression the make command works on. (The creation of solid objects is explained in more detail in the following sections. Here we just need to know that the given expression sphere() creates a spherical solid object that is used in the examples.) The make command copies its argument solid into the script's output. One can therefore think of the make command as a kind of punching tool into reality for solid objects:

Example

make sphere()

Output solid created from the example. This is the next line without anything else.

The make command combines the solid it acts on with the previously created output. This means that one solid can be used as a helper tool to repeatedly create output. This gets clear by the following example that uses the same sphere five times to create a five-ball solid output. (The solid data type and the translation function are explained later in this tutorial.)

Example

solid s = sphere()
for( int i = 0; i < 5; i++ )
  make translation( <[ i, 0, 0 ]> ) >> s

Five spheres created by successive calls to make.

🗙

Search results for