Extrusions & Cuts
In this tutorial you learn how to write the code to create a model from a sketch in DynaMaker. The example is a metal washer using one extrusion and one cut, similar to a stamping process.

You will complete four steps:
1. Create App & Block
Create a new app via + Create as done in Tutorial 1, or simply create a copy of it:

2. Create Sketch
Already in your new component block, create the base circle sketch:
- At the top of the code section, click 2D Geometry > Sketch > Template > Circle.
- Click Create.

You will see the new generateCircleSketch() function under GEOM2D:

3. Create Model
With the sketch ready, create the extrusion:
- Click 3D Geometry > Extrude > Template.
- Select the generateCircleSketch we just created.

You will see the new generateExtrudedCircleModel() function under GEOM3D:

4. Add Cut to Model
Add the hole to the washer inside generateExtrudedCircleModel:
-
Define the hole diameter (80% of the washer diameter).
const holeDiameter = 0.8 * diameter -
Create the hole sketch using the GEOM2D function with
holeDiameter.const holeSketch = GEOM2D.generateCircleSketch(holeDiameter) -
Add the cut using the same plane and extrusion length.
model.addExtrudeCut(holeSketch, plane, extrudeLength) -
Click Save & Run to apply changes.
tipYou can also use Ctrl/Cmd+S to Save & Run.
If you are prompted to save the web page, first focus the code editor by clicking inside it before using the shortcut. -
The completed function matches the version below.
export function generateExtrudedCircleModel(diameter: number, extrudeLength: number) {
const model = new SKYCAD.ParametricModel()
const sketch = GEOM2D.generateCircleSketch(diameter)
const plane = new SKYCAD.Plane(0, 0, 1)
model.addExtrude(sketch, plane, extrudeLength)
const holeDiameter = 0.8 * diameter
const holeSketch = GEOM2D.generateCircleSketch(holeDiameter)
model.addExtrudeCut(holeSketch, plane, extrudeLength)
return model
}

If you do not want a dynamic thickness (extrudeLength), create a constant const thickness = 5 instead, so the
function looks like this:
export function generateExtrudedCircleModel(diameter: number) {
const thickness = 5
const model = new SKYCAD.ParametricModel()
const sketch = GEOM2D.generateCircleSketch(diameter)
const plane = new SKYCAD.Plane(0, 0, 1)
model.addExtrude(sketch, plane, thickness)
const holeDiameter = 0.8 * diameter
const holeSketch = GEOM2D.generateCircleSketch(holeDiameter)
model.addExtrudeCut(holeSketch, plane, thickness)
return model
}

The slider for extrudeLength disappears above the visualization because it is not an input to
generateExtrudedCircleModel anymore but a constant (thickness) instead.
In the next tutorial (3D Models) you go deeper into functions and make more changes.