The OpenSCAD Workbench is in an early stage of development. It is intended to offer interoperability with the open source software OpenSCAD.
It contains a CSG importer to open the CSG files from OpenSCAD, and an exporter to output a CSG based tree. Geometry which is not based on CSG operations will be exported as a mesh.
This workbench contains functions to modify the CSG feature tree and repair models.
OpenSCAD language and file format
The OpenSCAD language allows the use of variables and loops. It allows you to specify sub-modules to reuse geometry and code. This high degree of flexibility makes parsing very complex. Currently the OpenSCAD Workbench cannot handle the OpenSCAD language natively. Instead, if OpenSCAD is installed, it can be used to convert the input to the CSG format, which is a subset of the OpenSCAD language, and can be used as the input to OpenSCAD for further processing. During conversion all parametric behavior is lost, meaning that all variable names are discarded, loops expanded, and mathematical expressions evaluated.
- Color Code Shape: Change the color of selected or all shapes based on their validity.
- Replace Object: Replace an object in the feature tree.
- Remove Subtree: Removes the selected objects and all children that are not referenced from other objects.
- Refine Shape Feature: Create Refine Shape Feature.
- Increase Tolerance Feature: Increases tolerance of edges/faces/vertex of selected object(s).
- Convert Edges To Faces: Convert edges to faces. Useful to prepare imported DXF geometry for extrusion.
- Expand Placements: Expand all placements downwards the FeatureTree.
- Explode Group: Explodes fused part primitives.
- Add OpenSCAD Element: Add an OpenSCAD element by entering OpenSCAD code into the task panel.
- Mesh Boolean: Creates new mesh object by boolean operation from shapes.
- Hull: Applies a hull to selected shapes.
- Minkowski: Applies a minkowski sum to selected shapes.
- Preferences: preferences available for the OpenSCAD tools.
OpenSCAD creates constructive solid geometry, as well as imports mesh files and extrudes 2D geometry from DXF files. FreeCAD allows you to create CSG with primitives as well. The FreeCAD geometry kernel (OCCT) works using a boundary representation. Therefore conversion from CSG to BREP should, in theory, be possible whereas conversion from BREP to CSG is, in general, not.
OpenSCAD works internally on meshes. Some operations which are useful on meshes are not meaningful on a BREP model and can not be fully supported. Among these are convex hull, minkowski sum, glide and subdiv. Currently we run the OpenSCAD binary in order to perform hull and minkwoski operations and import the result. This means that the involved geometry will be triangulated. In OpenSCAD non-uniform scaling is often used, which does not impose any problems when using meshes. In our geometry kernel geometric primitives (lines, circular sections, etc) are converted to BSpline prior to performing such deformations. Those BSplines are known to cause trouble in later boolean operations. An automatic solution is not available at the moment. Please feel free to post to the forum if you encounter such problems. Often such problems can be solved be remodeling small parts. A deformation of a cylinder can substituted by an extrusion of an ellipses.
When importing DXF set the Draft precision to a sensible amount as this will affect the detection of connected edges.
If FreeCAD crashes when importing CSG, it is strongly recommended that you enable "automatically check model after boolean operation" in Menu → Edit → Preferences → Part Design → Model setting.