OpenSCAD

From Open Source Ecology
Jump to: navigation, search

For 3D modelling you may want to look into openscad (at openscad.org) written by Clifford Wold (you met him @metalab, he fixed your power cord). This uses CSG (constructive solid geometry) internally and can generate STL but also *import* STL (and use CSG on the resulting model). It also can read 2D designs in DXF and extrude parts of it into the 3rd dimension (extrusion can be linear or on different paths, so you can make, e.g., a torus by extruding a circle on a circular path).

Files are saved as .scad

Collaboration[edit]

When collaborating one will often need to export from OpenSCAD and import into other tools like Sketchup and Blender. It is worth noting that FreeCAD includes an OpenSCAD module.

Export[edit]

OpenSCAD exports in several model file formats. The most widely supported is STL. Before each export one needs to compile (F6), which may take a couple of minutes depending on the complexity of the model. Then run Design > Export as STL. See OpenSCAD OpenSCAD manual if you have trouble.

By default, OpenSCAD uses a low resolution for curved primitives. To increase the resolution set the varibles $fa $fs and $fn before compiling.

Tip: as you progress with your design, attempt to export periodically to test if it is a valid 2-Manifold

SketchUp[edit]

Import[edit]

Importing into SketchUp is as simple as File > Import. Note that OpenSCAD's dimensions are unitless. The export/import process will take 1 unit in OpenSCAD to 1mm in SketchUp (regardless of SketchUp unit choice).

For easier collaboration one can scale the OpenSCAD model before exporting. For example, 1 inch = 25.4 mm; so if one is modeling in OpenSCAD with 1 unit as 1 inch the following code will produce models with units that are compatible with SketchUp:

   scale([25.4, 25.4, 25.4]) {
       // rendering code goes here
   }

Cleanup[edit]

SketchUp will process the model in a way that leaves many superfluous edges. These slow down modeling performance in SketchUp. To remove them, install the SketchUp plugin Cleanup3.

After installation, open the Plugins > Cleanup3 > Cleanup... dialog (may need to restart SketchUp) and make sure Coplanar Faces > Merge Coplanar Faces is checked and run CleanUp.

External Links[edit]