OpenSCAD Workbench

From FreeCAD Documentation
Revision as of 23:24, 18 September 2012 by Nickjob (talk | contribs) (minor corrections)

The OpenSCAD Module is in an early development stage.

The OpenSCAD Module offers interoperability to the open source software OpenSCAD[1].

An example of imported OpenSCAD geometry

It contains an Importer which allows you to open the .csg output of OpenSCAD in FreeCAD.

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

OpenSCAD language and file format

The OpenSCAD language allows the usage of variables and loops. It allows you to specify submodules to reuse geometry and code. This high degree of flexibility makes parsing very complex. Currently the OpenSCAD module in FreeCAD can not handle the OpenSCAD Language by itself. Instead, if OpenSCAD is installed, it can be used to compile the input to an output format named 'CSG'. It is a subset of the OpenSCAD Language and can be used as the input to 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.

GUI Commands

Template:OpenSCAD Tools

Limitations

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

OpenSCAD works internaly 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 encounter 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 recommended to enable 'automatically check model after boolean operation' in Menu -> Edit -> Preferences -> Part Design -> Model setting

Available translations of this page: