ImplicitCAD

ImplicitCAD (Extopenscad) Tutorial

This tutorial will teach you how to design objects in ImplicitCAD's extopenscad language. It requires no knowledge of Haskell.

If you already know OpenSCAD, you may prefer to look at the section of our FAQ comparing extopenscad and OpenSCAD.

Running ImplicitCAD

You have two options for using ImplicitCAD: using the online editor or installing it locally.

If you run it locally, ImplicitCAD is solely a compiler, turning .escad files into your preferred form of output. You need a separate editor and viewer (eg. meshlab).

$ extopenscad test.escad test.stl
Rendering 3D object to test.stl
...
$ meshlab test.stl

On the other hand, using ImplicitCAD in the editor is as simple as clicking the "Render" button. It does, however, require WebGL.

A Simple Object

To begin with, let's make a circle...

circle(10);
Try this code!

This is a circle of radius 10 (by default, milimeters). Circle can also be used to make regular polygons using the $fn parameter.

circle(10, $fn=6);
Try this code!

We can also make 3D objects, like spheres.

sphere(10);
Try this code!

There are also squares, which can be used either as perfect squares (eg. square(10)) or as rectangles (eg. square([10, 15])) and can even be given rounded corners:

square([10,20], r=3);
Try this code!

The 3D analog, cube behaves similarly (eg. cube([10,20,30])). Other primitives include cylinder and polygon. There primitives are all documented in the API Reference.

Rendering Quality

ImplicitCAD has a near-perfect model of your object internally, but when you ask for it to be rendered in some format, it isn't possible to export it in that manner. ImplicitCAD can try to export it very quickly and not do as good a job, or take longer and do a better job. This is rendering quality.

Rendering quality is controlled by the variable $quality which is by default 1. You can make it arbitrarily high, though the server will refuse to render objects at very high qualities because it needs to serve many people. The amount of time it will take to render is linear with respect to quality, so doubling quality will approximately double the amount of time it takes for your object to render.

Rendering quality is particularly visible when exporting triangle meshes.

Making More Complicated Objects

The key thing to building more complicated objects is to make them out of less complex ones. The simplest way to do this is with a union, which simply "adds" objects together. Note that we use translate to shift an object.

union() {
  square(20);
  translate([10,10]) square(20);
}
Try this code!

Union is capable of rounding ("beveling") the interface between the objects being unioned.

union(r=3) {
  square(20);
  translate([10,10]) square(20);
}
Try this code!

There is also difference which cuts away pieces from an object, and intersection which takes, well, intersects them. Both of these also support rounding. (Again, you can refer to the API reference for more information: API Reference)

difference(r=3) {
  square(20);
  translate([10,10]) square(20);
}
Try this code!

Linear Extrude

Linear extrude is both a powerful tool and a good example of how ImplicitCAD philosophy of generalization. At its simplest, linear_extrude turns a 2D object into a 3D object by extruding it on the z-axis.

linear_extrude(height = 20)
  circle(30);
Try this code!

But we don't need to give a constant height to extrude to. We can give a function of x and y.

linear_extrude(height(x,y) = 20 + (y^2-x^2)/60)
  circle(30);
Try this code!

And we can scale, translate, and twist the object as we extrude! For example:

linear_extrude(20, scale(h) = 1 + cos(h)/10)
  circle(30);
Try this code!