OpenSCAD Workbench: Difference between revisions

From FreeCAD Documentation
m (minor corrections)
Line 5: Line 5:
[[Image:OpenSCADexamaple1.png|An example of imported OpenSCAD geometry]]
[[Image:OpenSCADexamaple1.png|An example of imported OpenSCAD geometry]]


It conatins a [[OpenSCAD_CSG|Importer]] wichs allows to open the [[OpenSCAD_CSG|.csg]] output of OpenSCAD in FreeCAD.
It contains an [[OpenSCAD_CSG|Importer]] which allows you to open the [[OpenSCAD_CSG|.csg]] output of OpenSCAD in FreeCAD.


The [[OpenSCAD_CSG|exporter]] outputs a CSG based (sub-)tree to [[OpenSCAD_CSG|.csg]] Geometry witch is not based on CSG operations will be 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 will be exported as a mesh.
The OpenSCAD Module contians 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 ==
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.
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 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.
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.
However in this step of compilation all the paramtric behavior is lost. All variable names will be discarded, loops expanded and mathematical expressions evaluated.


Line 19: Line 19:


== Limitations ==
== 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.
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 a conversion from BREP to CSG is, in gernal, not possible.
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 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 are encountering such problems.
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 ==
== Hints ==
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.


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
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


{{languages | {{es|OpenSCAD_Module/es}} {{fr|OpenSCAD_Module/fr}} {{it|OpenSCAD_Module/it}} }}
{{languages | {{es|OpenSCAD_Module/es}} {{fr|OpenSCAD_Module/fr}} {{it|OpenSCAD_Module/it}} }}

Revision as of 23:24, 18 September 2012

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: