[OpenSCAD] Specification of CSG file format?
doug at moens.org
Sun May 17 18:50:30 EDT 2015
A group is a list of shapes and groups. 'group' is an undocumented,
built-in OpenSCAD module that returns a group.
A module is a function with two argument lists. The inner argument list is
a list of values, while the outer argument list is either a primitive
shape, or a group of shapes. In the case of a user-defined module, the
outer argument list is always converted to a group, this group is what
The result returned by a module is either a shape or a group. Currently,
only built-in modules like 'cube' and 'scale' return shapes; user defined
modules return a group.
The behaviour of user-defined modules may change in the future, especially
if some of the ideas in OpenSCAD2 are implemented. It will be possible for
a user-defined module to return a single shape, instead of a group. Also,
the current behaviour of the builtin module 'for()' is to always return a
group, but Marius and I would like to change that. So the CSG tree might be
flatter in the future, due to fewer intermediate groups being generated.
On 17 May 2015 at 18:11, Carsten Arnholm <arnholm at arnholm.org> wrote:
> The following is an attempt to understand exactly the nature and formal
> definition of *.csg files, formulated through a few questions.
> Background: In OpenSCAD we have a capability to export a design to a *.csg
> file. OpenSCAD can also open such files via File -> Open ... or via a
> command line parameter.
> My first question is whether *.csg files are specific to OpenSCAD or
> whether they represent some kind of universal standardised CSG tree
> representation. I have not found a clear answer, but when I inspect the
> OpenSCAD-generated *.csg files, it seems to me they are is OpenSCAD
> specific. Is this a correct understanding? I know other programs have made
> import filters for such files, but then the only "contract" is OpenSCAD
> documentation, right?
> Second, is it correct to say that the contents of a *.csg file generated
> or read by OpenSCAD is a subset of the *.scad language, where only literal
> values exist and transformations are expressed as 4x4 homogeneous
> transformation matrices *only* ("multmatrix")? If this is correct, is the
> subset language used in *.csg files documented anywhere?
> Third, there also seems to be an extension "group()" to the *.scad
> language. Is it correct to say that "group()" in *.csg is a direct 1:1
> unnamed equivalent to a "module" in *.scad? And, is there any difference at
> all between "group()" and "union()" in *.csg files? It seems to me the
> answer is no, apart from "group()" indicating what used to be a module?
> Carsten Arnholm
> OpenSCAD mailing list
> Discuss at lists.openscad.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Discuss