OpenSCAD Module

The OpenSCAD Module is not yet included into FreeCAD and in an early development stage.

The OpenSCAD Module offers interoperability to the open source software OpenSCAD. It conatins a Importer wichs allows to open the .csg output of OpenSCAD in FreeCAD.

The exporter outputs a CSG based (sub-)tree to .csg file. Geometry witch is not based on CSG operations will be exported as a mesh. The OpenSCAD Module contians a toolbox with functions to modify the feature tree and repair models.

OpenSCAD Language and file format
The OpenSCAD Langauge allows the usage of variables and loops. It allows to specify submodules to reuse geometry and code. This high flexibility makes parsing very complex. Currently the OpenSCAD module in FreeCAD can not handle the OpenSCAD Language by itsself. Instead if the OpenSCAD is installed, it is used to compile the input to a output format named 'CSG'. It is a subset of the OpenSCAD Language and can be used as input of OpenSCAD for further processing. However in this step of compilation all the paramtric behavior is lost. All variable names will be discarded, loops expanded and mathematical expressions evaluated.

Limitations
OpenSCAD allows constructive solid geometry as well as importing mesh files and extruding 2d geometry (from dxf files). FreeCAD allows to do CSG with primitives as well. The FreeCAD geomtry kernel (OCCT) works on a boundary representation. Therefore conversion from CSG to BREP should be possible in theory. Whereas a conversion from BREP to CSG is, in gernal, not possible.

OpenSCAD works interanly on Meshes. Some operations which are useful on meshes are not meaningful on a BREP model and currently not available. Among these are convex hull, minkowski sum, glide and subdiv. OpenSCAD is very tolerant when doing booleans on coincident geometry. The FreeCAD geometry kernel is currently less tolerant. An automatic solution is not available at the moment. Please feel free to post to the forum if you are encountering such problems.

Hints
When importing DXF set the Draft precision to a sensible amount as this will affect the detection of connected edges.

If FreeCAD crashed when importing CSG, it is strongly recommened to enable 'automatically check model after boolean operation' in Menu -> Edit -> Preferences -> Part Design -> Model setting