Solid Extrusions
A classic way for generating 3d solids is the application of a virtual extrusion operation. For this, one needs a basic sketch and calls the extrusion function.
In its most simple form, the extrusion() function takes just the sketch as a first argument and a spanning vector as a second argument. The spanning vector should not purlely be on the X-Y plane since it defines the direction in which the sketch is extruded. In the following example, we assume the sketch to be the one used in the section about sketches:
Example
make extrusion( s, <[0,0,1]> )
Winding number mechanism
Now how does it come that some areas of the smiley sketch are actually solid while others are empty? The four closed curves that were used to define face sketch had different directions: while the outer one has a clockwise direction, the three inner one are defined counterclockwise. These directions allows to determine a winding number for every partial area of the sketch by suming up the clockwise (+1) and counterclockwise (-1) closed loops that encircle the area (see sketch). This winding number is used to determine the extrusion result of each area: if its winding number is a positive number it will be solid, if it is zero or negative, the area will be empty.
The usage of winding number is especially interesting for sketches with overlapping curves. The following example shows this for three overlapping curves:
Note
If an extrusion sketch consists of only one curve, the winding mechanism applies as well. This means that the curve in the sketch needs to be counterclockwise (+1) to make the extrusion work.
Extrusions along paths
Extrusions do not necessarily need to be applied along a span vector. Instead they can be applied along a curve that acts as an extrusion path. This allows to "build" elements like bars, pipes and many others. An extrusion along a path is shown in the following example:
Example
curve p = <[0,0]> -> bezier( <[50,0]>, <[50,-20,50]>, <[0,20,50]> )
make extrusion( s, p )
Example
curve p = <[0,0]>^<[0,0,-1]> -> arc( <[15,0]>, PI )^<[0,0,1]>
make extrusion( s, p )
Beside that more option arguments exist for usage in the extrusion function. For further information see the reference page.