OpenSCAD: Difference between revisions

From Open Source Ecology
Jump to navigation Jump to search
No edit summary
 
(8 intermediate revisions by 2 users not shown)
Line 3: Line 3:


Files are saved as .scad
Files are saved as .scad
=Collaboration=
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 [http://www.freecadweb.org/wiki/index.php?title=OpenSCAD_Module OpenSCAD module].
==Export==
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 [http://en.wikibooks.org/wiki/OpenSCAD_User_Manual/STL_Import_and_Export#STL_Export OpenSCAD OpenSCAD manual] if you have trouble.
By default, OpenSCAD uses a low resolution for curved primitives. To increase the resolution set the varibles [http://en.wikibooks.org/wiki/OpenSCAD_User_Manual/The_OpenSCAD_Language#.24fa.2C_.24fs_and_.24fn $fa $fs and $fn] before compiling.
Tip: as you progress with your design, attempt to export periodically to test if it is a [http://en.wikibooks.org/wiki/OpenSCAD_User_Manual/STL_Import_and_Export valid 2-Manifold]
==SketchUp==
===Import===
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:
<code>
    scale([25.4, 25.4, 25.4]) {
        // rendering code goes here
    }
</code>
===Cleanup===
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 [http://extensions.sketchup.com/en/content/cleanup%C2%B3 Cleanup<sup>3</sup>].
After installation, open the Plugins > Cleanup<sup>3</sup> > Cleanup... dialog (may need to restart SketchUp) and make sure Coplanar Faces > Merge Coplanar Faces is checked and run CleanUp.
<gallery caption="Cleanup&sup3;" heights="315px" widths="390px">
File:SketchupCleanupBefore.png|Before
File:SketchupCleanupAfter.png|After
</gallery>
=Tips=
*https://en.m.wikipedia.org/wiki/Trigonometric_functions
*https://en.m.wikipedia.org/wiki/Arc_(geometry)


=External Links=
=External Links=

Latest revision as of 23:07, 11 March 2018

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

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

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

Import

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

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.

Tips

External Links