# OpenSCAD Workshop

There will be a workshop on "Parametric modeling with OpenSCAD" in the DAI Makerspace on Saturday, July 23rd from 11:00 to 16:00.

We will give an introduction to parametric modeling and design a few things with OpenSCAD. Please bring your own laptop!

## Contents

## Basic Control[edit | edit source]

Have a look at the user manual for more information and specific functions!

- type into the editor on the left
- whenever you are ready to compile your code to see it in the 3D preview on the right, you can click "preview" or hit F5

- group
*arguments*with`{ ... }`

- group
*objects*by applying`union()`

to a group of arguments - important for CNC!

- group
- subtract
*objects*or groups of objects from each other with`difference()`

- everything is subtracted from the first object or union after this function

`!`

at the beginning of a line shows only that operation`#`

at the beginning of a line shows that object as defined, e.g. also the superfluous parts of a hole

## First Steps[edit | edit source]

We start by defining a small cube (units in mm) with `cube([2,2,2]);`

.

- center the cube by adding
`center=true`

after the vector, between**]**and**)** - translate (move) the cube by calling
`translate([2,0,0])`

- it will end up two mm further in positive X direction

After also tinkering with some spheres and cylinders (enter `$fn=`

followed by a number to define your desired face count, high numbers increase rendering time!) we moved on to parametric designs.

## Parametric Designs[edit | edit source]

We made an "L" with adjustable side lengths and a parametric hole.

The "L" is rather simple and consists of two "cubes" that are actually rectangles due to the entered values. By adding the global variable "edge_length", we can later change the dimensions of the entire letter while keeping its proportions:

edge_length = 5; union() { cube([1*edge_length,5*edge_length,1*edge_length]); cube([3*edge_length,1*edge_length,1*edge_length]); }

Then, we added a hole with a corresponding "hole_diameter" variable and turned the L into a module which can then be called similar to `cube`

or `sphere`

from the first examples:

module L(edge_length, hole_diameter) { difference() { union() { cube([1*edge_length,5*edge_length,1*edge_length]); cube([3*edge_length,1*edge_length,1*edge_length]); } translate([edge_length/2, edge_length/2, -1]) cylinder(r=hole_diameter/2, h=edge_length+2, $fn=20); //sticks out 1 mm at top/bottom, "centered" in corner } } L(4,1); translate([15,0,0]) L(6,2);

The last two lines in this example create two "L" shapes with different sizes, one of which starts at the origin while the other is moved 15 mm in X direction.

### Uploading to Thingiverse (Customizer)[edit | edit source]

Uploading the design to Thingiverse is easy, just click "This is a customizer" in the process and the app will automaticall parse your variable names and the associated comments. Make sure to comment precisely and understandably so others enjoy your customizable creation!

## Links[edit | edit source]

- OpenSCAD website
- User manual
- Jumpstart
- Customizer example: drink name tag
- Thingiverse Customizer Documentation

Organizer(s)

Location

Date

2016-07-23

Time

11:00-16:00