Example #1
0
def _letter_l(lclass):
    """@Todo: ApiDoc."""
    return lclass(
        # Letter L
        Sphere(Vector(-59, 0, -96), 6),
        Cylinder(Vector(-59, 0, -96), Vector(59, 0, -122), 6),
        Sphere(Vector(59, 0, -122), 6),
        Cylinder(Vector(59, 0, -122), Vector(59, 0, -84), 6),
        Sphere(Vector(59, 0, -84), 6),
    )
Example #2
0
def _letter_o(lclass):
    """@Todo: ApiDoc."""
    return lclass(
        # Letter O
        Torus(18.45, 6, ClippedBy(Plane(Vector(40, 0, -9), 0)),
              Translate(Vector(-40, 0, 99))),
        Cylinder(Vector(-44.05, 0, 81), Vector(35.95, 0, 63), 6),
        Torus(18.45, 6, ClippedBy(Plane(Vector(-40, 0, 9), 0)),
              Translate(Vector(40, 0, 81))),
        Cylinder(Vector(44.05, 0, 99), Vector(-35.95, 0, 117), 6),
    )
Example #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)))))
Example #4
0
def _letter_e(lclass):
    """@Todo: ApiDoc."""
    result = lclass(
        # Letter E
        Sphere(Vector(-59, 0, -36), 6),
        Cylinder(Vector(-59, 0, -36), Vector(-59, 0, 1), 6),
        Sphere(Vector(-59, 0, 1), 6),
        Cylinder(Vector(0, 0, -49), Vector(0, 0, -25), 6),
        Sphere(Vector(0, 0, -25), 6),
        Sphere(Vector(59, 0, -62), 6),
        Cylinder(Vector(59, 0, -62), Vector(59, 0, -24), 6),
        Sphere(Vector(59, 0, -24), 6),
        Cylinder(Vector(-59, 0, -36), Vector(59, 0, -62), 6),
    )
    if LG_STUD_LOGO > 0:
        result.append(Translate(Vector(0, 0, 60)))
    return result
Example #5
0
 def test_create_open_wrong_type(self):
     """Test creation with kwarg wrong type."""
     with self.assertRaisesRegexp(SdlSyntaxException,
                                  'Value of keyword open is not boolean'):
         self.sut = Cylinder(Vector(1, 2, 3),
                             Vector(5, 6, 7),
                             8,
                             ObjectModifier('foo'),
                             open='foo')
Example #6
0
 def test_create_non_existant_kw(self):
     """Test creation wrong kwarg."""
     with self.assertRaisesRegexp(SdlSyntaxException,
                                  'Invalid keyword: bar'):
         self.sut = Cylinder(Vector(1, 2, 3),
                             Vector(5, 6, 7),
                             8,
                             ObjectModifier('foo'),
                             bar=True)
Example #7
0
def _letter_g(lclass):
    """@Todo: ApiDoc."""
    letter_g = lclass(
        # Letter G
        Sphere(Vector(-35.95, 0, 57), 6),
        Torus(18.45, 6, ClippedBy(Plane(Vector(40, 0, -9), 0)),
              Translate(Vector(-40, 0, 39))),
        Cylinder(Vector(-44.05, 0, 21), Vector(35.95, 0, 3), 6),
        Torus(18.45, 6, ClippedBy(Plane(Vector(-40, 0, 9), 0), ),
              Translate(Vector(40, 0, 21))),
        Cylinder(Vector(44.05, 0, 39), Vector(0, 0, 49), 6),
        Sphere(Vector(0, 0, 49), 6),
        Cylinder(Vector(0, 0, 49), Vector(0, 0, 34), 6),
        Sphere(Vector(0, 0, 34), 6),
    )
    if LG_STUD_LOGO > 0:
        letter_g.append(Translate(Vector(0, 0, -65)))
    return letter_g
Example #8
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
Example #9
0
 def test_create_obj_mod_wrong_type(self):
     """Test Only ObjectModifier objects may be passed as options."""
     with self.assertRaisesRegexp(
             SdlSyntaxException,
             'Only ObjectModifier objects may be passed as options'):
         self.sut = Cylinder(Vector(1, 2, 3),
                             Vector(5, 6, 7),
                             8,
                             'foo',
                             open=0.3)
Example #10
0
 def test_create_radius_wrong_type(self):
     """Test Param radius is not of type int or float."""
     with self.assertRaisesRegexp(
             SdlSyntaxException,
             'Param radius is not of type int or float'):
         self.sut = Cylinder(Vector(1, 2, 3),
                             Vector(5, 6, 7),
                             'foo',
                             ObjectModifier('foo'),
                             open=0.3)
Example #11
0
 def test_create_cpoint_wrong_length(self):
     """Test Cap point Vector has more or less than 3 dimensions."""
     with self.assertRaisesRegexp(
             SdlSyntaxException,
             'Cap point Vector has more or less than 3 dimensions'):
         self.sut = Cylinder(Vector(1, 2, 3),
                             Vector(5, 6, 7, 9),
                             8,
                             ObjectModifier('foo'),
                             open=0.3)
Example #12
0
 def test_create_cappoint_wrong_type(self):
     """Test Parameter cappoint is not of type Vector."""
     with self.assertRaisesRegexp(
             SdlSyntaxException,
             'Parameter cappoint is not of type Vector'):
         self.sut = Cylinder(Vector(1, 2, 3),
                             'foo',
                             8,
                             ObjectModifier('foo'),
                             open=0.3)
Example #13
0
    def test_creation_w_opt_and_kwarg(self):
        """Test creation and inheritance with option and kwarg."""
        self.sut = Cylinder(Vector(1, 2, 3),
                            Vector(5, 6, 7),
                            8,
                            ObjectModifier('foo'),
                            open=True)

        self.assertIsInstance(self.sut, Cylinder)
        self.assertIsInstance(self.sut, SceneItem)
Example #14
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)))))
Example #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))),
    )
Example #16
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)))
Example #17
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)))
Example #18
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
Example #19
0
 def setUp(self):
     """Set up fixture."""
     self.sut = Cylinder(Vector(1, 2, 3), Vector(5, 6, 7), 8)
Example #20
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)))
Example #21
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
Example #22
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
Example #23
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
Example #24
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))
    )
Example #25
0
        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)))))


# lg_brick_cylinder = get_lg_cylinder(Union, LG_BRICK_INNER_HEIGHT)
LG_PLATE_CYLINDER = get_lg_cylinder(Union, LG_PLATE_INNER_HEIGHT)

# brick inner cylinder to fit into hollow stud
LG_BRICK_COLUMN = Cylinder(Vector(0, 0, LG_BRICK_INNER_HEIGHT + LG_E),
                           Vector(0, 0, 0), LG_KNOB_INNER_RADIUS)

# plate inner cylinder to fit into hollow stud
LG_PLATE_COLUMN = Difference(
    Cylinder(Vector(0, 0, LG_PLATE_INNER_HEIGHT + LG_E), Vector(0, 0, 0),
             LG_KNOB_INNER_RADIUS),
    Cylinder(Vector(0, 0, 1), Vector(0, 0, -1), 0.06))

# wall between brick cylinder and brick wall
# LG_SUPPORT_WALL = Box(
#     Vector(-LG_CYLINDER_WALL_WIDTH / 2, -LG_E, 0.225),
#     Vector(
#         LG_CYLINDER_WALL_WIDTH / 2,
#         LG_BRICK_WIDTH - LG_CYLINDER_RADIUS - LG_WALL_WIDTH + LG_E,
#         LG_BRICK_HEIGHT
#     )
Example #26
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
Example #27
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))
    )