[OpenSCAD] Semantics CSG ops with respect to color, materials

bobc bobcousins42 at googlemail.com
Sat May 16 16:34:55 EDT 2015

Hi there,

Spurred by https://github.com/openscad/openscad/issues/1304 I wondered what
the "standard" semantics of CSG are wrt to how surface properties (e.g
color) and interior properties (materials), and also with reference to

It's already been noted on this list that the CSG ops designed for image
generation don't necessarily match the semantics of solid modelling for

For example, difference() paints the cut object with the color of the
cutting object. A reference I've now lost, gave the example "if you cut a
red cube with a blue drill, you don't get a blue hole". Another example,
when taking a section through a model, it would be useful to see the colors
of the cut objects, not the tool that did the cutting.

However, the standard behaviour is also useful in some cases, e.g. to paint
surfaces, or as a diagnostic to see which object did the cutting.
Additionally when you add materials, you could have a cube made of a blue
material but painted red. So then if you take a section, should that expose
a blue surface?

So even a simple op like difference() leads to some complicated
implications. Even more tricky is union or intersection. What properties
should the intersection have? Currently, union create a single meshed
object. If joining two objects with heterogenous materials, then we need to
represent the union with 2 (maybe 3) volumes, in order to preserve the
interior properties.

I am working on some standalone code to explore possible semantics, and
perhaps point the way to an implementation. I would like to collect some use
cases, and get some feedback. Perhaps there are CAD tools that already
implement these type of semantics, but I didn't find any freely available
(not a comprehensive survey). I had a play with FreeCAD, it creates passable
VRML output, but not AMF. I couldn't find any other output formats that are
mesh based and preserve color properties.

Here are some use cases I have identified :

1. create models for 3D printing (output AMF, or multiple STL?)  
2. create models for kicad (VRML output)
3. when taking a section through object, allow difference() to preserve
original colors

Constructive feedback welcome.


View this message in context: http://forum.openscad.org/Semantics-CSG-ops-with-respect-to-color-materials-tp12667.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

More information about the Discuss mailing list