sergePayen-OStuto-wireframe3

How to use a parametric file

Tutorial: how to use a parametric 3D model with the software OpenSCAD, in order to obtain a custom-made object.

Download OpenSCAD

Introduction

A parametric file is a “flexible” 3D model. SCAD format is based on CSG modeling. It provides the user with parameters, which can take the values of his choice.

HCW-SpokeStyles1

HCW-SpokeStyles2

Highly Configurable Wheel
File created by Alex Franke – CodeCreations
You can download it here : http://www.thingiverse.com/thing:21486

The interface

This is how a file looks like in OpenSCAD :

customizableKnob-openScad

Customizable Knob!
File created by Charliearmorycom
You can download it here : http://www.thingiverse.com/thing:54024

 

The interface is divided into 2 zones:

– The editor (left)
– The visualization window (right)

  • left click = 3D view
  • right click = Pan
  • scroll wheel = Zoom

 

openScad-viewsIcons

Standard viewpoints (top, bottom, side…).

 

The settings, in black, and their values, in red:

sergePayen-OStuto-editor

Settings, values and comments

A parameter and its value will be written :
parameter = value ;

Comments are small texts to help the user. They are preceded by “//”, or placed between “/*” and “*/”.

sergePayen-OStuto-parameters

 

This is the effect of a change in values for the parameters “Knob Height” and “KnobDiameter” (knob’s height and diameter, in mm):

sergePayen-OStuto-numeric1

sergePayen-OStuto-numeric2

At first, the button was “20” mm high for “20” mm diameter. By simply changing these values to the numbers “15” and “100”, we obtained a button 15mm high for 100mm diameter.

View the changes: the preview

After changing something in the code editor, you must tell OpenScad that you want to generate a preview by pressing F5 (in order to “recalculate” the model).

TO SEE YOUR CHANGES:
PUSH F5
OR THIS BUTTON :

Other types of values

Numerical values expressing dimensions are the most common, but there are others, such as the values used to propose a binary choice (YES / NO). There are then only two possibilities: for “yes” it is 1 (or TRUE), for “no” it is 0 (or FALSE).

sergePayen-OStuto-legoTrue

sergePayen-OStuto-legoFalse

Parametric Lego Brick
File created by Andrew Sweet
You can download it here : http://www.thingiverse.com/thing:231651) :

 

There are also values to propose a choice between several options. These can be numerical values such as “1, 2, 3, 4…”.

sergePayen-OStuto-furniture8

sergePayen-OStuto-furniture15

Customizable Furniture Minis
File created by mathgrrl
You can download it here : http://www.thingiverse.com/thing:332507) :

 

This type of value can also be expressed “in words”:

sergePayen-OStuto-stringCircle

sergePayen-OStuto-stringLine

The parameter then takes a value in the form of a “word”. In this form, the value must be written in quotation marks. The possible options are generally included in the comments.

Obtaining a STL file: Rendering and Export

TO RENDER (REQUIRED BEFORE STL EXPORT)
PUSH F6
OR THIS BUTTON :

openScad-renderIcon

Or via the menu bar : Design / Compile and Render.

TO EXPORT THE 3D FILE IN STL FORMAT
PRESS THIS BUTTON:

openScad-STLicon

Or via the menu bar: File / Export / Export as STL

 

The STL file can then be printed, as here the rotary knob seen above:

sergePayen-OStuto-boutonPrint

And once installed on the LCD controller of my 3D printer:

sergePayen-OStuto-boutonLCD