Getting Started with OpenScad

in #design3d6 years ago

openscad2.png

Have you ever wondered how the customizable 3d objects are made on Thingiverse?

Rather than made with, say, Fusion 360 or Blender, they are built with a type of parametric 3d design code called OpenSCAD. The S stands for "Solid", or according to some, "Scripted". Regardless, it is a whole different way to think about 3D.

With OpenSCAD, instead of drawing and modifying objects with your mouse, you describe your objects in code, and modify them with functions.

Your code can get super complex, and allows you to code up and customize models that otherwise would be hugely difficult to achieve.

Get OpenSCAD

The default place to get started is at the project homepage: http://openscad.org/

openscad.png

There are free downloads for Windows, Mac and Linux. In Ubuntu, it is as simple as sudo apt-get install openscad

(Unfortunately, Pi users are out of luck currently for app downloads, but see below for cloud options to also keep an eye on as the browser-support grows)

OpenSCAD in your web browser

Using Chrome or Firefox with WebGL, you can also use OpenSCAD right in your web browser.

openjscad2.png

Code

Let's take a look at some simple OpenSCAD code ...

Cubes/Spheres/etc

To add a simple cube to your workspace, you would enter:

cube(size=10, center=true);

and a sphere is similar, with radius as the sizing:

sphere(10);

(Center allows you to, well, center the object)

You can also use variables (it is, after all, parametric modelling to the extreme):

 // variables
    width=10;
    height=20;
    depth=30;
    
 // cube using variables
    cube(size=[width,height,depth], center=true);

Transformation

You can specify a color:

color("black");

and translate, which shifts the position:

translate([5,5,-10])

Rotate obviously rotates, specifying the degrees for x, y and z:

rotate([45,45,45])

There are also boolean operations, such as Union and Difference. These allow you to make larger objects out of smaller ones, and to make holes!

A full example follows:

// join together
union() {
 
    // variables
    width=10;
    height=20;
    depth=30;
    
    // cube using variables
    cube(size=[width,height,depth], center=true);
 
    // translate/transform
    color("blue") translate([-10,-10,-10]) {
        cube(size=10, center=true);
        rotate([45,45,45]) cube(size=10,center=true);
    }
    
    // sphere
    translate([5,5,-10]) color("silver") sphere(20);
}

Brain hurting yet?

I am a programmer but all this feels a lot like math, so I get it if you feel this is a bit complex.

Never fear, in part 2 we will look at an easier option with all the power and none of the brain frying math ;)

We will also put our model up on Thingiverse for others to customize!

Sort:  

3d modeling is a system that is needed especially in the fields of architecture and engineering. I'm looking forward to the second episode. Thank you for sharing @makerhacks

Coin Marketplace

STEEM 0.18
TRX 0.13
JST 0.028
BTC 58080.30
ETH 3102.16
USDT 1.00
SBD 2.40