Skip to content

BASIC / PLASTIC-ENCLOSURE-PI

Plastic Enclosure Pi

Raspberry Pi 4 case with connectors, vents and engraving

Built in SolidCraft 0.49.0 37 commands

Model preview

Plastic Enclosure Pi SolidCraft build

Reconstructs the Raspberry Pi 4 video using a rounded open-top shell, mounting bosses, connector cuts, floor vents, Pi 4 lettering and PETG material.

Key dimensions: 95 × 66 × 24 mm; R5; PETG; 4 × M2.5 standoffs

Open in SolidCraft Web

The editable .sc model is loaded directly from the accepted build branch.

SCPF source

The exact SCPF Python source declared by this build variant.

scpf/model.py
class PlasticEnclosurePi:
    # SolidCraft 0.8 Raspberry Pi 4 video: board 85 × 56, case +10 mm.
    board_w = 85.0
    board_d = 56.0
    height = 24.0
    wall = 2.0

    def build(self):
        width = self.board_w + 10.0
        depth = self.board_d + 10.0
        enclosure = Box(width, depth, self.height, anchor=Anchor.BOTTOM)
        enclosure = enclosure.fillet(5.0, edges=Edges.VERTICAL)
        enclosure = enclosure.shell(self.wall, open=Faces.TOP)

        # The video rounds one upper rim edge, R1.
        enclosure = enclosure.fillet(
            1.0, edges=[(0, half(depth), self.height)]
        )

        # Board mounting holes: one corner 3.5 mm in from board edges,
        # then a 58 × 49 mm rectangular pattern. Native screw bosses.
        for x, y in (
            (-39.0, -24.5),
            (19.0, -24.5),
            (-39.0, 24.5),
            (19.0, 24.5),
        ):
            boss = Boss(d=6.0, h=4.0, hole_d=2.5).attach(
                enclosure, parent=Anchor.INNER_BOTTOM, offset=(x, y)
            )
            enclosure = enclosure + boss

        # Front (-Y): USB-C and two micro-HDMI openings.
        # Local XZ coordinates are (world X, world Z). A negative
        # extrusion points into the case from the front face.
        with Sketch(
            name="Pi ports", on=enclosure, plane="XZ",
            origin=(0, -(half(depth)), 0),
        ) as ports:
            for x, half_width in ((-31.3, 5.0), (-16.5, 4.0), (-3.0, 4.0)):
                ports.add(
                    Rectangle2D(half_width * 2, 4.0),
                    offset=(x - half_width, 7.5),
                )
        enclosure = enclosure - ports.extrude(-self.wall)

        # Right (+X) end: the combined USB-A and Ethernet window.
        # Local YZ coordinates are (world Y, world Z).
        with Sketch(
            name="USB and Ethernet", on=enclosure, plane="YZ",
            origin=(half(width), 0, 0),
        ) as end_ports:
            end_ports.add(Rectangle2D(50.0, 14.0), offset=(-25.0, 8.0))
        enclosure = enclosure - end_ports.extrude(-self.wall)

        # Five separate slots, spaced 7 mm along X, through the floor.
        with Sketch(
            name="Floor vents", on=enclosure, plane="XY",
            origin=(0, 0, self.wall),
        ) as vents:
            for i in range(5):
                vents.add(
                    Rectangle2D(5.0, 28.0),
                    offset=(-22.0 + i * 7.0, -16.5),
                )
        enclosure = enclosure - vents.extrude(-self.wall)

        # Recess "Pi 4" 0.6 mm into the inner floor of the case.
        with Sketch(
            name="Pi 4 engraving", on=enclosure, plane="XY",
            origin=(0, 0, self.wall),
        ) as label:
            label.add(
                Text2D("Pi 4", height=6.0, font="DejaVu Sans Bold"),
                offset=(-9.0, 18.0),
            )
        enclosure = enclosure - label.extrude(-0.6)

        # The recording assigns a physical design material, not just a color.
        enclosure = enclosure.with_material(
            "PETG", density_g_cm3=1.27, color="#2a8696"
        )
        return enclosure
SolidCraft command sequence 37 generated operations · expand to inspect
  1. parameters.add
    {
       "expression": "85",
       "name": "board_w",
       "unit": "mm"
    }
    
  2. parameters.add
    {
       "expression": "56",
       "name": "board_d",
       "unit": "mm"
    }
    
  3. parameters.add
    {
       "expression": "24",
       "name": "height",
       "unit": "mm"
    }
    
  4. parameters.add
    {
       "expression": "2",
       "name": "wall",
       "unit": "mm"
    }
    
  5. solid.box
    {
       "body_name": "PlasticEnclosurePi",
       "corner": [
          "-(board_w + 10 mm) / 2",
          "-(board_d + 10 mm) / 2",
          0
       ],
       "height": "height",
       "length": "board_w + 10 mm",
       "width": "board_d + 10 mm"
    }
    
  6. solid.fillet
    {
       "body": "PlasticEnclosurePi",
       "edges": [
          [
             -47.5,
             -33,
             12
          ],
          [
             47.5,
             -33,
             12
          ],
          [
             47.5,
             33,
             12
          ],
          [
             -47.5,
             33,
             12
          ]
       ],
       "radius": 5
    }
    
  7. model.faces
    {
       "body": "PlasticEnclosurePi"
    }
    
  8. solid.shell
    {
       "body": "PlasticEnclosurePi",
       "faces": [
          "$topology_face_name_1"
       ],
       "thickness": "wall"
    }
    
  9. solid.fillet
    {
       "body": "PlasticEnclosurePi",
       "edges": [
          [
             0,
             33,
             24
          ]
       ],
       "radius": 1
    }
    
  10. plastic.boss
    {
       "body": "PlasticEnclosurePi",
       "diameter": 6,
       "height": 4,
       "hole_diameter": 2.5,
       "position": [
          -39,
          -24.5,
          2
       ]
    }
    
  11. plastic.boss
    {
       "body": "PlasticEnclosurePi",
       "diameter": 6,
       "height": 4,
       "hole_diameter": 2.5,
       "position": [
          19,
          -24.5,
          2
       ]
    }
    
  12. plastic.boss
    {
       "body": "PlasticEnclosurePi",
       "diameter": 6,
       "height": 4,
       "hole_diameter": 2.5,
       "position": [
          -39,
          24.5,
          2
       ]
    }
    
  13. plastic.boss
    {
       "body": "PlasticEnclosurePi",
       "diameter": 6,
       "height": 4,
       "hole_diameter": 2.5,
       "position": [
          19,
          24.5,
          2
       ]
    }
    
  14. sketch.create
    {
       "name": "Pi ports",
       "plane": {
          "origin": [
             0,
             -33,
             0
          ],
          "x_dir": [
             1,
             0,
             0
          ],
          "y_dir": [
             0,
             0,
             1
          ]
       }
    }
    
  15. sketch.rectangle.two_point
    {
       "p0": [
          -41.3,
          5.5
       ],
       "p1": [
          -31.299999999999997,
          9.5
       ]
    }
    
  16. sketch.rectangle.two_point
    {
       "p0": [
          -24.5,
          5.5
       ],
       "p1": [
          -16.5,
          9.5
       ]
    }
    
  17. sketch.rectangle.two_point
    {
       "p0": [
          -11,
          5.5
       ],
       "p1": [
          -3,
          9.5
       ]
    }
    
  18. sketch.finish
  19. solid.extrude
    {
       "direction": "negative",
       "distance": "wall",
       "name": "Pi ports",
       "operation": "cut",
       "targets": [
          "PlasticEnclosurePi"
       ]
    }
    
  20. sketch.create
    {
       "name": "USB and Ethernet",
       "plane": {
          "origin": [
             47.5,
             0,
             0
          ],
          "x_dir": [
             0,
             1,
             0
          ],
          "y_dir": [
             0,
             0,
             1
          ]
       }
    }
    
  21. sketch.rectangle.two_point
    {
       "p0": [
          -50,
          1
       ],
       "p1": [
          0,
          15
       ]
    }
    
  22. sketch.finish
  23. solid.extrude
    {
       "direction": "negative",
       "distance": "wall",
       "name": "USB and Ethernet",
       "operation": "cut",
       "targets": [
          "PlasticEnclosurePi"
       ]
    }
    
  24. sketch.create
    {
       "name": "Floor vents",
       "plane": {
          "origin": [
             0,
             0,
             2
          ],
          "x_dir": [
             1,
             0,
             0
          ],
          "y_dir": [
             0,
             1,
             0
          ]
       }
    }
    
  25. sketch.rectangle.two_point
    {
       "p0": [
          -24.5,
          -30.5
       ],
       "p1": [
          -19.5,
          -2.5
       ]
    }
    
  26. sketch.rectangle.two_point
    {
       "p0": [
          -17.5,
          -30.5
       ],
       "p1": [
          -12.5,
          -2.5
       ]
    }
    
  27. sketch.rectangle.two_point
    {
       "p0": [
          -10.5,
          -30.5
       ],
       "p1": [
          -5.5,
          -2.5
       ]
    }
    
  28. sketch.rectangle.two_point
    {
       "p0": [
          -3.5,
          -30.5
       ],
       "p1": [
          1.5,
          -2.5
       ]
    }
    
  29. sketch.rectangle.two_point
    {
       "p0": [
          3.5,
          -30.5
       ],
       "p1": [
          8.5,
          -2.5
       ]
    }
    
  30. sketch.finish
  31. solid.extrude
    {
       "direction": "negative",
       "distance": "wall",
       "name": "Floor vents",
       "operation": "cut",
       "targets": [
          "PlasticEnclosurePi"
       ]
    }
    
  32. sketch.create
    {
       "name": "Pi 4 engraving",
       "plane": {
          "origin": [
             0,
             0,
             2
          ],
          "x_dir": [
             1,
             0,
             0
          ],
          "y_dir": [
             0,
             1,
             0
          ]
       }
    }
    
  33. sketch.text
    {
       "at": [
          -9,
          18
       ],
       "font": "DejaVu Sans Bold",
       "height": 6,
       "text": "Pi 4"
    }
    
  34. sketch.finish
  35. solid.extrude
    {
       "direction": "negative",
       "distance": 0.6,
       "name": "Pi 4 engraving",
       "operation": "cut",
       "targets": [
          "PlasticEnclosurePi"
       ]
    }
    
  36. material.create
    {
       "color": "#2a8696",
       "density_g_cm3": 1.27,
       "name": "PETG"
    }
    
  37. material.assign
    {
       "bodies": [
          "PlasticEnclosurePi"
       ],
       "material": "PETG"
    }
    

Build information

Build scope
main
Build variant
plastic-enclosure-pi
Physical owner
plastic-enclosure-pi
Built source
1f2fdb32d67d9af42779500c949f2900ee59c7ae
Forge
v0.23.0 ·
SolidCraft
0.49.0
Runtime
ghcr.io/brainboxemb/cad-solidcraft:v0.3.6