OpenSCAD Workbench: Difference between revisions

From FreeCAD Documentation
(<translate>)
(Marked this version for translation)
Line 1: Line 1:
<translate>
<translate>
<!--T:1-->
The OpenSCAD module is in an early stage of development.
The OpenSCAD module is in an early stage of development.


<!--T:2-->
The OpenSCAD module offers interoperability with the open source software [http://www.openscad.org/ OpenSCAD].
The OpenSCAD module offers interoperability with the open source software [http://www.openscad.org/ OpenSCAD].




<!--T:3-->
[[Image:OpenSCADexamaple1.png|An example of imported OpenSCAD geometry]]
[[Image:OpenSCADexamaple1.png|An example of imported OpenSCAD geometry]]


<!--T:4-->
It contains an [[OpenSCAD_CSG|importer]] which allows you to open the [[OpenSCAD_CSG|.csg]] output from OpenSCAD in FreeCAD.
It contains an [[OpenSCAD_CSG|importer]] which allows you to open the [[OpenSCAD_CSG|.csg]] output from OpenSCAD in FreeCAD.


<!--T:5-->
The [[OpenSCAD_CSG|exporter]] outputs a CSG based (sub-)tree to [[OpenSCAD_CSG|.csg]]. Geometry which is not based on CSG operations and is exported as a mesh.
The [[OpenSCAD_CSG|exporter]] outputs a CSG based (sub-)tree to [[OpenSCAD_CSG|.csg]]. Geometry which is not based on CSG operations and is exported as a mesh.
The OpenSCAD module contains a toolbox with functions to modify the feature tree and repair models.
The OpenSCAD module contains a toolbox with functions to modify the feature tree and repair models.


== OpenSCAD language and file format ==
== OpenSCAD language and file format == <!--T:6-->
The OpenSCAD language allows the use 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 natively.
The OpenSCAD language allows the use 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 natively.
Instead, if OpenSCAD is installed, it can be used to convert 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.
Instead, if OpenSCAD is installed, it can be used to convert 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.
During conversion all parametric behavior is lost - all variable names are discarded, loops expanded and mathematical expressions evaluated.
During conversion all parametric behavior is lost - all variable names are discarded, loops expanded and mathematical expressions evaluated.


== GUI Commands ==
== GUI Commands == <!--T:7-->
{{OpenSCAD Tools}}
{{OpenSCAD Tools}}


== Limitations ==
== Limitations == <!--T:8-->
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 using a boundary representation.
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 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.
Therefore conversion from CSG to BREP should, in theory, be possible whereas conversion from BREP to CSG is, in general, not.


<!--T:9-->
OpenSCAD works internaly on meshes. Some operations which are useful on meshes are not meaningful on a BREP model and are currently not available. Among these are convex hull, minkowski sum, glide and subdiv.
OpenSCAD works internaly on meshes. Some operations which are useful on meshes are not meaningful on a BREP model and are 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 less tolerant. An automatic solution is not available at the moment. Please feel free to post to the forum if you encounter such problems.
OpenSCAD is very tolerant when doing booleans on coincident geometry. The FreeCAD geometry kernel is 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 ==
== Hints == <!--T:10-->
When importing DXF set the Draft precision to a sensible amount as this will affect the detection of connected edges.
When importing DXF set the Draft precision to a sensible amount as this will affect the detection of connected edges.


<!--T:11-->
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
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


== Links ==
== Links == <!--T:12-->
* [http://www.thingiverse.com/tag:openscad Things tagged with "Openscad" on Thingiverse]
* [http://www.thingiverse.com/tag:openscad Things tagged with "Openscad" on Thingiverse]



Revision as of 21:44, 20 March 2014

The OpenSCAD module is in an early stage of development.

The OpenSCAD module offers interoperability with the open source software OpenSCAD.


An example of imported OpenSCAD geometry

It contains an importer which allows you to open the .csg output from OpenSCAD in FreeCAD.

The exporter outputs a CSG based (sub-)tree to .csg. Geometry which is not based on CSG operations and is 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 use 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 natively. Instead, if OpenSCAD is installed, it can be used to convert 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. During conversion all parametric behavior is lost - all variable names are 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 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 internaly on meshes. Some operations which are useful on meshes are not meaningful on a BREP model and are 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 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 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

Links