# OpenSCAD User Manual/CSG Modelling

From Wikibooks, open books for an open world

The text in its current form is incomplete. |

## Contents

### union[edit]

Creates a union of all its child nodes. This is the **sum** of all children.

Usage example: union() { cylinder (h = 4, r=1, center = true, $fn=100); rotate ([90,0,0]) cylinder (h = 4, r=0.9, center = true, $fn=100); }

Remark: union is implicit when not used. But it is mandatory, for example, in difference to group first child nodes into one.

### difference[edit]

Subtracts the 2nd (and all further) child nodes from the first one.

Usage example: difference() { cylinder (h = 4, r=1, center = true, $fn=100); rotate ([90,0,0]) cylinder (h = 4, r=0.9, center = true, $fn=100); }

### intersection[edit]

Creates the intersection of all child nodes. This keeps the **overlapping** portion

Usage example: intersection() { cylinder (h = 4, r=1, center = true, $fn=100); rotate ([90,0,0]) cylinder (h = 4, r=0.9, center = true, $fn=100); }

### render[edit]

Always calculate the CSG model for this tree (even in OpenCSG preview mode).

Usage example: render(convexity = 1) { ... }

convexity | Integer. The convexity parameter specifies the maximum number of front sides (back sides) a ray intersecting the object might penetrate. This parameter is only needed for correctly displaying the object in OpenCSG preview mode and has no effect on the polyhedron rendering. |

This image shows a 2D shape with a convexity of 4, as the ray indicated in red crosses the 2D shape a maximum of 4 times. The convexity of a 3D shape would be determined in a similar way. Setting it to 10 should work fine for most cases.