Beispiel #1
0
def _lego_logo_text_function(lclass):
    """@Todo: ApiDoc."""
    if LG_QUALITY > 2:
        return lclass(_letter_l(lclass), _letter_e(lclass), _letter_g(lclass),
                      _letter_o(lclass),
                      Scale(Vector(4.5 / 128, 4.5 / 128, 4.5 / 128)),
                      Rotate(y * 90), Rotate(x * -90), Scale(Vector(-1, 1, 1)),
                      Scale(Vector(1, 1, 1) * .08 * LG_KNOB_RADIUS * 2))
    else:
        return Object()
Beispiel #2
0
def solid(length=4, width=1):
    """@Todo: DocString."""
    return Union(
        Sphere(Vector(LGCS, LGCS, LGCS), LGCS),
        Cylinder(Vector(LGCS, LGCS, LGCS),
                 Vector(length * LGBW - LGCS, LGCS, LGCS), LGCS),
        Sphere(Vector(length * LGBW - LGCS, LGCS, LGCS), LGCS),
        Cylinder(Vector(length * LGBW - LGCS, LGCS, LGCS),
                 Vector(length * LGBW - LGCS, LGCS, LGBH - LGCS), LGCS),
        Sphere(Vector(length * LGBW - LGCS, LGCS, LGBH - LGCS), LGCS),
        Cylinder(Vector(length * LGBW - LGCS, LGCS, LGBH - LGCS),
                 Vector(LGCS, LGCS, LGBH - LGCS), LGCS),
        Sphere(Vector(LGCS, LGCS, LGBH - LGCS), LGCS),
        Cylinder(Vector(LGCS, LGCS, LGCS), Vector(LGCS, LGCS, LGBH - LGCS),
                 LGCS),
        Cylinder(Vector(LGCS, LGCS, LGCS),
                 Vector(LGCS, width * LGBW - LGCS, LGCS), LGCS),
        Sphere(Vector(LGCS, width * LGBW - LGCS, LGCS), LGCS),
        Cylinder(Vector(LGCS, width * LGBW - LGCS, LGCS),
                 Vector(LGCS, width * LGBW - LGCS, LGBH - LGCS), LGCS),
        Sphere(Vector(LGCS, width * LGBW - LGCS, LGBH - LGCS), LGCS),
        Cylinder(Vector(LGCS, LGCS, LGBH - LGCS),
                 Vector(LGCS, width * LGBW - LGCS, LGBH - LGCS), LGCS),
        Cylinder(Vector(length * LGBW - LGCS, LGCS, LGCS),
                 Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGCS),
                 LGCS),
        Sphere(Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGCS), LGCS),
        Cylinder(Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGCS),
                 Vector(LGCS, width * LGBW - LGCS, LGCS), LGCS),
        Cylinder(
            Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGCS),
            Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGBH - LGCS),
            LGCS),
        Sphere(Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGBH - LGCS),
               LGCS),
        Cylinder(
            Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGBH - LGCS),
            Vector(LGCS, width * LGBW - LGCS, LGBH - LGCS), LGCS),
        Cylinder(
            Vector(length * LGBW - LGCS, LGCS, LGBH - LGCS),
            Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGBH - LGCS),
            LGCS),
        Difference(
            Union(
                Box(
                    Vector(LGCS, LGCS, 0),
                    Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGBH),
                ),
                Box(
                    Vector(0, LGCS, LGCS),
                    Vector(length * LGBW, width * LGBW - LGCS, LGBH - LGCS),
                ),
                Box(
                    Vector(LGCS, 0, LGCS),
                    Vector(length * LGBW - LGCS, width * LGBW, LGBH - LGCS),
                ),
            ), get_knob_inner_space(length, width)), get_brick_coloumn(length),
        get_knob_objects(length, width),
        Translate(Vector(-length / 2 * LGBW, -LGBW / 2, -LGBH)),
        Rotate(Vector(0, 0, 90)))
Beispiel #3
0
def get_lg_cylinder(cylinderclass, height):
    """@Todo:ApiDoc."""
    return cylinderclass(
        Difference(
            Cylinder(Vector(0, 0, height + LG_E),
                     Vector(0, 0, (LG_CYLINDER_WALL_WIDTH / 2)),
                     LG_CYLINDER_RADIUS),
            Cylinder(Vector(0, 0, height + LG_CORNER_SPACE), Vector(0, 0, 0),
                     LG_KNOB_RADIUS)),
        Torus(LG_CYLINDER_RADIUS - LG_CYLINDER_WALL_WIDTH / 2,
              LG_CYLINDER_WALL_WIDTH / 2, Rotate(Vector(90, 0, 0)),
              Translate(Vector(0, 0, (LG_CYLINDER_WALL_WIDTH / 2)))))
Beispiel #4
0
def _lg_tech_knob_function(knobclass):
    """@Todo: ApiDoc."""
    return knobclass(
        Difference(
            knobclass(
                Cylinder(Vector(0, 0, LG_KNOB_HEIGHT - LG_CORNER_SPACE),
                         Vector(0, 0, -LG_E), LG_KNOB_RADIUS),
                Difference(
                    Cylinder(Vector(0, 0, LG_KNOB_HEIGHT), Vector(0, 0, -LG_E),
                             LG_KNOB_RADIUS - LG_CORNER_SPACE),
                    Cylinder(Vector(0, 0, LG_KNOB_HEIGHT + LG_E),
                             Vector(0, 0, -2 * LG_E),
                             LG_KNOB_INNER_RADIUS + LG_CORNER_SPACE))),
            Cylinder(Vector(0, 0, (LG_KNOB_HEIGHT + 2 * LG_E)),
                     Vector(0, 0, -3 * LG_E), LG_KNOB_INNER_RADIUS)),
        Torus(LG_KNOB_INNER_RADIUS + LG_CORNER_SPACE, LG_CORNER_SPACE,
              Rotate(Vector(90, 0, 0)),
              Translate(Vector(0, 0, (LG_KNOB_HEIGHT - LG_CORNER_SPACE)))),
        Torus(LG_KNOB_RADIUS - LG_CORNER_SPACE, LG_CORNER_SPACE,
              Rotate(Vector(90, 0, 0)),
              Translate(Vector(0, 0, (LG_KNOB_HEIGHT - LG_CORNER_SPACE)))))
Beispiel #5
0
def lg_knob_function(knobclass, textfunction):
    """@Todo: ApiDoc."""
    result = knobclass(
        knobclass(
            Cylinder(Vector(0, 0, LG_KNOB_HEIGHT - LG_KNOB_CORNER_SPACE),
                     Vector(0, 0, -LG_E), LG_KNOB_RADIUS),
            Cylinder(Vector(0, 0, LG_KNOB_HEIGHT), Vector(0, 0, -LG_E),
                     LG_KNOB_RADIUS - LG_KNOB_CORNER_SPACE),
        ),
        Torus(LG_KNOB_RADIUS - LG_KNOB_CORNER_SPACE, LG_KNOB_CORNER_SPACE,
              Rotate(Vector(90, 0, 0)),
              Translate(Vector(0, 0,
                               (LG_KNOB_HEIGHT - LG_KNOB_CORNER_SPACE)))))

    if LG_QUALITY > 2:
        result.append(
            Object(textfunction, Translate(Vector(0, 0, LG_KNOB_HEIGHT))))

    return result
Beispiel #6
0
def get_knob_objects(length=1, width=1, height=LGBH):
    """@Todo: DocString."""
    result = Union()

    for knob_x in range(0, length):
        for knob_y in range(0, width):
            result.append(
                Object(
                    lg_knob(),
                    Rotate(Vector(0, 0, -90)),
                    Translate(
                        Vector(
                            (0.5 + knob_x) * LGBW,
                            (0.5 + knob_y) * LGBW,
                            height
                        )
                    ),
                )
            )

    return result
Beispiel #7
0
def solid(length=2, width=1):
    """@Todo: Docstring."""
    return Union(
        Sphere(
            Vector(LGCS, LGCS, LGCS + 0.04),
            LGCS
        ),
        Cylinder(
            Vector(LGCS, LGCS, LGCS + 0.04),
            Vector(length * LGBW - LGCS, LGCS, LGCS + 0.04),
            LGCS
        ),
        Sphere(
            Vector(length * LGBW - LGCS, LGCS, LGCS + 0.04),
            LGCS
        ),
        Cylinder(
            Vector(length * LGBW - LGCS, LGCS, LGCS + 0.04),
            Vector(length * LGBW - LGCS, LGCS, LGPH - LGCS),
            LGCS
        ),
        Sphere(
            Vector(length * LGBW - LGCS, LGCS, LGPH - LGCS),
            LGCS
        ),
        Cylinder(
            Vector(length * LGBW - LGCS, LGCS, LGPH - LGCS),
            Vector(LGCS, LGCS, LGPH - LGCS),
            LGCS
        ),
        Sphere(
            Vector(LGCS, LGCS, LGPH - LGCS),
            LGCS
        ),
        Cylinder(
            Vector(LGCS, LGCS, LGCS + 0.04),
            Vector(LGCS, LGCS, LGPH - LGCS),
            LGCS
        ),
        Cylinder(
            Vector(LGCS, LGCS, LGCS + 0.04),
            Vector(LGCS, width * LGBW - LGCS, LGCS + 0.04),
            LGCS
        ),
        Sphere(
            Vector(LGCS, width * LGBW - LGCS, LGCS + 0.04),
            LGCS
        ),
        Cylinder(
            Vector(LGCS, width * LGBW - LGCS, LGCS + 0.04),
            Vector(LGCS, width * LGBW - LGCS, LGPH - LGCS),
            LGCS
        ),
        Sphere(
            Vector(LGCS, width * LGBW - LGCS, LGPH - LGCS),
            LGCS
        ),
        Cylinder(
            Vector(length * LGBW - LGCS, LGCS, LGCS + 0.04),
            Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGCS + 0.04),
            LGCS
        ),
        Sphere(
            Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGCS + 0.04),
            LGCS
        ),
        Cylinder(
            Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGCS + 0.04),
            Vector(LGCS, width * LGBW - LGCS, LGCS + 0.04),
            LGCS
        ),
        Cylinder(
            Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGCS + 0.04),
            Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGPH - LGCS),
            LGCS
        ),
        Sphere(
            Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGPH - LGCS),
            LGCS
        ),
        Cylinder(
            Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGPH - LGCS),
            Vector(LGCS, width * LGBW - LGCS, LGPH - LGCS),
            LGCS
        ),
        Cylinder(
            Vector(length * LGBW - LGCS, LGWW - LGCS, LGPH - LGCS),
            Vector(LGCS, LGWW - LGCS, LGPH - LGCS),
            LGCS
        ),
        Cylinder(
            Vector(length * LGBW - LGCS, 2 * LGWW + LGCS, LGPH - LGCS),
            Vector(LGCS, 2 * LGWW + LGCS, LGPH - LGCS),
            LGCS
        ),
        Cylinder(
            Vector(length * LGBW - LGCS, 3 * LGWW - LGCS, LGPH - LGCS),
            Vector(LGCS, 3 * LGWW - LGCS, LGPH - LGCS),
            LGCS
        ),
        Cylinder(
            Vector(length * LGBW - LGCS, 4 * LGWW + LGCS, LGPH - LGCS),
            Vector(LGCS, 4 * LGWW + LGCS, LGPH - LGCS),
            LGCS
        ),
        Cylinder(
            Vector(LGCS, LGCS, LGPH - LGCS),
            Vector(LGCS, LGWW - LGCS, LGPH - LGCS),
            LGCS
        ),
        Cylinder(
            Vector(LGCS, 2 * LGWW + LGCS, LGPH - LGCS),
            Vector(LGCS, 3 * LGWW - LGCS, LGPH - LGCS),
            LGCS
        ),
        Cylinder(
            Vector(LGCS, 4 * LGWW + LGCS, LGPH - LGCS),
            Vector(LGCS, 5 * LGWW - LGCS, LGPH - LGCS),
            LGCS
        ),
        Cylinder(
            Vector(length * LGBW - LGCS, LGCS, LGPH - LGCS),
            Vector(length * LGBW - LGCS, LGWW - LGCS, LGPH - LGCS),
            LGCS
        ),
        Cylinder(
            Vector(length * LGBW - LGCS, 2 * LGWW + LGCS, LGPH - LGCS),
            Vector(length * LGBW - LGCS, 3 * LGWW - LGCS, LGPH - LGCS),
            LGCS
        ),
        Cylinder(
            Vector(length * LGBW - LGCS, 4 * LGWW + LGCS, LGPH - LGCS),
            Vector(length * LGBW - LGCS, 5 * LGWW - LGCS, LGPH - LGCS),
            LGCS
        ),
        Cylinder(
            Vector(LGCS, LGWW - LGCS, LG_PLATE_INNER_HEIGHT - LGCS),
            Vector(LGCS, LGWW - LGCS, LGPH - LGCS),
            LGCS
        ),
        Cylinder(
            Vector(length * LGBW - LGCS, LGWW - LGCS, LG_PLATE_INNER_HEIGHT - LGCS),
            Vector(length * LGBW - LGCS, LGWW - LGCS, LGPH - LGCS),
            LGCS
        ),
        Cylinder(
            Vector(LGCS, 2 * LGWW + LGCS, LG_PLATE_INNER_HEIGHT - LGCS),
            Vector(LGCS, 2 * LGWW + LGCS, LGPH - LGCS),
            LGCS
        ),
        Cylinder(
            Vector(length * LGBW - LGCS, 2 * LGWW + LGCS, LG_PLATE_INNER_HEIGHT - LGCS),
            Vector(length * LGBW - LGCS, 2 * LGWW + LGCS, LGPH - LGCS),
            LGCS
        ),
        Cylinder(
            Vector(LGCS, 3 * LGWW - LGCS, LG_PLATE_INNER_HEIGHT - LGCS),
            Vector(LGCS, 3 * LGWW - LGCS, LGPH - LGCS),
            LGCS
        ),
        Cylinder(
            Vector(length * LGBW - LGCS, 3 * LGWW - LGCS, LG_PLATE_INNER_HEIGHT - LGCS),
            Vector(length * LGBW - LGCS, 3 * LGWW - LGCS, LGPH - LGCS),
            LGCS
        ),
        Cylinder(
            Vector(LGCS, 4 * LGWW + LGCS, LG_PLATE_INNER_HEIGHT - LGCS),
            Vector(LGCS, 4 * LGWW + LGCS, LGPH - LGCS),
            LGCS
        ),
        Cylinder(
            Vector(length * LGBW - LGCS, 4 * LGWW + LGCS, LG_PLATE_INNER_HEIGHT - LGCS),
            Vector(length * LGBW - LGCS, 4 * LGWW + LGCS, LGPH - LGCS),
            LGCS
        ),
        Sphere(
            Vector(LGCS, LGWW - LGCS, LGPH - LGCS),
            LGCS
        ),
        Sphere(
            Vector(length * LGBW - LGCS, LGWW - LGCS, LGPH - LGCS),
            LGCS
        ),
        Sphere(
            Vector(LGCS, 2 * LGWW + LGCS, LGPH - LGCS),
            LGCS
        ),
        Sphere(
            Vector(length * LGBW - LGCS, 2 * LGWW + LGCS, LGPH - LGCS),
            LGCS
        ),
        Sphere(
            Vector(LGCS, 3 * LGWW - LGCS, LGPH - LGCS),
            LGCS
        ),
        Sphere(
            Vector(length * LGBW - LGCS, 3 * LGWW - LGCS, LGPH - LGCS),
            LGCS
        ),
        Sphere(
            Vector(LGCS, 4 * LGWW + LGCS, LGPH - LGCS),
            LGCS
        ),
        Sphere(
            Vector(length * LGBW - LGCS, 4 * LGWW + LGCS, LGPH - LGCS),
            LGCS
        ),
        Cylinder(
            Vector(length * LGBW - LGCS, LGWW - LGCS, LG_PLATE_INNER_HEIGHT - LGCS),
            Vector(length * LGBW - LGCS, 2 * LGWW + LGCS, LG_PLATE_INNER_HEIGHT - LGCS),
            LGCS
        ),
        Cylinder(
            Vector(LGCS, LGWW - LGCS, LG_PLATE_INNER_HEIGHT - LGCS),
            Vector(LGCS, 2 * LGWW + LGCS, LG_PLATE_INNER_HEIGHT - LGCS),
            LGCS
        ),
        Cylinder(
            Vector(length * LGBW - LGCS, 3 * LGWW - LGCS, LG_PLATE_INNER_HEIGHT - LGCS),
            Vector(length * LGBW - LGCS, 4 * LGWW + LGCS, LG_PLATE_INNER_HEIGHT - LGCS),
            LGCS
        ),
        Cylinder(
            Vector(LGCS, 3 * LGWW - LGCS, LG_PLATE_INNER_HEIGHT - LGCS),
            Vector(LGCS, 4 * LGWW + LGCS, LG_PLATE_INNER_HEIGHT - LGCS),
            LGCS
        ),
        Difference(
            Union(
                Box(
                    Vector(LGCS, LGCS, 0.04),
                    Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGPH)
                ),
                Box(
                    Vector(0, LGCS, LGCS + 0.04),
                    Vector(length * LGBW, width * LGBW - LGCS, LGPH - LGCS)
                ),
                Box(
                    Vector(LGCS, 0, LGCS + 0.04),
                    Vector(length * LGBW - LGCS, width * LGBW, LGPH - LGCS)
                ),
                Box(
                    Vector(0.04, 0.04, 0),
                    Vector(length * LGBW - 0.04, width * LGBW - 0.04, 0.04 + LG_E)
                )
            ),
            Union(
                Box(
                    Vector(LGWW, LGWW, -LGCS),
                    Vector(length * LGBW - LGWW, width * LGBW - LGWW, LG_PLATE_INNER_HEIGHT + LG_E)
                ),
                Box(
                    Vector(-LG_E, LGWW - LGCS, LGPH + LG_E),
                    Vector(LGCS, 2 * LGWW + LGCS, LG_PLATE_INNER_HEIGHT - LGCS)
                ),
                Box(
                    Vector(length * LGBW + LG_E, LGWW - LGCS, LGPH + LG_E),
                    Vector(length * LGBW - LGCS, 2 * LGWW + LGCS, LG_PLATE_INNER_HEIGHT - LGCS)
                ),
                Box(
                    Vector(0, LGWW - LGCS, LGPH + LG_E),
                    Vector(length * LGBW, 2 * LGWW + LGCS, LGPH - LGCS)
                ),
                Box(
                    Vector(0, LGWW, LGPH),
                    Vector(length * LGBW, 2 * LGWW, LG_PLATE_INNER_HEIGHT)
                ),
                Box(
                    Vector(-LG_E, 3 * LGWW - LGCS, LGPH + LG_E),
                    Vector(LGCS, 4 * LGWW + LGCS, LG_PLATE_INNER_HEIGHT - LGCS)
                ),
                Box(
                    Vector(length * LGBW + LG_E, 3 * LGWW - LGCS, LGPH + LG_E),
                    Vector(length * LGBW - LGCS, 4 * LGWW + LGCS, LG_PLATE_INNER_HEIGHT - LGCS)
                ),
                Box(
                    Vector(0, 3 * LGWW - LGCS, LGPH + LG_E),
                    Vector(length * LGBW, 4 * LGWW + LGCS, LGPH - LGCS)
                ),
                Box(
                    Vector(0, 3 * LGWW, LGPH),
                    Vector(length * LGBW, 4 * LGWW, LG_PLATE_INNER_HEIGHT)
                )
            )
        ),
        Difference(
            Cylinder(
                Vector(LGBW, LGBW / 2, LG_PLATE_INNER_HEIGHT + LG_E),
                Vector(LGBW, LGBW / 2, 0),
                LG_KNOB_INNER_RADIUS
            ),
            Union(
                Box(
                    Vector(LGWW, LGWW, -LG_E),
                    Vector(length * LGBW - LGWW, 2 * LGWW, LGPH)
                ),
                Box(
                    Vector(LGWW, 3 * LGWW, -LG_E),
                    Vector(length * LGBW - LGWW, 4 * LGWW, LGPH)
                ),
            ),
        ),
        Translate(Vector(-LGBW, -0.5 * LGBW, -LGPH)),
        Rotate(Vector(0, 0, 90))
    )
Beispiel #8
0
def solid(length=1, width=2, height=1):
    """return lg_4865: Panel 1 x 2 x 1."""
    result = Union(
    )

    for rot in range(0, 2):
        rotation = Rotate(Vector(0, 0, 0))
        translation = Translate(Vector(0, 0, 0))
        if rot == 1:
            rotation = Rotate(Vector(0, 0, 180))
            translation = Translate(Vector(-LGBW, 0, 0))

        result.append(
            Union(
                Sphere(
                    Vector(length / 2 * LGBW - LGCS, width / 2 * LGBW - LGCS, -height * LGBH + LGCS),
                    LGCS
                ),
                Sphere(
                    Vector(-length / 2 * LGBW + LGCS, width / 2 * LGBW - LGCS, -height * LGBH + LGCS),
                    LGCS
                ),
                Cylinder(
                    Vector(length / 2 * LGBW - LGCS, width / 2 * LGBW - LGCS, -height * LGBH + LGCS),
                    Vector(-length / 2 * LGBW + LGCS, width / 2 * LGBW - LGCS, -height * LGBH + LGCS),
                    LGCS
                ),
                Cylinder(
                    Vector(length / 2 * LGBW - LGCS, width / 2 * LGBW - LGCS, -height * LGBH + LGCS),
                    Vector(length / 2 * LGBW - LGCS, -width / 2 * LGBW + LGCS, -height * LGBH + LGCS),
                    LGCS
                ),
                rotation,
                translation
            ),
        )

    result.append(
        Union(
            Cylinder(
                Vector(-length / 2 * LGBW + LGWW - LGCS, width / 2 * LGBW - LGCS, -LGCS),
                Vector(-length / 2 * LGBW + LGCS, width / 2 * LGBW - LGCS, -LGCS),
                LGCS
            ),
            Cylinder(
                Vector(-length / 2 * LGBW + LGWW - LGCS, -width / 2 * LGBW + LGCS, -LGCS),
                Vector(-length / 2 * LGBW + LGCS, -width / 2 * LGBW + LGCS, -LGCS),
                LGCS
            ),
            Cylinder(
                Vector(-length / 2 * LGBW + LGCS, width / 2 * LGBW - LGCS, -LGCS),
                Vector(-length / 2 * LGBW + LGCS, -width / 2 * LGBW + LGCS, -LGCS),
                LGCS
            ),
            Cylinder(
                Vector(-length / 2 * LGBW + LGWW - LGCS, width / 2 * LGBW - LGCS, -LGCS),
                Vector(-length / 2 * LGBW + LGWW - LGCS, -width / 2 * LGBW + LGCS, -LGCS),
                LGCS
            ),
            Sphere(
                Vector(-length / 2 * LGBW + LGWW - LGCS, width / 2 * LGBW - LGCS, -LGCS),
                LGCS
            ),
            Sphere(
                Vector(-length / 2 * LGBW + LGWW - LGCS, -width / 2 * LGBW + LGCS, -LGCS),
                LGCS
            ),
            Sphere(
                Vector(-length / 2 * LGBW + LGCS, width / 2 * LGBW - LGCS, -LGCS),
                LGCS
            ),
            Sphere(
                Vector(-length / 2 * LGBW + LGCS, -width / 2 * LGBW + LGCS, -LGCS),
                LGCS
            ),
            Cylinder(
                Vector(-length / 2 * LGBW + LGCS, width / 2 * LGBW - LGCS, -LGCS),
                Vector(-length / 2 * LGBW + LGCS, width / 2 * LGBW - LGCS, -height * LGBH + LGCS),
                LGCS
            ),
            Cylinder(
                Vector(-length / 2 * LGBW + LGCS, -width / 2 * LGBW + LGCS, -LGCS),
                Vector(-length / 2 * LGBW + LGCS, -width / 2 * LGBW + LGCS, -height * LGBH + LGCS),
                LGCS
            ),
            Cylinder(
                Vector(-length / 2 * LGBW + LGWW - LGCS, -width / 2 * LGBW + LGCS, -LGCS),
                Vector(-length / 2 * LGBW + LGWW - LGCS, width / 2 * LGBW - LGCS, -LGCS),
                LGCS
            ),
            Cylinder(
                Vector(-length / 2 * LGBW - LGCS + LGWW, width / 2 * LGBW - LGCS, -(height * 3 - 1) * LGPH - LGCS),
                Vector(length / 2 * LGBW - LGCS, width / 2 * LGBW - LGCS, -(height * 3 - 1) * LGPH - LGCS),
                LGCS
            ),
            Cylinder(
                Vector(-length / 2 * LGBW - LGCS + LGWW, -width / 2 * LGBW + LGCS, -(height * 3 - 1) * LGPH - LGCS),
                Vector(length / 2 * LGBW - LGCS, -width / 2 * LGBW + LGCS, -(height * 3 - 1) * LGPH - LGCS),
                LGCS
            ),
            Cylinder(
                Vector(length / 2 * LGBW - LGCS, width / 2 * LGBW - LGCS, -(height * 3 - 1) * LGPH - LGCS),
                Vector(length / 2 * LGBW - LGCS, width / 2 * LGBW - LGCS, -height * LGBH + LGCS),
                LGCS
            ),
            Cylinder(
                Vector(length / 2 * LGBW - LGCS, -width / 2 * LGBW + LGCS, -(height * 3 - 1) * LGPH - LGCS),
                Vector(length / 2 * LGBW - LGCS, -width / 2 * LGBW + LGCS, -height * LGBH + LGCS),
                LGCS
            ),
            Cylinder(
                Vector(length / 2 * LGBW - LGCS, -width / 2 * LGBW + LGCS, -(height * 3 - 1) * LGPH - LGCS),
                Vector(length / 2 * LGBW - LGCS, width / 2 * LGBW - LGCS, -(height * 3 - 1) * LGPH - LGCS),
                LGCS
            ),
            Cylinder(
                Vector(-length / 2 * LGBW - LGCS + LGWW, width / 2 * LGBW - LGCS, -LGCS),
                Vector(-length / 2 * LGBW - LGCS + LGWW, width / 2 * LGBW - LGCS, -(height * 3 - 1) * LGPH - LGCS),
                LGCS
            ),
            Cylinder(
                Vector(-length / 2 * LGBW - LGCS + LGWW, -width / 2 * LGBW + LGCS, -LGCS),
                Vector(-length / 2 * LGBW - LGCS + LGWW, -width / 2 * LGBW + LGCS, -(height * 3 - 1) * LGPH - LGCS),
                LGCS
            ),
            Sphere(
                Vector(length / 2 * LGBW - LGCS, -width / 2 * LGBW + LGCS, -(height * 3 - 1) * LGPH - LGCS),
                LGCS
            ),
            Sphere(
                Vector(length / 2 * LGBW - LGCS, width / 2 * LGBW - LGCS, -(height * 3 - 1) * LGPH - LGCS),
                LGCS
            ),
            Difference(
                Union(
                    Box(
                        Vector(length / 2 * LGBW - LGCS, width / 2 * LGBW - LGCS, -height * LGBH + LGPH),
                        Vector(-length / 2 * LGBW + LGCS, -width / 2 * LGBW + LGCS, -height * LGBH),
                    ),
                    Box(
                        Vector(length / 2 * LGBW, width / 2 * LGBW - LGCS, -height * LGBH + LGPH - LGCS),
                        Vector(-length / 2 * LGBW, -width / 2 * LGBW + LGCS, -height * LGBH + LGCS),
                    ),
                    Box(
                        Vector(length / 2 * LGBW - LGCS, width / 2 * LGBW, -height * LGBH + LGPH - LGCS),
                        Vector(-length / 2 * LGBW + LGCS, -width / 2 * LGBW, -height * LGBH + LGCS)
                    ),
                ),
                Box(
                    Vector(length / 2 * LGBW - LGWW, width / 2 * LGBW - LGWW, -height * LGBH + LGPH - LG_TOP_HEIGHT),
                    Vector(-length / 2 * LGBW + LGWW, -width / 2 * LGBW + LGWW, -height * LGBH - LG_E)
                ),
            ),
            Box(
                Vector(-length / 2 * LGBW, width / 2 * LGBW - LGCS, -LGCS),
                Vector(-length / 2 * LGBW + LGWW, -width / 2 * LGBW + LGCS, -height * LGBH + LGCS)
            ),
            Box(
                Vector(-length / 2 * LGBW + LGCS, width / 2 * LGBW, -LGCS),
                Vector(-length / 2 * LGBW + LGWW - LGCS, -width / 2 * LGBW, -height * LGBH + LGCS)
            ),
            Box(
                Vector(-length / 2 * LGBW + LGCS, width / 2 * LGBW - LGCS, -2 * LGCS),
                Vector(-length / 2 * LGBW + LGWW - LGCS, -width / 2 * LGBW + LGCS, 0)
            ),
            Object(
                LG_PLATE_COLUMN,
                Translate(Vector(-LGBW / 2, 0, -height * LGBH))
            ),
        )
    )

    return result
Beispiel #9
0
def solid():
    """LG 3788 Solid brick."""
    mainpart = Union()

    for rot in (0, 1):
        rotpart = Union(
            Sphere(
                Vector(LGBW - LGCS, 2 * LGBW - LGCS, -LGCS),
                LGCS
            ),
            Sphere(
                Vector(LGBW - LGCS, 2 * LGBW - LGCS, -2 * LGPH + LGCS),
                LGCS
            ),
            Sphere(
                Vector(-LGBW + LGCS, 2 * LGBW - LGCS, -LGCS),
                LGCS
            ),
            Sphere(
                Vector(-LGBW + LGCS, 2 * LGBW - LGCS, -2 * LGPH + LGCS),
                LGCS
            ),
            Sphere(
                Vector(-LGBW + LGCS, LGBW + LGCS, -LGCS),
                LGCS
            ),
            Sphere(
                Vector(LGBW - LGCS, LGBW + LGCS, -LGCS),
                LGCS
            ),
            Sphere(
                Vector(-LGBW + 0.12 - LGCS, 2 * LGBW - LGCS, -2 * LGPH + LGCS),
                LGCS
            ),
            Sphere(
                Vector(LGBW - 0.12 + LGCS, 2 * LGBW - LGCS, -2 * LGPH + LGCS), LGCS
            ),
            Cylinder(
                Vector(LGBW - LGCS, 2 * LGBW - LGCS, -LGCS),
                Vector(LGBW - LGCS, 2 * LGBW - LGCS, -2 * LGPH + LGCS),
                LGCS
            ),
            Cylinder(
                Vector(-LGBW + LGCS, 2 * LGBW - LGCS, -LGCS),
                Vector(-LGBW + LGCS, 2 * LGBW - LGCS, -2 * LGPH + LGCS),
                LGCS
            ),
            Cylinder(
                Vector(-LGBW + LGCS, LGBW + LGCS, -LGCS),
                Vector(LGBW - LGCS, LGBW + LGCS, -LGCS),
                LGCS
            ),
            Cylinder(
                Vector(-LGBW + LGCS, 2 * LGBW - LGCS, -LGCS),
                Vector(LGBW - LGCS, 2 * LGBW - LGCS, -LGCS),
                LGCS
            ),
            Cylinder(
                Vector(-LGBW + 0.12 - LGCS, 2 * LGBW - LGCS, -2 * LGPH + LGCS),
                Vector(-LGBW + LGCS, 2 * LGBW - LGCS, -2 * LGPH + LGCS),
                LGCS
            ),
            Cylinder(
                Vector(LGBW - 0.12 + LGCS, 2 * LGBW - LGCS, -2 * LGPH + LGCS),
                Vector(LGBW - LGCS, 2 * LGBW - LGCS, -2 * LGPH + LGCS),
                LGCS
            ),
            Cylinder(
                Vector(-LGBW + LGCS, 2 * LGBW - LGCS, -LGCS),
                Vector(-LGBW + LGCS, LGBW + LGCS, -LGCS),
                LGCS
            ),
            Cylinder(
                Vector(LGBW - LGCS, 2 * LGBW - LGCS, -LGCS),
                Vector(LGBW - LGCS, LGBW + LGCS, -LGCS),
                LGCS
            ),
            Cylinder(
                Vector(LGBW - LGCS, -2 * LGBW + LGCS, -2 * LGPH + LGCS),
                Vector(LGBW - LGCS, 2 * LGBW - LGCS, -2 * LGPH + LGCS),
                LGCS
            ),
            Cylinder(
                Vector(LGBW - 0.12 + LGCS, LGBW - LGCS, -2 * LGPH + LGCS),
                Vector(LGBW - 0.12 + LGCS, 2 * LGBW - LGCS, -2 * LGPH + LGCS),
                LGCS
            ),
            Cylinder(
                Vector(-LGBW + 0.12 - LGCS, LGBW - LGCS, -2 * LGPH + LGCS),
                Vector(-LGBW + 0.12 - LGCS, 2 * LGBW - LGCS, -2 * LGPH + LGCS),
                LGCS
            ),
            Cylinder(
                Vector(-LGBW + LGCS, LGBW + LGCS, -LGCS),
                Vector(-LGBW + LGCS, LGBW + LGCS, -LGPH - LGCS),
                LGCS
            ),
            Cylinder(
                Vector(LGBW - LGCS, LGBW + LGCS, -LGCS),
                Vector(LGBW - LGCS, LGBW + LGCS, -LGPH - LGCS),
                LGCS
            ),
            Cylinder(
                Vector(-LGBW + LGCS, LGBW + LGCS, -LGPH - LGCS),
                Vector(-LGBW + LGCS, -LGBW - LGCS, -LGPH - LGCS),
                LGCS
            ),
            Cylinder(
                Vector(LGBW - LGCS, LGBW + LGCS, -LGPH - LGCS),
                Vector(LGBW - LGCS, -LGBW - LGCS, -LGPH - LGCS),
                LGCS
            ),
            Cylinder(
                Vector(LGBW - 0.12 + LGCS, LGBW - LGCS, -2 * LGPH + LGCS),
                Vector(-LGBW + 0.12 - LGCS, LGBW - LGCS, -2 * LGPH + LGCS),
                LGCS
            ),
            Cylinder(
                Vector(LGBW - 0.12 + LGCS, -LGBW + LGCS, -2 * LGPH + LGCS),
                Vector(-LGBW + 0.12 - LGCS, -LGBW + LGCS, -2 * LGPH + LGCS),
                LGCS
            ),
            Cylinder(
                Vector(-0.3 - LGCS, 2 * LGBW - LGCS, -0.2 + LGCS),
                Vector(0.3 + LGCS, 2 * LGBW - LGCS, -0.2 + LGCS),
                LGCS
            ),
            Cylinder(
                Vector(0, 0, 0),
                Vector(0.38 / cos(LG_ANGLE * pi / 180), 0, 0),
                LGCS,
                Rotate(Vector(0, -LG_ANGLE, 0)),
                Translate(Vector(-LGBW + 0.12 - LGCS, 2 * LGBW - LGCS, -2 * LGPH + LGCS))
            ),
            Cylinder(
                Vector(0, 0, 0),
                Vector(-0.38 / cos(LG_ANGLE * pi / 180), 0, 0),
                LGCS,
                Rotate(Vector(0, LG_ANGLE, 0)),
                Translate(Vector(LGBW - 0.12 + LGCS, 2 * LGBW - LGCS, -2 * LGPH + LGCS))
            ),
            Difference(
                Union(
                    Box(
                        Vector(LGBW - LGCS, 2 * LGBW - LGCS, 0),
                        Vector(-LGBW + LGCS, LGBW + LGCS, -2 * LGPH)
                    ),
                    Box(
                        Vector(LGBW, 2 * LGBW - LGCS, -LGCS),
                        Vector(-LGBW, LGBW + LGCS, -2 * LGPH + LGCS)
                    ),
                    Box(
                        Vector(LGBW - LGCS, 2 * LGBW, -LGCS),
                        Vector(-LGBW + LGCS, LGBW, -2 * LGPH + LGCS)
                    )
                ),
                Union(
                    Object(
                        LG_KNOB_INNER_SPACE,
                        Translate(Vector(LGBW / 2, 1.5 * LGBW, -LG_TOP_HEIGHT))
                    ),
                    Object(
                        LG_KNOB_INNER_SPACE,
                        Translate(Vector(-LGBW / 2, 1.5 * LGBW, -LG_TOP_HEIGHT))
                    ),
                    Box(
                        Vector(LGBW - 0.12, 2 * LGBW - 0.12, -LG_TOP_HEIGHT),
                        Vector(-LGBW + 0.12, LGBW - LG_E, -2 * LGPH - LG_E)
                    ),
                    Box(
                        Vector(LGBW - 0.12 + LGCS, 2 * LGBW - 0.12, -2 * LGPH + LGCS),
                        Vector(-LGBW + 0.12 - LGCS, LGBW - LGCS, -2 * LGPH - LG_E)
                    ),
                    Box(
                        Vector(-LGCS, -LGWW, 0),
                        Vector(0.38 / cos(LG_ANGLE * pi / 180), LGCS + LG_E, -0.5),
                        Rotate(Vector(0, -LG_ANGLE, 0)),
                        Translate(Vector(-LGBW + 0.12 - LGCS, 2 * LGBW - LGCS, -2 * LGPH + LGCS))
                    ),
                    Box(
                        Vector(LGCS, -LGWW, 0),
                        Vector(-0.38 / cos(LG_ANGLE * pi / 180), LGCS + LG_E, -0.5),
                        Rotate(Vector(0, LG_ANGLE, 0)),
                        Translate(Vector(LGBW - 0.12 + LGCS, 2 * LGBW - LGCS, -2 * LGPH + LGCS))
                    ),
                    Box(
                        Vector(-0.3 - LGCS, 2 * LGBW - LGWW, -0.2 + LGCS),
                        Vector(0.3 + LGCS, 2 * LGBW + LG_E, -2 * LGPH - LG_E)
                    )
                )
            ),
            Difference(
                Box(
                    Vector(LGBW - LGCS, LGBW + 0.13, -LGCS),
                    Vector(-LGBW + LGCS, LGBW - LGWW, -2 * LGPH + LGCS)
                ),
                Union(
                    Box(
                        Vector(LGBW, 0.2, 0),
                        Vector(-LGBW, 0, -0.4 / cos(18.00416161)),
                        Rotate(Vector(-18.00416161, 0, 0)),
                        Translate(Vector(0, LGBW + 0.13, -0.2))
                    ),
                    Box(
                        Vector(LGBW, LGBW, 0),
                        Vector(-LGBW, LGBW - 0.2, -LGPH - LG_E)
                    ),
                ),
            ),
            Box(
                Vector(LGBW, LGBW + 0.1, -LGPH - LGCS),
                Vector(LGBW - 0.12 + LG_E, -LGBW - 0.1, -2 * LGPH + LGCS)
            ),
            Box(
                Vector(LGBW - LGCS, LGBW + 0.1, -LGPH - LGCS),
                Vector(LGBW - 0.12 + LGCS, -LGBW - 0.1, -2 * LGPH)
            ),
            Box(
                Vector(LGBW - 0.12, LGBW - LGCS, -LGPH - LGCS),
                Vector(LGBW - 0.12 + LGCS + LG_E, -LGBW + LGCS, -2 * LGPH)
            ),
            Box(
                Vector(LGBW - LGCS, LGBW - LGCS, -2 * LGPH),
                Vector(-LGBW + LGCS, LGBW - LGWW, -2 * LGPH + LGCS + LG_E)
            ),
            Box(
                Vector(LGBW - LGWW, LGBW / 2 + 0.04, -2 * LGPH + LGCS),
                Vector(LGBW - 0.1, LGBW / 2 - 0.04, -LGPH - LGCS)
            ),
            Box(
                Vector(-LGBW + LGWW, LGBW / 2 + 0.04, -2 * LGPH + LGCS),
                Vector(-LGBW + 0.1, LGBW / 2 - 0.04, -LGPH - LGCS)
            ),
            Box(
                Vector(0, - 0.12 + LGCS, -LGCS),
                Vector(0.38 / cos(LG_ANGLE * pi / 180), 0, LG_E),
                Rotate(Vector(0, -LG_ANGLE, 0)),
                Translate(Vector(-LGBW + 0.12 - LGCS, 2 * LGBW - LGCS, -2 * LGPH + LGCS))
            ),
            Box(
                Vector(0, -0.12 + LGCS, -LGCS),
                Vector(-0.38 / cos(LG_ANGLE * pi / 180), 0, LG_E),
                Rotate(Vector(0, LG_ANGLE, 0)),
                Translate(Vector(LGBW - 0.12 + LGCS, 2 * LGBW - LGCS, -2 * LGPH + LGCS))
            ),
            Box(
                Vector(-0.3 - LGCS, 2 * LGBW - 0.12, -0.2 + LGCS),
                Vector(0.3 + LGCS, 2 * LGBW - LGCS, -0.2)
            ),
            Box(
                Vector(LGBW - 0.12 + LGCS, 2 * LGBW - LGCS, -2 * LGPH),
                Vector(LGBW - LGCS, 2 * LGBW - 0.12e0, -2 * LGPH + LGCS)
            ),
            Box(
                Vector(-LGBW + 0.12 - LGCS, 2 * LGBW - LGCS, -2 * LGPH),
                Vector(-LGBW + LGCS, 2 * LGBW - 0.12e0, -2 * LGPH + LGCS)
            ),
            Object(
                lg_knob(),
                Rotate(Vector(0, 0, 90 + 180 * rot)),
                Translate(Vector(LGBW / 2, LGBW / 2, -LGPH))
            ),
            Object(
                lg_knob(),
                Rotate(Vector(0, 0, 90 + 180 * rot)),
                Translate(Vector(-LGBW / 2, LGBW / 2, -LGPH))
            ),
            Object(
                lg_knob(),
                Rotate(Vector(0, 0, 90 + 180 * rot)),
                Translate(Vector(LGBW / 2, 3 * LGBW / 2, 0))
            ),
            Object(
                lg_knob(),
                Rotate(Vector(0, 0, 90 + 180 * rot)),
                Translate(Vector(-LGBW / 2, 3 * LGBW / 2, 0))
            )
        )

        if rot == 1:
            rotpart.append(
                Rotate(Vector(0, 0, 180))
            )
        mainpart.append(rotpart)

    mainpart.append(
        Difference(
            Box(
                Vector(LGBW - LGCS, LGBW + LGCS, -LGPH),
                Vector(-LGBW + LGCS, -LGBW - LGCS, -LGPH - LG_TOP_HEIGHT)
            ),
            Union(
                Object(
                    LG_KNOB_INNER_SPACE,
                    Translate(Vector(LGBW / 2, LGBW / 2, -LGPH - LG_TOP_HEIGHT))
                ),
                Object(
                    LG_KNOB_INNER_SPACE,
                    Translate(Vector(-LGBW / 2, LGBW / 2, -LGPH - LG_TOP_HEIGHT))
                ),
                Object(
                    LG_KNOB_INNER_SPACE,
                    Translate(Vector(-LGBW / 2, -LGBW / 2, -LGPH - LG_TOP_HEIGHT))
                ),
                Object(
                    LG_KNOB_INNER_SPACE,
                    Translate(Vector(LGBW / 2, -LGBW / 2, -LGPH - LG_TOP_HEIGHT))
                )
            )
        ),
        Object(
            get_lg_cylinder(Union, LG_PLATE_INNER_HEIGHT),
            Translate(Vector(0, 0, -2 * LGPH))
        )
    )

    return mainpart
Beispiel #10
0
def solid(length=4, width=1):
    """return lg_3710: Brick 1 x 4."""
    return Union(
        Sphere(Vector(LGCS, LGCS, LGCS), LGCS),
        Cylinder(Vector(LGCS, LGCS, LGCS),
                 Vector(length * LGBW - LGCS, LGCS, LGCS), LGCS),
        Sphere(Vector(length * LGBW - LGCS, LGCS, LGCS), LGCS),
        Cylinder(Vector(length * LGBW - LGCS, LGCS, LGCS),
                 Vector(length * LGBW - LGCS, LGCS, LGPH - LGCS), LGCS),
        Sphere(Vector(length * LGBW - LGCS, LGCS, LGPH - LGCS), LGCS),
        Cylinder(Vector(length * LGBW - LGCS, LGCS, LGPH - LGCS),
                 Vector(LGCS, LGCS, LGPH - LGCS), LGCS),
        Sphere(Vector(LGCS, LGCS, LGPH - LGCS), LGCS),
        Cylinder(Vector(LGCS, LGCS, LGCS), Vector(LGCS, LGCS, LGPH - LGCS),
                 LGCS),
        Cylinder(Vector(LGCS, LGCS, LGCS),
                 Vector(LGCS, width * LGBW - LGCS, LGCS), LGCS),
        Sphere(Vector(LGCS, width * LGBW - LGCS, LGCS), LGCS),
        Cylinder(Vector(LGCS, width * LGBW - LGCS, LGCS),
                 Vector(LGCS, width * LGBW - LGCS, LGPH - LGCS), LGCS),
        Sphere(Vector(LGCS, width * LGBW - LGCS, LGPH - LGCS), LGCS),
        Cylinder(Vector(LGCS, LGCS, LGPH - LGCS),
                 Vector(LGCS, width * LGBW - LGCS, LGPH - LGCS), LGCS),
        Cylinder(Vector(length * LGBW - LGCS, LGCS, LGCS),
                 Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGCS),
                 LGCS),
        Sphere(Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGCS), LGCS),
        Cylinder(Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGCS),
                 Vector(LGCS, width * LGBW - LGCS, LGCS), LGCS),
        Cylinder(
            Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGCS),
            Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGPH - LGCS),
            LGCS),
        Sphere(Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGPH - LGCS),
               LGCS),
        Cylinder(
            Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGPH - LGCS),
            Vector(LGCS, width * LGBW - LGCS, LGPH - LGCS), LGCS),
        Cylinder(
            Vector(length * LGBW - LGCS, LGCS, LGPH - LGCS),
            Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGPH - LGCS),
            LGCS),
        Difference(
            Union(
                Box(
                    Vector(LGCS, LGCS, 0),
                    Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGPH),
                ),
                Box(
                    Vector(0, LGCS, LGCS),
                    Vector(length * LGBW, width * LGBW - LGCS, LGPH - LGCS),
                ),
                Box(
                    Vector(LGCS, 0, LGCS),
                    Vector(length * LGBW - LGCS, width * LGBW, LGPH - LGCS),
                ),
            ), get_knob_inner_space(length, width)),
        # LG_PLATE_COLUMN,
        get_knob_objects(length, width, LGPH),
        Translate(Vector(-length / 2 * LGBW, -LGBW / 2, -LGPH)),
        Rotate(Vector(0, 0, 90)))
Beispiel #11
0
def std_brick(brick, texture, transx, transy, transz, rotatex, rotatey,
              rotatez):
    """Create rotated + translated Brick object."""
    return Object(brick, texture, Rotate(Vector(rotatex, rotatey, rotatez)),
                  Translate(Vector(transx, transy, transz)))
Beispiel #12
0
def solid():
    """lg_4085c: Plate 1 x 1 with Clip Vertical."""
    result = Union()

    for mir in range(0, 2):
        mirmatrix = Matrix(Vector(1, 0, 0, 0, -1, 0, 0, 0, 1, 0, 0, 0))
        if mir == 1:
            mirmatrix = Matrix(Vector(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0))

        result.append(
            Union(
                Sphere(Vector(LGBW / 2 - LGCS, LGBW / 2 - LGCS, -LGCS), LGCS),
                Sphere(Vector(LGBW / 2 - LGCS, LGBW / 2 - LGCS, -LGPH + LGCS),
                       LGCS),
                Sphere(Vector(-LGBW / 2 + LGCS, LGBW / 2 - LGCS, -LGCS), LGCS),
                Sphere(Vector(-LGBW / 2 + LGCS, LGBW / 2 - LGCS, -LGPH + LGCS),
                       LGCS),
                Cylinder(Vector(-LGBW / 2 + LGCS, LGBW / 2 - LGCS, -LGCS),
                         Vector(LGBW / 2 - LGCS, LGBW / 2 - LGCS, -LGCS),
                         LGCS),
                Cylinder(
                    Vector(-LGBW / 2 + LGCS, LGBW / 2 - LGCS, -LGPH + LGCS),
                    Vector(LGBW / 2 - LGCS, LGBW / 2 - LGCS, -LGPH + LGCS),
                    LGCS),
                Cylinder(
                    Vector(LGBW / 2 - LGCS, LGBW / 2 - LGCS, -LGCS),
                    Vector(LGBW / 2 - LGCS, LGBW / 2 - LGCS, -LGPH + LGCS),
                    LGCS),
                Cylinder(
                    Vector(-LGBW / 2 + LGCS, LGBW / 2 - LGCS, -LGCS),
                    Vector(-LGBW / 2 + LGCS, LGBW / 2 - LGCS, -LGPH + LGCS),
                    LGCS),
                Cylinder(Vector(LGBW / 2 - LGCS, 0.2 - LGCS, -LGCS),
                         Vector(LGBW - LGWW, 0.2 - LGCS, -LGCS), LGCS),
                Cylinder(Vector(LGBW / 2 - LGCS, 0.2 - LGCS, -LGPH + LGCS),
                         Vector(LGBW - LGWW, 0.2 - LGCS, -LGPH + LGCS), LGCS),
                Sphere(
                    Vector(
                        LGBW + (LG_KNOB_INNER_RADIUS + LGCS) * sin(LG_ANGLE),
                        0.13 + LGCS, -LGCS), LGCS),
                Cylinder(
                    Vector(LGBW + LGWW - LGCS, 0.13 + LGCS, -LGCS),
                    Vector(
                        LGBW + (LG_KNOB_INNER_RADIUS + LGCS) * sin(LG_ANGLE),
                        0.13 + LGCS, -LGCS), LGCS),
                Sphere(Vector(LGBW + LGWW - LGCS, 0.13 + LGCS, -LGCS), LGCS),
                Cylinder(Vector(LGBW + LGWW - LGCS, 0.13 + LGCS, -LGCS),
                         Vector(LGBW + LGWW - LGCS, 2 * LGWW - LGCS, -LGCS),
                         LGCS),
                Sphere(Vector(LGBW + LGWW - LGCS, 2 * LGWW - LGCS, -LGCS),
                       LGCS),
                Cylinder(Vector(LGBW, 2 * LGWW - LGCS, -LGCS),
                         Vector(LGBW + LGWW - LGCS, 2 * LGWW - LGCS, -LGCS),
                         LGCS),
                Sphere(
                    Vector(
                        LGBW + (LG_KNOB_INNER_RADIUS + LGCS) * sin(LG_ANGLE),
                        0.13 + LGCS, -LGPH + LGCS), LGCS),
                Cylinder(
                    Vector(LGBW + LGWW - LGCS, 0.13 + LGCS, -LGPH + LGCS),
                    Vector(
                        LGBW + (LG_KNOB_INNER_RADIUS + LGCS) * sin(LG_ANGLE),
                        0.13 + LGCS, -LGPH + LGCS), LGCS),
                Sphere(Vector(LGBW + LGWW - LGCS, 0.13 + LGCS, -LGPH + LGCS),
                       LGCS),
                Cylinder(
                    Vector(LGBW + LGWW - LGCS, 0.13 + LGCS, -LGPH + LGCS),
                    Vector(LGBW + LGWW - LGCS, 2 * LGWW - LGCS, -LGPH + LGCS),
                    LGCS),
                Sphere(
                    Vector(LGBW + LGWW - LGCS, 2 * LGWW - LGCS, -LGPH + LGCS),
                    LGCS),
                Cylinder(
                    Vector(LGBW, 2 * LGWW - LGCS, -LGPH + LGCS),
                    Vector(LGBW + LGWW - LGCS, 2 * LGWW - LGCS, -LGPH + LGCS),
                    LGCS),
                Cylinder(
                    Vector(
                        LGBW + (LG_KNOB_INNER_RADIUS + LGCS) * sin(LG_ANGLE),
                        0.13 + LGCS, -LGCS),
                    Vector(
                        LGBW + (LG_KNOB_INNER_RADIUS + LGCS) * sin(LG_ANGLE),
                        0.13 + LGCS, -LGPH + LGCS), LGCS),
                Cylinder(Vector(LGBW + LGWW - LGCS, 0.13 + LGCS, -LGCS),
                         Vector(LGBW + LGWW - LGCS, 0.13 + LGCS, -LGPH + LGCS),
                         LGCS),
                Cylinder(
                    Vector(LGBW + LGWW - LGCS, 2 * LGWW - LGCS, -LGCS),
                    Vector(LGBW + LGWW - LGCS, 2 * LGWW - LGCS, -LGPH + LGCS),
                    LGCS),
                Box(
                    Vector(LGBW + LGWW, 0.13 + LGCS, -LGCS),
                    Vector(LGBW + LGWW - LGCS - LG_E, 2 * LGWW - LGCS,
                           -LGPH + LGCS)),
                Box(
                    Vector(LGBW, 2 * LGWW, -LGCS),
                    Vector(LGBW + LGWW - LGCS, 2 * LGWW - LGCS - LG_E,
                           -LGPH + LGCS)),
                Box(
                    Vector(
                        LGBW + (LG_KNOB_INNER_RADIUS + LGCS) * sin(LG_ANGLE),
                        0.13 + LGCS + LG_E, -LGCS),
                    Vector(LGBW + LGWW - LGCS, 0.13, -LGPH + LGCS)),
                Difference(
                    Box(Vector(LGBW + LGWW - LGCS, 0.13, 0),
                        Vector(LGBW, 2 * LGWW - LGCS, -LGPH)),
                    Union(
                        Cylinder(Vector(LGBW, 0, 0), Vector(LGBW, 0, -LGPH),
                                 LG_KNOB_INNER_RADIUS),
                        Cylinder(Vector(LGBW, 0, -LGPH - LG_E),
                                 Vector(LGBW, 0, -LGPH + LGCS),
                                 LG_KNOB_INNER_RADIUS + LGCS),
                        Cylinder(Vector(LGBW, 0, LG_E), Vector(LGBW, 0, -LGCS),
                                 LG_KNOB_INNER_RADIUS + LGCS),
                        Difference(
                            Box(Vector(LGBW + LGWW, 0, LG_E),
                                Vector(LGBW - LG_E, 0.13 + LGCS,
                                       -LGPH - LG_E)),
                            Box(Vector(0, 0.4, LG_E),
                                Vector(-0.4, -0.4, -LGPH - LG_E),
                                Rotate(Vector(0, 0, -LG_ANGLE * 180 / pi)),
                                Translate(Vector(LGBW, 0, 0))),
                        ),
                    ),
                ), mirmatrix))

    result.append(
        Union(
            Cylinder(Vector(LGBW / 2 - LGCS, LGBW / 2 - LGCS, -LGCS),
                     Vector(LGBW / 2 - LGCS, -LGBW / 2 + LGCS, -LGCS), LGCS),
            Cylinder(Vector(LGBW / 2 - LGCS, LGBW / 2 - LGCS, -LGPH + LGCS),
                     Vector(LGBW / 2 - LGCS, -LGBW / 2 + LGCS, -LGPH + LGCS),
                     LGCS),
            Cylinder(Vector(-LGBW / 2 + LGCS, LGBW / 2 - LGCS, -LGCS),
                     Vector(-LGBW / 2 + LGCS, -LGBW / 2 + LGCS, -LGCS), LGCS),
            Cylinder(Vector(-LGBW / 2 + LGCS, LGBW / 2 - LGCS, -LGPH + LGCS),
                     Vector(-LGBW / 2 + LGCS, -LGBW / 2 + LGCS, -LGPH + LGCS),
                     LGCS),
            Difference(
                Union(
                    Box(Vector(LGBW / 2 - LGCS, LGBW / 2 - LGCS, 0),
                        Vector(-LGBW / 2 + LGCS, -LGBW / 2 + LGCS, -LGPH)),
                    Box(Vector(LGBW / 2, LGBW / 2 - LGCS, -LGCS),
                        Vector(-LGBW / 2, -LGBW / 2 + LGCS, -LGPH + LGCS)),
                    Box(Vector(LGBW / 2 - LGCS, LGBW / 2, -LGCS),
                        Vector(-LGBW / 2 + LGCS, -LGBW / 2, -LGPH + LGCS)),
                ),
                Union(
                    Box(
                        Vector(LGBW / 2 - LGWW, LGBW / 2 - LGWW,
                               -LG_TOP_HEIGHT),
                        Vector(-LGBW / 2 + LGWW, -LGBW / 2 + LGWW,
                               -LGPH - LG_E)),
                    Object(LG_KNOB_INNER_SPACE,
                           Translate(Vector(0, 0, -LG_TOP_HEIGHT))),
                ),
            ), Object(lg_knob(), Rotate(Vector(0, 0, -90))),
            Intersection(
                Union(
                    Torus(0.32 - LGCS, LGCS, Rotate(Vector(90, 0, 0)),
                          Translate(Vector(LGBW, 0, -LGCS))),
                    Torus(0.32 - LGCS, LGCS, Rotate(Vector(90, 0, 0)),
                          Translate(Vector(LGBW, 0, -LGPH + LGCS))),
                    Difference(
                        Union(
                            Cylinder(Vector(LGBW, 0, 0),
                                     Vector(LGBW, 0, -LGPH), 0.32 - LGCS),
                            Cylinder(Vector(LGBW, 0, -LGCS),
                                     Vector(LGBW, 0, -LGPH + LGCS), 0.32),
                        ),
                        Union(
                            Cylinder(Vector(LGBW, 0,
                                            0), Vector(LGBW, 0, -LGPH),
                                     LG_KNOB_INNER_RADIUS),
                            Cylinder(Vector(LGBW, 0, -LGPH - LG_E),
                                     Vector(LGBW, 0, -LGPH + LGCS),
                                     LG_KNOB_INNER_RADIUS + LGCS),
                            Cylinder(Vector(LGBW, 0, LG_E),
                                     Vector(LGBW, 0, -LGCS),
                                     LG_KNOB_INNER_RADIUS + LGCS),
                        ),
                    ),
                ),
                Box(Vector(LGBW, 0.4, LG_E),
                    Vector(LGBW / 2, -0.4, -LGPH - LG_E)),
            ),
            Intersection(
                Torus(LG_KNOB_INNER_RADIUS + LGCS, LGCS,
                      Rotate(Vector(90, 0, 0))),
                Union(
                    Box(Vector(0, 0.4, LGCS + LG_E),
                        Vector(-0.4, -0.4, -LGCS - LG_E),
                        Rotate(Vector(0, 0, LG_ANGLE * 180 / pi))),
                    Box(Vector(0, 0.4, LGCS + LG_E),
                        Vector(-0.4, -0.4, -LGCS - LG_E),
                        Rotate(Vector(0, 0, -LG_ANGLE * 180 / pi))),
                ), Translate(Vector(LGBW, 0, -LGCS))),
            Intersection(
                Torus(LG_KNOB_INNER_RADIUS + LGCS, LGCS,
                      Rotate(Vector(90, 0, 0))),
                Union(
                    Box(Vector(0, 0.4, LGCS + LG_E),
                        Vector(-0.4, -0.4, -LGCS - LG_E),
                        Rotate(Vector(0, 0, LG_ANGLE * 180 / pi))),
                    Box(Vector(0, 0.4, LGCS + LG_E),
                        Vector(-0.4, -0.4, -LGCS - LG_E),
                        Rotate(Vector(0, 0, -LG_ANGLE * 180 / pi))),
                ), Translate(Vector(LGBW, 0, -LGPH + LGCS))),
            Box(Vector(LGBW - LGWW - LGCS, 0.2 - LGCS, 0),
                Vector(LGBW / 2 - LGCS - LG_E, -0.2 + LGCS, -LGPH)),
            Box(Vector(LGBW - LGWW, 0.2, -LGCS),
                Vector(LGBW / 2 - LGCS - LG_E, -0.2, -LGPH + LGCS))))

    return result
Beispiel #13
0
def solid(length=2, width=2):
    """Return lg_4865: Panel 1 x 2 x 1."""
    result = Union(
        Sphere(Vector(LGCS, LGCS, LGCS), LGCS),
        Cylinder(Vector(LGCS, LGCS, LGCS),
                 Vector(length * LGBW - LGCS, LGCS, LGCS), LGCS),
        Sphere(Vector(length * LGBW - LGCS, LGCS, LGCS), LGCS),
        Cylinder(Vector(length * LGBW - LGCS, LGCS, LGCS),
                 Vector(length * LGBW - LGCS, LGCS, LGBH - LGCS), LGCS),
        Sphere(Vector(length * LGBW - LGCS, LGCS, LGBH - LGCS), LGCS),
        Cylinder(Vector(length * LGBW - LGCS, LGCS, LGBH - LGCS),
                 Vector(LGCS, LGCS, LGBH - LGCS), LGCS),
        Sphere(Vector(LGCS, LGCS, LGBH - LGCS), LGCS),
        Cylinder(Vector(LGCS, LGCS, LGCS), Vector(LGCS, LGCS, LGBH - LGCS),
                 LGCS),
        Cylinder(Vector(LGCS, LGCS, LGCS),
                 Vector(LGCS, width * LGBW - LGCS, LGCS), LGCS),
        Sphere(Vector(LGCS, width * LGBW - LGCS, LGCS), LGCS),
        Cylinder(Vector(LGCS, width * LGBW - LGCS, LGCS),
                 Vector(LGCS, width * LGBW - LGCS, LGBH - LGCS), LGCS),
        Sphere(Vector(LGCS, width * LGBW - LGCS, LGBH - LGCS), LGCS),
        Cylinder(Vector(LGCS, LGCS, LGBH - LGCS),
                 Vector(LGCS, width * LGBW - LGCS, LGBH - LGCS), LGCS),
        Cylinder(Vector(length * LGBW - LGCS, LGCS, LGCS),
                 Vector(length * LGBW - LGCS, LGBW - LGCS, LGCS), LGCS),
        Sphere(Vector(length * LGBW - LGCS, LGBW - LGCS, LGCS), LGCS),
        Cylinder(Vector(length * LGBW - LGCS, (width - 1) * LGBW - LGCS, LGCS),
                 Vector(LGBW - LGCS, LGBW - LGCS, LGCS), LGCS),
        Cylinder(Vector(length * LGBW - LGCS, LGBW - LGCS, LGCS),
                 Vector(length * LGBW - LGCS, LGBW - LGCS, LGBH - LGCS), LGCS),
        Sphere(Vector(length * LGBW - LGCS, LGBW - LGCS, LGBH - LGCS), LGCS),
        Cylinder(Vector(length * LGBW - LGCS, LGBW - LGCS, LGBH - LGCS),
                 Vector(LGBW - LGCS, LGBW - LGCS, LGBH - LGCS), LGCS),
        Cylinder(Vector(length * LGBW - LGCS, LGCS, LGBH - LGCS),
                 Vector(length * LGBW - LGCS, LGBW - LGCS, LGBH - LGCS), LGCS),
        Sphere(Vector(LGBW - LGCS, width * LGBW - LGCS, LGCS), LGCS),
        Sphere(Vector(LGBW - LGCS, width * LGBW - LGCS, LGBH - LGCS), LGCS),
        Cylinder(Vector(LGBW - LGCS, width * LGBW - LGCS, LGCS),
                 Vector(LGBW - LGCS, width * LGBW - LGCS, LGBH - LGCS), LGCS),
        Cylinder(Vector(LGBW - LGCS, width * LGBW - LGCS, LGCS),
                 Vector(LGCS, width * LGBW - LGCS, LGCS), LGCS),
        Cylinder(Vector(LGBW - LGCS, width * LGBW - LGCS, LGBH - LGCS),
                 Vector(LGCS, width * LGBW - LGCS, LGBH - LGCS), LGCS),
        Cylinder(Vector(LGBW - LGCS, width * LGBW - LGCS, LGCS),
                 Vector(LGBW - LGCS, LGBW - LGCS, LGCS), LGCS),
        Cylinder(Vector(LGBW - LGCS, width * LGBW - LGCS, LGBH - LGCS),
                 Vector(LGBW - LGCS, LGBW - LGCS, LGBH - LGCS), LGCS),
        Difference(
            Union(
                Difference(
                    Box(
                        Vector(LGCS, LGCS, 0),
                        Vector(length * LGBW - LGCS, width * LGBW - LGCS,
                               LGBH)),
                    Box(Vector(LGBW - LGCS, LGBW - LGCS, -LG_E),
                        Vector(length * LGBW, width * LGBW, LGBH + LG_E)),
                ),
                Difference(
                    Union(
                        Box(
                            Vector(0, LGCS, LGCS),
                            Vector(length * LGBW, width * LGBW - LGCS,
                                   LGBH - LGCS)),
                        Box(
                            Vector(LGCS, 0, LGCS),
                            Vector(length * LGBW - LGCS, width * LGBW,
                                   LGBH - LGCS)),
                    ),
                    Box(
                        Vector(LGBW, LGBH, 0),
                        Vector(length * LGBW + LG_E, width * LGBW + LG_E,
                               LGBH))),
                Union(
                    Difference(
                        Box(
                            Vector(LGWW, LGWW, -LG_E),
                            Vector(length * LGBW - LGWW, width * LGBW - LGWW,
                                   LG_BRICK_INNER_HEIGHT)),
                        Box(
                            Vector(length / LGBW, width * LGBW, -LGCS),
                            Vector(length / 2 * LGBW - LGWW,
                                   width / 2 * LGBW - LGWW,
                                   LG_BRICK_INNER_HEIGHT + LG_E)),
                    ),
                    Box(Vector(length * LGBW - LGCS, LGBW - LGCS, -LG_E),
                        Vector(length * LGBW + LG_E, LGBW + LG_E,
                               LGBH + LG_E)),
                    Box(Vector(LGBW - LGCS, width * LGBW - LGCS, -LG_E),
                        Vector(LGBW + LG_E, width * LGBW + LG_E, LGBH + LG_E)),
                    Object(
                        LG_KNOB_INNER_SPACE,
                        Translate(
                            Vector(0.5 * LGBW, 0.5 * LGBW,
                                   LG_BRICK_INNER_HEIGHT))),
                    Object(
                        LG_KNOB_INNER_SPACE,
                        Translate(
                            Vector(0.5 * LGBW, 1.5 * LGBW,
                                   LG_BRICK_INNER_HEIGHT))),
                    Object(
                        LG_KNOB_INNER_SPACE,
                        Translate(
                            Vector(1.5 * LGBW, 0.5 * LGBW,
                                   LG_BRICK_INNER_HEIGHT))))),
            Box(
                Vector(
                    sqrt(2) * (LGBW + LG_CYLINDER_RADIUS) / 2, -0.06,
                    LG_BRICK_INNER_HEIGHT), Vector(sqrt(2) * LGBW, 0.06, 0),
                Rotate(Vector(0, 0, 45))),
        ), Object(LG_BRICK_COLUMN, Translate(Vector(LGBW, 0.5 * LGBW, 0))),
        Object(LG_BRICK_COLUMN, Translate(Vector(0.5 * LGBW, LGBW, 0))),
        Object(lg_knob(), Translate(Vector(0.5 * LGBW, 0.5 * LGBW, LGBH))),
        Object(lg_knob(), Translate(Vector(1.5 * LGBW, 0.5 * LGBW, LGBH))),
        Object(
            lg_knob(),
            Translate(Vector(0.5 * LGBW, 1.5 * LGBW, LGBH)),
        ), Translate(Vector((-length / 2 + 0.5) * LGBW, -0.5 * LGBW, -LGBH)),
        Rotate(Vector(0, 0, 180)))

    return result
Beispiel #14
0
def nonmoving(tvector=Vector(0, 0, 0), rvector=Vector(0, 0, 0)):
    """
    docstring for lg_10036_car.

    @Todo: ApiDoc.
    :param tvector:
    :param rvector:
    """
    part = Union(
        Comment("""
        # *******************************************************************
        # Objects (Step 1)
        # *******************************************************************
        """),
        Comment('**** Start 2441 Red Car Base 7 x 4 x 2/3 ****'),
        std_brick(lg_2441.solid(), LG_RED, 0, 3 * LGPH, 0, -90, 0, 0),
        Comment('**** End 2441 Red Car Base 7 x 4 x 2/3 ****'),
        Comment("""
        # *******************************************************************
        # Objects (Step 2)
        # *******************************************************************
        """),
        Comment('**** Start 3022 White Plate 2 x 2 ****'),
        std_brick(lg_3022.solid(), LG_WHITE, 2.5 * LGBW, 4 * LGPH, 0, -90, 0,
                  0),
        Comment('**** End 3022 White Plate 2 x 2 ****'),
        Comment('**** Start 2412b White Tile 1 x 2 Grille with Groove ****'),
        std_brick(lg_2412b.solid(), LG_WHITE, 0.5 * LGBW, 3 * LGPH,
                  -1.5 * LGBW, -90, 90, 0),
        Comment('**** End 2412b White Tile 1 x 2 Grille with Groove ****'),
        Comment('**** Start 2412b White Tile 1 x 2 Grille with Groove ****'),
        std_brick(lg_2412b.solid(), LG_WHITE, 0.5 * LGBW, 3 * LGPH, 1.5 * LGBW,
                  -90, 90, 0),
        Comment('**** End 2412b White Tile 1 x 2 Grille with Groove ****'),
        Comment("""
        ********************************************************************
        * Objects (Step 3)
        ********************************************************************
        """),
        Comment('**** Start 3022 White Plate 2 x 2 ****'),
        std_brick(lg_3022.solid(), LG_WHITE, -2.5 * LGBW, 4 * LGPH, 0, -90, 0,
                  0),
        Comment('**** End 3022 White Plate 2 x 2 ****'),
        Comment('**** Start 3010 White Brick 1 x 4 ****'),
        std_brick(lg_3010.solid(), LG_WHITE, -1 * LGBW, 5 * LGPH, 0, -90, 0,
                  0),
        Comment('**** End 3010 White Brick 1 x 4 ****'),
        Comment("""
        ********************************************************************
        * Objects (Step 4)
        ********************************************************************
        """),
        Comment('**** Start 3003 Yellow Brick 2 x 2 ****'),
        std_brick(lg_3003.solid(), LG_YELLOW, 0.5 * LGBW, 5 * LGPH, 0, -90, 0,
                  0),
        Comment('**** End 3003 Yellow Brick 2 x 2 ****'),
        Comment('**** 3788    White   Car Mudguard 2 x 4 ****'),
        std_brick(lg_3788.solid(), LG_WHITE, 2.5 * LGBW, 6 * LGPH, 0, -90, 0,
                  0),
        Comment('**** 3788    White   Car Mudguard 2 x 4 ****'),
        Comment("""
        ********************************************************************
        * Objects (Step 5)
        ********************************************************************
        """),
        Comment('**** 3788    White   Car Mudguard 2 x 4 ****'),
        std_brick(lg_3788.solid(), LG_WHITE, -2.5 * LGBW, 6 * LGPH, 0, -90, 0,
                  0),
        Comment('**** 3788    White   Car Mudguard 2 x 4 ****'),
        Comment('**** 3021  Red   Plate 2 x 3 ****'),
        std_brick(lg_3021.solid(), LG_RED, -1.5 * LGBW, 6 * LGPH, 0, -90, 0,
                  0),
        Comment('**** 3021 Red Plate 2 x 3 ****'),
        Comment('**** 3024 White Plate 1 x 1 ****'),
        std_brick(lg_3024.solid(), LG_WHITE, -1.5 * LGBW, 6 * LGPH, -2 * LGBW,
                  -90, 0, 0),
        Comment('**** 3024 White Plate 1 x 1 ****'),
        Comment(
            '**** 4085c White Plate 1 x 1 with Clip Vertical - Type 3 ****'),
        std_brick(lg_4085c.solid(), LG_WHITE, -1 * LGBW, 6 * LGPH, 1.5 * LGBW,
                  -90, 0, 0),
        Comment(
            '**** 4085c White Plate 1 x 1 with Clip Vertical - Type 3 ****'),
        Comment("""
        ********************************************************************
        * Objects (Step 6)
        ********************************************************************
        """),
        Comment('**** 2436  White Bracket 1 x 2 - 1 x 4 ****'),
        std_brick(lg_2436.solid(), LG_WHITE, 3 * LGBW, 6 * LGPH, 0, -90, 0, 0),
        Comment('**** 2436  White Bracket 1 x 2 - 1 x 4 ****'),
        Comment('**** 3020  White Plate 2 x 4 ****'),
        std_brick(lg_3020.solid(), LG_WHITE, -1.5 * LGBW, 7 * LGPH, -LGBW, -90,
                  90, 0),
        Comment('**** 3020  White Plate 2 x 4 ****'),
        Comment("""
        ********************************************************************
        * Objects (Step 7)
        ********************************************************************
        """),
        Comment('**** 4073  TrYello Plate 1 x 1 Round ****'),
        std_brick(lg_4073.clear(), LG_CLEAR_YELLOW, 4.1 * LGBW, 5 * LGPH,
                  -1.5 * LGBW, 0, 90, 0),
        std_brick(lg_4073.clear(), LG_CLEAR_YELLOW, 4.1 * LGBW, 5 * LGPH,
                  1.5 * LGBW, 0, 90, 0),
        Comment('**** 4073  TrYello Plate 1 x 1 Round ****'),
        Comment('**** 2412b Red   Tile 1 x 2 Grille with Groove ****'),
        std_brick(lg_2412b.solid(), LG_RED, 4.0 * LGBW, 4.7 * LGPH, 0, -90, 0,
                  -90),
        Comment('**** 2412b Red   Tile 1 x 2 Grille with Groove ****'),
        Comment('**** 3069b Black Tile 1 x 2 with Groove ****'),
        std_brick(lg_3069b.solid(), LG_BLACK, -2 * LGBW, 8 * LGPH, 0, -90, 180,
                  0),
        Comment('**** 3069b Black Tile 1 x 2 with Groove ****'),
        Comment('**** 4865  Black Panel 1 x 2 x 1 ****'),
        std_brick(lg_4865.solid(), LG_BLACK, -1.5 * LGBW, 10 * LGPH, 0, -90,
                  180, 0),
        Comment('**** 4865  Black Panel 1 x 2 x 1 ****'),
        Comment("""
        ********************************************************************
        * Objects (Step 8)
        ********************************************************************
        """),
        Comment('**** 3004  White Brick 1 x 2 ****'),
        std_brick(lg_3004.solid(), LG_WHITE, -1.5 * LGBW, 10 * LGPH, -2 * LGBW,
                  -90, 0, 0),
        Comment('**** 3004  White Brick 1 x 2 ****'),
        Comment('**** 3004  White Brick 1 x 2 ****'),
        std_brick(lg_3004.solid(), LG_WHITE, -1.5 * LGBW, 10 * LGPH, 1 * LGBW,
                  -90, 0, 0),
        Comment('**** 3004  White Brick 1 x 2 ****'),
        Comment("""
        ********************************************************************
        * Objects (Step 9)
        ********************************************************************
        """),
        Comment('**** 3020  White Plate 2 x 4 ****'),
        std_brick(lg_3020.solid(), LG_WHITE, -1.5 * LGBW, 11 * LGPH, -LGBW,
                  -90, 90, 0),
        Comment('**** 3020  White Plate 2 x 4 ****'),
        Comment('**** 2357  White Brick 2 x 2 Corner ****'),
        std_brick(lg_2357.solid(), LG_WHITE, 3 * LGBW, 9 * LGPH, -1.5 * LGBW,
                  -90, 0, 0),
        Comment('**** 2357  White Brick 2 x 2 Corner ****'),
        Comment('**** 2357  White Brick 2 x 2 Corner ****'),
        std_brick(lg_2357.solid(), LG_WHITE, 3 * LGBW, 9 * LGPH, 1.5 * LGBW,
                  -90, 270, 0),
        Comment('**** 2357  White Brick 2 x 2 Corner ****'),
        Comment("""
        ********************************************************************
        * Objects (Step 10)
        ********************************************************************
        """),
        Comment('**** 3069b Black Tile 1 x 2 with Groove ****'),
        std_brick(lg_3069b.solid(), LG_BLACK, -2 * LGBW, 12 * LGPH, 0 * LGBW,
                  -90, 180, 0),
        Comment('**** 3069b Black Tile 1 x 2 with Groove ****'),
        Comment('**** 4865  Black Panel 1 x 2 x 1 ****'),
        std_brick(lg_4865.solid(), LG_BLACK, -1.5 * LGBW, 14 * LGPH, 0 * LGBW,
                  -90, 180, 0),
        Comment('**** 4865  Black Panel 1 x 2 x 1 ****'),
        Comment('**** 3823  TrLtBlu Windscreen 2 x 4 x 2 ****'),
        # @Todo: Needs a lot of fixing
        std_brick(lg_3823.clear(), LG_CLEAR_CYAN, 2 * LGBW, 15 * LGPH,
                  0 * LGBW, -90, 0, 0),
        Comment('**** 3823  TrLtBlu Windscreen 2 x 4 x 2 ****'),
        Comment("""
        ********************************************************************
        * Objects (Step 11)
        ********************************************************************
        """),
        Comment('**** 3853  White Window 1 x 4 x 3 ****'),
        std_brick(lg_3853.solid(), LG_WHITE, -3 * LGBW, 15 * LGPH, 0 * LGBW,
                  -90, 180, 0),
        Comment('**** 3853  White Window 1 x 4 x 3 ****'),
        Comment('''
        Comment('**** 3004  White Brick 1 x 2 ****'),
        std_brick(
            lg_3004.solid(),
            LG_WHITE,
            -1.5 * LGBW, 14 * LGPH, -1 * LGBW,
            -90, 180, 0
        ),
        Comment('**** 3004  White Brick 1 x 2 ****'),
        Comment('**** 3004  White Brick 1 x 2 ****'),
        std_brick(
            lg_3004.solid(),
            LG_WHITE,
            -1.5 * LGBW, 14 * LGPH, 2 * LGBW,
            -90, 180, 0
        ),
        Comment('**** 3004  White Brick 1 x 2 ****'),
        Comment('**** 3710  White Plate 1 x 4 ****'),
        # Todo: fix plate coloumns
        std_brick(
            lg_3710.solid(),
            LG_WHITE,
            -2 * LGBW, 15 * LGPH, 0 * LGBW,
            -90, 0, 0
        ),
        Comment('**** 3710  White Plate 1 x 4 ****'),
        Comment("""
        ********************************************************************
        * Objects (Step 12)
        ********************************************************************
        """),
        Comment('**** White Hinge Tile 1 x 4 ****'),
        # std_brick(
        #     lg_4625.solid(),
        #     LG_WHITE, -1*LGBW, 15*LGPH, 0*LGBW,
        #     -90, 0, 0
        # ),
        Comment('**** White Hinge Tile 1 x 4 ****'),
        Comment("""
        ********************************************************************
        # * Objects (Step 13)
        ********************************************************************
        """),
        Comment('**** 3020  White Plate 2 x 4 ****'),
        std_brick(
            lg_3020.solid(),
            LG_WHITE,
            -2.5 * LGBW, 16 * LGPH, -1 * LGBW,
            -90, 90, 0
        ),
        Comment('**** 3020  White Plate 2 x 4 ****'),
        '''),
        Rotate(rvector),
        Translate(tvector))

    return part
Beispiel #15
0
def solid():
    """@Todo: Docstring."""
    return Union(
        Sphere(Vector(-LGBW / 2 + LGCS, LGBW - LGCS, -LGCS), LGCS),
        Sphere(Vector(-LGBW / 2 + LGCS, -LGBW + LGCS, -LGCS), LGCS),
        Sphere(Vector(-LGBW / 2 + LGCS, LGBW - LGCS, -LGPH + LGCS), LGCS),
        Sphere(Vector(-LGBW / 2 + LGCS, -LGBW + LGCS, -LGPH + LGCS), LGCS),
        Cylinder(Vector(-LGBW / 2 + LGCS, LGBW - LGCS, -LGCS),
                 Vector(-LGBW / 2 + LGCS, -LGBW + LGCS, -LGCS), LGCS),
        Cylinder(Vector(-LGBW / 2 + LGCS, LGBW - LGCS, -LGPH + LGCS),
                 Vector(-LGBW / 2 + LGCS, -LGBW + LGCS, -LGPH + LGCS), LGCS),
        Cylinder(Vector(-LGBW / 2 + LGCS, -LGBW + LGCS, -LGCS),
                 Vector(-LGBW / 2 + LGCS, -LGBW + LGCS, -LGPH + LGCS), LGCS),
        Cylinder(Vector(-LGBW / 2 + LGCS, LGBW - LGCS, -LGCS),
                 Vector(-LGBW / 2 + LGCS, LGBW - LGCS, -LGPH + LGCS), LGCS),
        Cylinder(Vector(LGBW / 2 + LGCS, -LGBW + LGCS, -LGCS),
                 Vector(-LGBW / 2 + LGCS, -LGBW + LGCS, -LGCS), LGCS),
        Cylinder(Vector(LGBW / 2 + LGCS, LGBW - LGCS, -LGCS),
                 Vector(-LGBW / 2 + LGCS, LGBW - LGCS, -LGCS), LGCS),
        Cylinder(Vector(LGBW / 2 + LGCS, -LGBW + LGCS, -LGPH + LGCS),
                 Vector(-LGBW / 2 + LGCS, -LGBW + LGCS, -LGPH + LGCS), LGCS),
        Cylinder(Vector(LGBW / 2 + LGCS, LGBW - LGCS, -LGPH + LGCS),
                 Vector(-LGBW / 2 + LGCS, LGBW - LGCS, -LGPH + LGCS), LGCS),
        Sphere(Vector(LGBW / 2 + LGCS, 2 * LGBW - LGCS, -LGCS), LGCS),
        Sphere(Vector(LGBW / 2 + LGCS, -2 * LGBW + LGCS, -LGCS), LGCS),
        Sphere(Vector(LGBW / 2 + LGCS, 2 * LGBW - LGCS, -LGBW + LGCS), LGCS),
        Sphere(Vector(LGBW / 2 + LGCS, -2 * LGBW + LGCS, -LGBW + LGCS), LGCS),
        Sphere(Vector(LGBW / 2 + LGWW - LGCS, 2 * LGBW - LGCS, -LGCS), LGCS),
        Sphere(Vector(LGBW / 2 + LGWW - LGCS, -2 * LGBW + LGCS, -LGCS), LGCS),
        Sphere(Vector(LGBW / 2 + LGWW - LGCS, 2 * LGBW - LGCS, -LGBW + LGCS),
               LGCS),
        Sphere(Vector(LGBW / 2 + LGWW - LGCS, -2 * LGBW + LGCS, -LGBW + LGCS),
               LGCS),
        Cylinder(Vector(LGBW / 2 + LGCS, -LGBW + LGCS, -LGCS),
                 Vector(LGBW / 2 + LGCS, -2 * LGBW + LGCS, -LGCS), LGCS),
        Cylinder(Vector(LGBW / 2 + LGCS, LGBW - LGCS, -LGCS),
                 Vector(LGBW / 2 + LGCS, 2 * LGBW - LGCS, -LGCS), LGCS),
        Cylinder(Vector(LGBW / 2 + LGCS, 2 * LGBW - LGCS, -LGBW + LGCS),
                 Vector(LGBW / 2 + LGCS, -2 * LGBW + LGCS, -LGBW + LGCS),
                 LGCS),
        Cylinder(Vector(LGBW / 2 + LGWW - LGCS, 2 * LGBW - LGCS, -LGCS),
                 Vector(LGBW / 2 + LGWW - LGCS, -2 * LGBW + LGCS, -LGCS),
                 LGCS),
        Cylinder(
            Vector(LGBW / 2 + LGWW - LGCS, 2 * LGBW - LGCS, -LGBW + LGCS),
            Vector(LGBW / 2 + LGWW - LGCS, -2 * LGBW + LGCS, -LGBW + LGCS),
            LGCS),
        Cylinder(
            Vector(LGBW / 2 + LGCS, -2 * LGBW + LGCS, -LGBW + LGCS),
            Vector(LGBW / 2 + LGWW - LGCS, -2 * LGBW + LGCS, -LGBW + LGCS),
            LGCS),
        Cylinder(Vector(LGBW / 2 + LGCS, 2 * LGBW - LGCS, -LGBW + LGCS),
                 Vector(LGBW / 2 + LGWW - LGCS, 2 * LGBW - LGCS, -LGBW + LGCS),
                 LGCS),
        Cylinder(Vector(LGBW / 2 + LGCS, -2 * LGBW + LGCS, -LGCS),
                 Vector(LGBW / 2 + LGWW - LGCS, -2 * LGBW + LGCS, -LGCS),
                 LGCS),
        Cylinder(Vector(LGBW / 2 + LGCS, 2 * LGBW - LGCS, -LGCS),
                 Vector(LGBW / 2 + LGWW - LGCS, 2 * LGBW - LGCS, -LGCS), LGCS),
        Cylinder(
            Vector(LGBW / 2 + LGWW - LGCS, -2 * LGBW + LGCS, -LGCS),
            Vector(LGBW / 2 + LGWW - LGCS, -2 * LGBW + LGCS, -LGBW + LGCS),
            LGCS),
        Cylinder(Vector(LGBW / 2 + LGWW - LGCS, 2 * LGBW - LGCS, -LGCS),
                 Vector(LGBW / 2 + LGWW - LGCS, 2 * LGBW - LGCS, -LGBW + LGCS),
                 LGCS),
        Cylinder(Vector(LGBW / 2 + LGCS, -2 * LGBW + LGCS, -LGCS),
                 Vector(LGBW / 2 + LGCS, -2 * LGBW + LGCS, -LGBW + LGCS),
                 LGCS),
        Cylinder(Vector(LGBW / 2 + LGCS, 2 * LGBW - LGCS, -LGCS),
                 Vector(LGBW / 2 + LGCS, 2 * LGBW - LGCS, -LGBW + LGCS), LGCS),
        Difference(
            Union(
                Box(Vector(LGBW / 2 + LGCS + LG_E, -LGBW + LGCS, 0),
                    Vector(-LGBW / 2 + LGCS, LGBW - LGCS, -LGPH)),
                Box(Vector(LGBW / 2 + LGCS + LG_E, -LGBW, -LGCS),
                    Vector(-LGBW / 2 + LGCS, LGBW, -LGPH + LGCS)),
                Box(Vector(LGBW / 2 + LGCS + LG_E, -LGBW + LGCS, -LGCS),
                    Vector(-LGBW / 2, LGBW - LGCS, -LGPH + LGCS)),
            ),
            Union(
                Box(Vector(LGBW / 2 + LG_E, -LGBW + LGWW, -LG_TOP_HEIGHT),
                    Vector(-LGBW / 2 + LGWW, LGBW - LGWW, -LGPH - LG_E)),
                Object(LG_KNOB_INNER_SPACE,
                       Translate(Vector(0, -LGBW / 2, -LG_TOP_HEIGHT))),
                Object(LG_KNOB_INNER_SPACE,
                       Translate(Vector(0, LGBW / 2, -LG_TOP_HEIGHT))),
            ),
        ),
        Box(Vector(LGBW / 2 + LGCS, 2 * LGBW - LGCS, 0),
            Vector(LGBW / 2 + LGWW - LGCS, -2 * LGBW + LGCS, -LGBW)),
        Box(Vector(LGBW / 2 + LGCS, 2 * LGBW, -LGCS),
            Vector(LGBW / 2 + LGWW - LGCS, -2 * LGBW, -LGBW + LGCS)),
        Box(Vector(LGBW / 2, 2 * LGBW - LGCS, -LGCS),
            Vector(LGBW / 2 + LGWW, -2 * LGBW + LGCS, -LGBW + LGCS)),
        Box(Vector(LG_KNOB_RADIUS, -LGBW / 2 + 0.06, -LGPH),
            Vector(LGBW / 2 + LG_E, -LGBW / 2 - 0.06, -LG_TOP_HEIGHT + LG_E)),
        Box(Vector(LG_KNOB_RADIUS, LGBW / 2 + 0.06, -LGPH),
            Vector(LGBW / 2 + LG_E, LGBW / 2 - 0.06, -LG_TOP_HEIGHT + LG_E)),
        Object(LG_PLATE_COLUMN, Translate(Vector(0, 0, -LGPH))),
        Object(lg_knob(), Rotate(Vector(0, 0, 90)),
               Translate(Vector(0, -LGBW / 2, 0))),
        Object(lg_knob(), Rotate(Vector(0, 0, 90)),
               Translate(Vector(0, LGBW / 2, 0))),
        Object(lg_tech_knob_logo(), Rotate(Vector(0, 0, 90)),
               Rotate(Vector(0, 90, 0)),
               Translate(Vector(LGBW / 2 + LGWW, -3 * LGBW / 2, -LGBW / 2))),
        Object(lg_tech_knob_logo(), Rotate(Vector(0, 0, 90)),
               Rotate(Vector(0, 90, 0)),
               Translate(Vector(LGBW / 2 + LGWW, -LGBW / 2, -LGBW / 2))),
        Object(lg_tech_knob_logo(), Rotate(Vector(0, 0, 90)),
               Rotate(Vector(0, 90, 0)),
               Translate(Vector(LGBW / 2 + LGWW, LGBW / 2, -LGBW / 2))),
        Object(lg_tech_knob_logo(), Rotate(Vector(0, 0, 90)),
               Rotate(Vector(0, 90, 0)),
               Translate(Vector(LGBW / 2 + LGWW, 3 * LGBW / 2, -LGBW / 2))),
    )
Beispiel #16
0
def solid(length=2, width=1):
    """return lg_3069b: Tile 1 x 2 with groove."""
    return Union(
        Sphere(Vector(LGCS, LGCS, LGCS + 0.04), LGCS),
        Cylinder(Vector(LGCS, LGCS, LGCS + 0.04),
                 Vector(length * LGBW - LGCS, LGCS, LGCS + 0.04), LGCS),
        Sphere(Vector(length * LGBW - LGCS, LGCS, LGCS + 0.04), LGCS),
        Cylinder(Vector(length * LGBW - LGCS, LGCS, LGCS + 0.04),
                 Vector(length * LGBW - LGCS, LGCS, LGPH - LGCS), LGCS),
        Sphere(Vector(length * LGBW - LGCS, LGCS, LGPH - LGCS), LGCS),
        Cylinder(Vector(length * LGBW - LGCS, LGCS, LGPH - LGCS),
                 Vector(LGCS, LGCS, LGPH - LGCS), LGCS),
        Sphere(Vector(LGCS, LGCS, LGPH - LGCS), LGCS),
        Cylinder(Vector(LGCS, LGCS, LGCS + 0.04),
                 Vector(LGCS, LGCS, LGPH - LGCS), LGCS),
        Cylinder(Vector(LGCS, LGCS, LGCS + 0.04),
                 Vector(LGCS, width * LGBW - LGCS, LGCS + 0.04), LGCS),
        Sphere(Vector(LGCS, width * LGBW - LGCS, LGCS + 0.04), LGCS),
        Cylinder(Vector(LGCS, width * LGBW - LGCS, LGCS + 0.04),
                 Vector(LGCS, width * LGBW - LGCS, LGPH - LGCS), LGCS),
        Sphere(Vector(LGCS, width * LGBW - LGCS, LGPH - LGCS), LGCS),
        Cylinder(Vector(LGCS, LGCS, LGPH - LGCS),
                 Vector(LGCS, width * LGBW - LGCS, LGPH - LGCS), LGCS),
        Cylinder(
            Vector(length * LGBW - LGCS, LGCS, LGCS + 0.04),
            Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGCS + 0.04),
            LGCS),
        Sphere(Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGCS + 0.04),
               LGCS),
        Cylinder(
            Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGCS + 0.04),
            Vector(LGCS, width * LGBW - LGCS, LGCS + 0.04), LGCS),
        Cylinder(
            Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGCS + 0.04),
            Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGPH - LGCS),
            LGCS),
        Sphere(Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGPH - LGCS),
               LGCS),
        Cylinder(
            Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGPH - LGCS),
            Vector(LGCS, width * LGBW - LGCS, LGPH - LGCS), LGCS),
        Cylinder(
            Vector(length * LGBW - LGCS, LGCS, LGPH - LGCS),
            Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGPH - LGCS),
            LGCS),
        Difference(
            Union(
                Box(Vector(LGCS, LGCS, 0.04),
                    Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGPH)),
                Box(Vector(LGCS, 0, LGCS + 0.04),
                    Vector(length * LGBW - LGCS, width * LGBW, LGPH - LGCS)),
                Box(Vector(0, LGCS, LGCS + 0.04),
                    Vector(length * LGBW, width * LGBW - LGCS, LGPH - LGCS)),
                Box(
                    Vector(0.04, 0.04, 0),
                    Vector(length * LGBW - 0.04, width * LGBW - 0.04,
                           0.04 + LG_E)),
            ),
            Box(
                Vector(LGWW, LGWW, -LGCS),
                Vector(length * LGBW - LGWW, width * LGBW - LGWW,
                       LG_PLATE_INNER_HEIGHT)),
        ), Translate(Vector(-LGBW, -0.5 * LGBW, -LGPH)),
        Rotate(Vector(0, 0, 90)))
Beispiel #17
0
def clear():
    """return lg_3823: Windscreen 2 x 4 x 2."""
    result = Merge()

    for mir in range(0, 2):
        mirmatrix = Matrix(Vector(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))
        if mir == 1:
            mirmatrix = Matrix(Vector(1, 0, 0, 0, -1, 0, 0, 0, 1, 0, 0, 0))

        result.append(
            Merge(
                Cylinder(Vector(0, 2 * LGBW - LGCS, -LGCS),
                         Vector(-LGBW / 2 + LGCS, 2 * LGBW - LGCS, -LGCS),
                         LGCS),
                Sphere(Vector(-LGBW / 2 + LGCS, 2 * LGBW - LGCS, -LGCS), LGCS),
                Sphere(
                    Vector(-LGBW / 2 + LGCS, 2 * LGBW - LGCS,
                           -2 * LGBH + LGCS), LGCS),
                Cylinder(
                    Vector(-LGBW / 2 + LGCS, 2 * LGBW - LGCS, -LGCS),
                    Vector(-LGBW / 2 + LGCS, 2 * LGBW - LGCS,
                           -2 * LGBH + LGCS), LGCS),
                Cylinder(Vector(-LGBW / 2 + LGCS, 2 * LGBW - LGCS, -LGCS),
                         Vector(-LGBW / 2 + LGCS, 1.5 * LGBW + 0.12, -LGCS),
                         LGCS),
                Intersection(
                    Torus(LGBW / 2 - LGCS, LGCS, Rotate(Vector(90, 0, 0))),
                    Box(
                        Vector(-LGBW / 2 - LG_E, -LGBW / 2 - LG_E,
                               LGCS + LG_E), Vector(0, 0, -LGCS - LG_E)),
                    Translate(Vector(0, 1.5 * LGBW + 0.12, -LGCS))),
                Cylinder(
                    Vector(0, LGBW + 0.12 + LGCS, -LGCS),
                    Vector(LGBW / 2 - LGWW / 2 + LGCS, LGBW + 0.12 + LGCS,
                           -LGCS), LGCS),
                Cylinder(
                    Vector(LGBW, 2 * LGBW - LGCS, -2 * LGBH + LGCS),
                    Vector(-LGBW / 2 + LGCS, 2 * LGBW - LGCS,
                           -2 * LGBH + LGCS), LGCS),
                Intersection(
                    Difference(
                        Cylinder(
                            Vector(0, 0, 0),
                            Vector(0, 0, -2.5 * LGPH),
                            # Vector(0, 0, -5 * LGPH),
                            LGBW / 2),
                        Cylinder(
                            Vector(0, 0, LGCS + LG_E),
                            Vector(0, 0, -3 * LGPH),
                            # Vector(0, 0, -6 * LGPH),
                            LGBW / 2 - LGWW),
                    ),
                    Box(Vector(LGBW / 2 + LG_E, LGBW / 2 + LG_E, LGCS + LG_E),
                        Vector(0, 0, -2 * LGBH)),
                    Matrix(
                        Vector(1, 0,
                               2 / LGBW * LGCS * sin(LG_ANGLE * pi / 180), 0,
                               1, 0, -1 / 2, 0, 1,
                               LGCS * (cos(LG_ANGLE * pi / 180) - 1),
                               3 * LGBW / 2, -LGCS))),
                Intersection(
                    Difference(
                        Cylinder(
                            Vector(0, 0, -2.5 * LGPH),
                            Vector(0, 0, -5 * LGPH),
                            # Vector(0, 0, -5 * LGPH),
                            LGBW / 2),
                        Cylinder(
                            Vector(0, 0, -2.5 * LGPH),
                            Vector(0, 0, -5 * LGPH),
                            # Vector(0, 0, -6 * LGPH),
                            LGBW / 2 - LGWW),
                    ),
                    Box(Vector(LGBW / 2 + LG_E, LGBW / 2 + LG_E, LGCS + LG_E),
                        Vector(0, 0, -2 * LGBH)),
                    Translate(Vector(1 * LGBW, 0 * LGBW, 0)),
                    Matrix(
                        Vector(
                            1,
                            0,
                            0,
                            # 2 / LGBW * LGCS * sin(LG_ANGLE * pi / 180),
                            0,
                            1,
                            0,
                            0,
                            0,
                            1,
                            0,  # LGCS * (cos(LG_ANGLE * pi / 180) -1),
                            3 * LGBW / 2,
                            -LGCS)),
                ),
                Intersection(
                    Torus(LGBW / 2 - LGCS, LGCS, Rotate(Vector(90, 0, 0))),
                    Box(Vector(LGBW / 2 + LG_E, LGBW / 2 + LG_E, LGCS + LG_E),
                        Vector(0, 0, -LGCS - LG_E)),
                    Translate(Vector(0, 3 * LGBW / 2, -LGCS))),
                Intersection(
                    Torus(LGBW / 2 - LGCS, LGCS, Rotate(Vector(90, 0, 0))),
                    Box(Vector(LGBW / 2 + LG_E, LGBW / 2 + LG_E, LGCS + LG_E),
                        Vector(0, 0, -LGCS - LG_E)),
                    Translate(Vector(LGBW, 3 * LGBW / 2, -5 * LGPH - LGCS))),
                Intersection(
                    Torus(LGBW / 2 - LGCS, LGCS, Rotate(Vector(90, 0, 0))),
                    Box(Vector(LGBW / 2 + LG_E, LGBW / 2 + LG_E, LGCS + LG_E),
                        Vector(0, 0, -LGCS - LG_E)),
                    Translate(Vector(LGBW, 3 * LGBW / 2, -2 * LGBH + LGCS))),
                Difference(
                    Merge(
                        Cylinder(
                            Vector(LGBW / 2 + LGCS, LGBW + LGCS,
                                   -5 * LGPH - LGCS),
                            Vector(-LGCS, LGBW + LGCS, -5 * LGPH - LGCS),
                            LGCS),
                        Cylinder(
                            Vector(-LGBW / 2 + LGCS, 1.5 * LGBW - LGCS,
                                   -5 * LGPH - LGCS),
                            Vector(-LGBW / 2 + LGCS, 2 * LGBW - LGWW + LG_E,
                                   -5 * LGPH - LGCS), LGCS),
                        Cylinder(
                            Vector(LGBW / 2 + LGCS, LGBW + LGCS,
                                   -6 * LGPH + LGCS),
                            Vector(-LGCS, LGBW + LGCS, -6 * LGPH + LGCS),
                            LGCS),
                        Cylinder(
                            Vector(-LGBW / 2 + LGCS, 1.5 * LGBW - LGCS,
                                   -6 * LGPH + LGCS),
                            Vector(-LGBW / 2 + LGCS, 2 * LGBW - LGCS,
                                   -6 * LGPH + LGCS), LGCS),
                        Box(
                            Vector(LGBW / 2 + LGCS + LG_E, LGBW + LGCS,
                                   -2 * LGBH),
                            Vector(-LGBW / 2, LGBW + LGWW,
                                   -2 * LGBH + LGCS + LG_E)),
                        Box(
                            Vector(-LGBW / 2 + LGCS, LGBW + LGCS, -2 * LGBH),
                            Vector(-LGBW / 2 + LGWW, 2 * LGBW - LGCS,
                                   -2 * LGBH + LGCS + LG_E)),
                        Box(
                            Vector(LGBW + LGCS, 2 * LGBW - LGCS, -5 * LGPH),
                            Vector(-LGBW / 2 + LGCS, LGBW + LGCS,
                                   -2 * LGBH + LG_PLATE_INNER_HEIGHT)),
                        Box(
                            Vector(LGBW / 2 + LGCS + LG_E, LGBW,
                                   -5 * LGPH - LGCS),
                            Vector(-LGBW / 2, LGBW + LGWW, -2 * LGBH + LGCS)),
                        Box(
                            Vector(-LGBW / 2, LGBW + LGCS, -5 * LGPH - LGCS),
                            Vector(-LGBW / 2 + LGWW, 2 * LGBW - LGCS,
                                   -2 * LGBH + LGCS)),
                    ),
                    Cylinder(Vector(-LGBW / 2, LGBW, -2 * LGBH - LG_E),
                             Vector(-LGBW / 2, LGBW, -5 * LGPH + LG_E),
                             LGBW / 2),
                ),
                Cylinder(
                    Vector(LGBW / 2, 1.5 * LGBW,
                           -5 * LGPH - LG_TOP_HEIGHT + LG_E),
                    Vector(LGBW / 2, 1.5 * LGBW, -2 * LGBH),
                    LG_KNOB_INNER_RADIUS),
                Cylinder(Vector(LGBW, LGBW, -5 * LGPH - LG_TOP_HEIGHT + LG_E),
                         Vector(LGBW, LGBW, -2 * LGBH), LG_KNOB_INNER_RADIUS),
                Intersection(
                    Difference(
                        Merge(
                            Cylinder(
                                Vector(LGBW, 1.5 * LGBW, -5 * LGPH - LGCS),
                                Vector(LGBW, 1.5 * LGBW, -2 * LGBH + LGCS),
                                LGBW / 2),
                            Cylinder(Vector(LGBW, 1.5 * LGBW, -5 * LGPH),
                                     Vector(LGBW, 1.5 * LGBW, -2 * LGBH),
                                     LGBW / 2 - LGCS),
                        ),
                        Cylinder(
                            Vector(LGBW, 1.5 * LGBW,
                                   -5 * LGPH - LG_TOP_HEIGHT),
                            Vector(LGBW, 1.5 * LGBW, -2 * LGBH - LG_E),
                            LGBW / 2 - LGWW),
                    ),
                    Box(
                        Vector(LGBW, 1.5 * LGBW, -5 * LGPH + LGCS),
                        Vector(1.5 * LGBW + LG_E, 2 * LGBW + LG_E,
                               -2 * LGBH - LG_E)),
                ),
                Difference(
                    Merge(
                        Box(
                            Vector(LGBW, 2 * LGBW, -2 * LGBH + LGCS),
                            Vector(-LGBW / 2 + LGCS, 2 * LGBW - LGCS - LG_E,
                                   -LGCS)),
                        Box(Vector(LGBW, 2 * LGBW - LGWW, -2 * LGBH),
                            Vector(-LGBW / 2 + LGCS, 2 * LGBW - LGCS, 0)),
                    ),
                    Box(
                        Vector(LGBW + LG_E, LGBW / 2 + LG_E, LGCS + LG_E),
                        Vector(0, 0, -2 * LGBH),
                        Matrix(
                            Vector(1, 0,
                                   2 / LGBW * LGCS * sin(LG_ANGLE * pi / 180),
                                   0, 1, 0, -1 / 2, 0, 1,
                                   LGCS * (cos(LG_ANGLE * pi / 180) - 1),
                                   3 * LGBW / 2, -LGCS))),
                ),
                Box(Vector(-LGBW / 2, 2 * LGBW - LGCS, -5 * LGPH - LGCS),
                    Vector(-LGBW / 2 + LGCS + LG_E, 2 * LGBW - LGWW, -LGCS)),
                Intersection(
                    Merge(
                        Cylinder(Vector(0, 0, 0), Vector(0, 0, -LGCS - LG_E),
                                 LGBW / 2 - LGCS),
                        Cylinder(Vector(0, 0, -LGCS), Vector(0, 0, -LGWW),
                                 LGBW / 2),
                    ),
                    Box(Vector(-LGBW / 2 - LG_E, -LGBW / 2 - LG_E, LG_E),
                        Vector(0, 0, -LGWW - LG_E)),
                    Translate(Vector(0, 1.5 * LGBW + 0.12, 0))),
                Intersection(
                    Merge(
                        Cylinder(Vector(0, 0, 0), Vector(0, 0, -LGCS - LG_E),
                                 LGBW / 2 - LGCS),
                        Cylinder(Vector(0, 0, -LGCS), Vector(0, 0, -LGWW),
                                 LGBW / 2),
                    ),
                    Box(Vector(LGBW / 2 - LG_E, LGBW / 2 - LG_E, LG_E),
                        Vector(0, 0, -LGWW - LG_E)),
                    Translate(Vector(0, 1.5 * LGBW, 0))),
                Box(Vector(LGBW / 2 - LGCS, LGBW + 0.12 + LGCS, 0),
                    Vector(0, 1.5 * LGBW, -LGCS - LG_E)),
                Box(Vector(LGBW / 2 - LGCS, LGBW + 0.12, -LGCS),
                    Vector(0, 1.5 * LGBW, -LGWW)),
                Box(Vector(-LGBW / 2 + LGCS, 2 * LGBW - LGCS, 0),
                    Vector(0, 1.5 * LGBW + 0.12, -LGCS - LG_E)),
                Box(Vector(-LGBW / 2, 2 * LGBW - LGCS, -LGCS),
                    Vector(0, 1.5 * LGBW + 0.12, -LGWW)),
                Object(
                    lg_tech_knob_logo_clear(),
                    Rotate(Vector(0, 0, 90)),
                    Scale(Vector(1, 1 - 2 * mir, 1)),
                    Translate(Vector(0, 1.5 * LGBW, 0)),
                ),
                mirmatrix))

    result.append(
        Merge(
            Cylinder(
                Vector(3 * LGBW / 2 - LGCS, 3 * LGBW / 2, -5 * LGPH - LGCS),
                Vector(3 * LGBW / 2 - LGCS, -3 * LGBW / 2, -5 * LGPH - LGCS),
                LGCS),
            Cylinder(
                Vector(3 * LGBW / 2 - LGCS, 3 * LGBW / 2, -2 * LGBH + LGCS),
                Vector(3 * LGBW / 2 - LGCS, -3 * LGBW / 2, -2 * LGBH + LGCS),
                LGCS),
            Cylinder(Vector(LGBW / 2 - LGCS, 3 * LGBW / 2, -LGCS),
                     Vector(LGBW / 2 - LGCS, -3 * LGBW / 2, -LGCS), LGCS),
            Cylinder(
                Vector(LGBW / 2 - LGWW / 2 + LGCS, LGBW + 0.12 + LGCS, -LGCS),
                Vector(LGBW / 2 - LGWW / 2 + LGCS, -LGBW - 0.12 - LGCS, -LGCS),
                LGCS),
            Cylinder(Vector(LGBW / 2 + LGCS, LGBW + LGCS, -2 * LGBH + LGCS),
                     Vector(LGBW / 2 + LGCS, -LGBW - LGCS, -2 * LGBH + LGCS),
                     LGCS),
            Cylinder(Vector(LGBW / 2 + LGCS, LGBW + LGCS, -5 * LGPH - LGCS),
                     Vector(LGBW / 2 + LGCS, -LGBW - LGCS, -5 * LGPH - LGCS),
                     LGCS),
            Box(Vector(LGBW / 2 + LGCS, LGBW + LGWW, -2 * LGBH),
                Vector(LGBW / 2 + LGWW, -LGBW - LGWW,
                       -2 * LGBH + LGCS + LG_E)),
            Box(
                Vector(1.5 * LGBW - LGCS, 1.5 * LGBW, -2 * LGBH),
                Vector(1.5 * LGBW - LGWW, -1.5 * LGBW,
                       -2 * LGBH + LGCS + LG_E)),
            Box(Vector(LGBW / 2, LGBW + LGWW, -5 * LGPH - LGCS),
                Vector(LGBW / 2 + LGWW, -LGBW - LGWW, -2 * LGBH + LGCS)),
            Box(Vector(1.5 * LGBW, 1.5 * LGBW, -5 * LGPH - LGCS),
                Vector(1.5 * LGBW - LGWW, -1.5 * LGBW, -2 * LGBH + LGCS)),
            Box(
                Vector(1.5 * LGBW - LGCS, 1.5 * LGBW, -5 * LGPH),
                Vector(LGBW / 2 + LGCS, -1.5 * LGBW,
                       -2 * LGBH + LG_PLATE_INNER_HEIGHT)),
            Difference(
                Merge(
                    Box(
                        Vector(LGBW / 2, 1.5 * LGBW, 0),
                        Vector(LGBW / 2 - LGWW, -1.5 * LGBW, -2.5 * LGPH),
                        Matrix(
                            Vector(1, 0,
                                   2 / LGBW * LGCS * sin(LG_ANGLE * pi / 180),
                                   0, 1, 0, -1 / 2, 0, 1,
                                   LGCS * (cos(LG_ANGLE * pi / 180) - 1), 0,
                                   -LGCS))),
                    Box(Vector(LGBW / 2 - LGCS, 1.5 * LGBW, 0),
                        Vector(LGBW / 2 - LGWW, -1.5 * LGBW, -LGWW / 2)),
                ),
                Union(
                    Box(Vector(LGBW / 2 - LGWW / 2, LGBW + 0.12 + LGCS, LG_E),
                        Vector(LGWW, -LGBW - 0.12 - LGCS, -LGWW - LG_E)),
                    Box(
                        Vector(LGBW / 2 - LGWW / 2 + LGCS,
                               LGBW + 0.12 + LGCS, LG_E),
                        Vector(LGWW, -LGBW - 0.12 - LGCS, -LGCS)),
                ),
            ),
            Difference(
                Merge(
                    Box(
                        Vector(LGBW / 2, 1.5 * LGBW, 0),
                        Vector(LGBW / 2 - LGWW, -1.5 * LGBW, -2.5 * LGPH),
                        # Matrix(
                        #     Vector(
                        #           1, 0,
                        #           2 / LGBW * LGCS * sin(LG_ANGLE * pi / 180),
                        #           0, 1, 0,
                        #           -1 / 2, 0, 1,
                        #           LGCS * (cos(LG_ANGLE * pi / 180) - 1),
                        #           0, -LGCS
                        #     )
                        # )
                    ),
                    Box(Vector(LGBW / 2 - LGCS, 1.5 * LGBW, 0),
                        Vector(LGBW / 2 - LGWW, -1.5 * LGBW, -LGWW / 2)),
                ),
                Union(
                    Box(Vector(LGBW / 2 - LGWW / 2, LGBW + 0.12 + LGCS, LG_E),
                        Vector(LGWW, -LGBW - 0.12 - LGCS, -LGWW - LG_E)),
                    Box(
                        Vector(LGBW / 2 - LGWW / 2 + LGCS,
                               LGBW + 0.12 + LGCS, LG_E),
                        Vector(LGWW, -LGBW - 0.12 - LGCS, -LGCS)),
                ),
                Translate(Vector(LGBW, 0, -2.5 * LGPH)),
            ),
            Cylinder(Vector(LGBW, 0, -5 * LGPH - LG_TOP_HEIGHT + LG_E),
                     Vector(LGBW, 0, -2 * LGBH), LG_KNOB_INNER_RADIUS),
        ),
        # Rotate(Vector(0, 0, -45))
    )

    return result
Beispiel #18
0
def standard_plate(
        length=1,
        width=1,
        height=LGPH,
        innerheight=LG_PLATE_INNER_HEIGHT
):
    """
    Standard plate brick.

    @Todo: fix plate column for 1x2 plate & bricks
    """
    return Union(
        Sphere(
            Vector(LGCS, LGCS, LGCS),
            LGCS
        ),
        Cylinder(
            Vector(LGCS, LGCS, LGCS),
            Vector(length * LGBW - LGCS, LGCS, LGCS),
            LGCS
        ),
        Sphere(
            Vector(length * LGBW - LGCS, LGCS, LGCS),
            LGCS
        ),
        Cylinder(
            Vector(length * LGBW - LGCS, LGCS, LGCS),
            Vector(length * LGBW - LGCS, LGCS, height - LGCS),
            LGCS
        ),
        Sphere(
            Vector(length * LGBW - LGCS, LGCS, height - LGCS),
            LGCS
        ),
        Cylinder(
            Vector(length * LGBW - LGCS, LGCS, height - LGCS),
            Vector(LGCS, LGCS, height - LGCS),
            LGCS
        ),
        Sphere(
            Vector(LGCS, LGCS, height - LGCS),
            LGCS
        ),
        Cylinder(
            Vector(LGCS, LGCS, LGCS),
            Vector(LGCS, LGCS, height - LGCS),
            LGCS
        ),
        Cylinder(
            Vector(LGCS, LGCS, LGCS),
            Vector(LGCS, width * LGBW - LGCS, LGCS),
            LGCS
        ),
        Sphere(
            Vector(LGCS, width * LGBW - LGCS, LGCS),
            LGCS
        ),
        Cylinder(
            Vector(LGCS, width * LGBW - LGCS, LGCS),
            Vector(LGCS, width * LGBW - LGCS, height - LGCS),
            LGCS
        ),
        Sphere(
            Vector(LGCS, width * LGBW - LGCS, height - LGCS),
            LGCS
        ),
        Cylinder(
            Vector(LGCS, LGCS, height - LGCS),
            Vector(LGCS, width * LGBW - LGCS, height - LGCS),
            LGCS
        ),
        Cylinder(
            Vector(length * LGBW - LGCS, LGCS, LGCS),
            Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGCS),
            LGCS
        ),
        Sphere(
            Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGCS),
            LGCS
        ),
        Cylinder(
            Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGCS),
            Vector(LGCS, width * LGBW - LGCS, LGCS),
            LGCS
        ),
        Cylinder(
            Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGCS),
            Vector(length * LGBW - LGCS, width * LGBW - LGCS, height - LGCS),
            LGCS
        ),
        Sphere(
            Vector(length * LGBW - LGCS, width * LGBW - LGCS, height - LGCS),
            LGCS
        ),
        Cylinder(
            Vector(length * LGBW - LGCS, width * LGBW - LGCS, height - LGCS),
            Vector(LGCS, width * LGBW - LGCS, height - LGCS),
            LGCS
        ),
        Cylinder(
            Vector(length * LGBW - LGCS, LGCS, height - LGCS),
            Vector(length * LGBW - LGCS, width * LGBW - LGCS, height - LGCS),
            LGCS
        ),
        Difference(
            Union(
                Box(
                    Vector(LGCS, LGCS, 0),
                    Vector(length * LGBW - LGCS, width * LGBW - LGCS, height)
                ),
                Box(
                    Vector(0, LGCS, LGCS),
                    Vector(length * LGBW, width * LGBW - LGCS, height - LGCS)
                ),
                Box(
                    Vector(LGCS, 0, LGCS),
                    Vector(length * LGBW - LGCS, width * LGBW, height - LGCS)
                ),
            ),
            get_knob_inner_space(length, width)
        ),
        get_cylinder(length, width, Union, innerheight),
        get_knob_objects(length, width, height),
        Translate(
            Vector(-length / 2 * LGBW, -LGBW, -height)
        ),
        Rotate(Vector(0, 0, 90))
    )