sergePayen-OStuto-wireframe3

How to use a parametric file

This article’s goal is to explain how to use a parametric file with OpenScad, to produce a made-to-measure object.

DOWNLOAD OPENSCAD

 
 

1/ INTRODUCTION

A parametric file is a “flexible” 3D model. SCAD format is based on CSG modeling. It provides the user ability to use parameters, and to choose which values are associated with each of them.

HCW-SpokeStyles1

HCW-SpokeStyles2

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

 
 

2/ 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

 

Interface is divided into 2 zones :

– Editor (left side)
– Viewing area (right side)

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

 

openScad-viewsIcons
Orthogonal views (top, bottom, side …)

 

Settings (black) and their values (red) :

sergePayen-OStuto-editor

 
 

3/ PARAMETERS, VALUES AND COMMENTS

A parameter and its value are written like this:
parameter = value ;

Comments are small texts to help the user, preceded by // , or enclosed between /* and */ .

sergePayen-OStuto-parameters

 

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

sergePayen-OStuto-numeric1

sergePayen-OStuto-numeric2

At first, the knob was “20” mm height for “20” mm width. By simply changing these values by the numbers “15” and “100”, we obtained a 15mm height knob, for 100mm width.

 
 

3/ VIEWING CHANGES : PREVIEW

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

TO SEE YOUR CHANGES:
PRESS F5
OR THIS BUTTON :

 
 

4/ OTHER TYPES OF VALUES

Numeric values ​​that express dimensions are the most common, but there are others, such as “Boolean” values. A Boolean value has only two possibilities: either it is 1 (or TRUE), or it is 0 (or FALSE). Typically, Boolean values ​​are used to provide a binary choice (YES / NO).

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 offer a choice between several options. These can be numeric values ​​like “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 values ​​can also be expressed “literary” :

sergePayen-OStuto-stringCircle

sergePayen-OStuto-stringLine

The parameter then takes a value as a “word”. In this case, the value must be enclosed between quotation marks. The possible options are usually written in the comments.

 
 

6/ GET A PRINTABLE STL FILE : RENDER AND EXPORT

TO RENDER (MANDATORY BEFORE EXPORTING STL)
PRESS F6
OR THIS BUTTON :

openScad-renderIcon

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

openScad-STLicon

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

 

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

sergePayen-OStuto-boutonPrint

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

sergePayen-OStuto-boutonLCD