# 3D Printing > General 3D Printing Discussion >  .SCAD format to .STL

## sparkdaddychad

Anybody know of an open source tool to convert a .SCAD file to a .STL file?

----------


## AndrewK

I'm not sure if this helps.  Do you have OpenSCAD?
I got thist at: http://en.wikibooks.org/wiki/OpenSCA...ort_and_Export
*STL Export*

To export your design, select "Export as STL..." from the "Design" menu, then enter a filename in the ensuing dialog box. Don't forget to add the ".stl" extension.*Trouble shooting*:After _compile and render GCAL_ (F6), you may see that your design is _simple: no_. That's bad news.See line 8 in the following output from _OpenSCAD 2010.02_:Parsing design (AST generation)...
Compiling design (CSG Tree generation)...
Compilation finished.
Rendering Polygon Mesh using CGAL...
Number of vertices currently in CGAL cache: 732
Number of objects currently in CGAL cache: 12
   Top level object is a 3D object:
   Simple:         no                <*****************
   Valid:         yes
   Vertices:       22
   Halfedges:      70
   Edges:          35
   Halffacets:     32
   Facets:         16
   Volumes:         2
Total rendering time: 0 hours, 0 minutes, 0 seconds
Rendering finished.


When you try to export this to .STL you will get a message like:Object isn't a valid 2-manifold! Modify your design..


"Manifold" means that it is "water tight" and that there are no holes in the geometry. In a valid 2-manifold each edge must connect exactly two facets. That means that the program must be able to connect a face with an object. E.g. if you use a cube of height 10 to carve out something from a wider cube of height 10, it is not clear to which cube the top or the bottom belongs. So make the small extracting cube a bit "longer" (or "shorter"):difference() {
_// original_
    cube (size = [2,2,2]);
_// object that carves out_
    # translate ([0.5,0.5,-0.5]) {
        cube (size = [1,1,3]); 
}
}


Correct use of difference
Here is a more tricky little example taken from the OpenSCAD Forum (retrieved 15:13, 22 March 2010 (UTC)):module example1() {
        cube([20, 20, 20]);
        translate([-20, -20, 0]) cube([20, 20, 20]);
        cube([50, 50, 5], center = *true*);
}
module example2() {
        cube([20.1, 20.1, 20]);
        translate([-20, -20, 0]) cube([20.1, 20.1, 20]);
        cube([50, 50, 5], center = *true*);
}


Example1 would render like this:A not valid 2-manifold cube (simple = no)
The *example1* module is not a valid 2-manifold because both cubes are sharing one edge. They touch each other but do not intersect.*Example2* is a valid 2-manifold because there is an intersection. Now the construct meets the 2-manifold constraint stipulating that _each edge_ must connect exactly two facets.Pieces you are subtracting must extend past the original part. (OpenSCAD Tip: Manifold Space and Time, retrieved 18:40, 22 March 2010 (UTC)).For reference, another situation that causes the design to be non-exportable is when two faces that are each the result of a subtraction touch. Then the error message comes up.difference () {
   cube ([20,10,10]);
   translate ([10,0,0]) cube (10);
}
difference () {
   cube ([20,10,10]);
   cube (10);
}


simply touching surfaces is correctly handled.translate ([10,0,0]) cube (10);
cube (10);

----------


## sparkdaddychad

Cool, thanks!!  Openscad did the trick for me.  I had to plug in some variables for the .SCAD drawing which then rendered the models that I was after.

----------


## andrew

@sparkdaddychad

http://www.Libre3D.com converts SCAD (Solid CAD) files to STL when uploaded. Then anyone can download the SCAD or STL  :Smile: 

Libre3D.com is for Open Source and Free 3D models

----------

