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

Example: buffer_stand

test

// Copyright © 2025 The µcad authors <info@microcad.xyz>
// SPDX-License-Identifier: AGPL-3.0-or-later

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

part BufferStand() {
    size = 5.25in;
    width = 5.875in;

    base = (Circle(d = width) & Rect(width, height = size / 2))
        .extrude(4.0in);

    side = {
        Line(height = size / 2);
        Circle(d = 1.5in).translate(x = -3.25in);
    }
    .hull()
    .extrude(width)
    .orient(X)
    .translate(x = -width / 2);

    front_cut_off = {
        w = 4.25in;
        d = w * 0.5 - 0.5in;

        Circle(r = 0.5in, c = (x = [d, -d], y = 0in));
        Line(width = w, p = (x = -w * 0.5, y = -4.0in));
    }
    .hull()
    .extrude(width)
    .orient(Y)
    .translate(y = -width / 4, z = 0.75in);

    bearing = (Rect(width = 1.25in, height = width - 1in) | Rect(height = width, width = 0.5in))
        .revolve()
        .orient(X)
        .translate(z = 3.25in);

    mount = Rect(height = 4.25in - 3.5in, width = 1.5in * 50%, x = 0mm, y = 0mm)
        .revolve()
        .orient(X)
        .translate(x = [2.0, -2.0]in, z = 3.25in);

    bottom_bar = {
        Circle(d = 0.15in).translate(x = -1.35in);
        Line(height = 0.5in);
    }
    .hull()
    .extrude(width)
    .orient(X)
    .translate(x = -width / 2);

    base & (side - front_cut_off) | (base & bottom_bar) | mount - bearing;
}

BufferStand();

2D Output : None

3D Output : None