Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Union operation

We can combine the frame and the struts into a single geometry by using the union operation or the | operator.

The code in the lego_brick.µcad with the whole 2D geometry of the brick's base will look like this:

test

use std::geo2d::*;
use std::ops::*;

thickness = 1.2mm;
width = 31.8mm;
height = 15.8mm;
frame = Frame(width, height, thickness);
struts = Ring(outer_d = 6.51mm, inner_d = 4.8mm)
             .translate(x = [-1..1] * 8mm);

frame | struts; // We could also write `{ frame; struts; }.union()` but the `|` operator is more elegant. 

If you export the file, you will see a frame and the structs combined into a single object.

Picture