Guide

How to design a 3D printed enclosure with AI

By Kai Jungsthöfel · November 3, 2026

An AI agent can design a printable enclosure around your electronics in an afternoon: standoffs, connector cutouts, vents and a lid that screws on. The result is only as good as the information you give it, so most of the work is preparing the dimensions and checking the fit before the first print.

What to prepare

Step by step

The steps use SOMA with a coding agent such as Claude Code or Codex. The general approach is in how to use AI for CAD.

  1. Start a new model and your agent. If you have STEP files of the board or other parts, add them with Import. The agent finds them in the model folder.
  2. Describe the enclosure with the dimensions from your preparation, see the example below. Ask the agent to place the board and other parts as reference parts: they are shown in the model but not exported for printing.
  3. Check the first version from all sides. Is every connector reachable? Does the lid cover what it should? Point at problems by clicking a part or drawing on the view.
  4. Cut it open. A section through each connector shows whether the opening lines up and whether the board sits on its standoffs.
  5. Explode it. Pulling the parts apart shows the assembly order: can you put the board in, then the lid, then the screws?
  6. Check for printing. The agent analyzes overhangs and wall thickness with the values of the 3D printing skill, SOMA shows problem areas in color. Fix them before slicing.
  7. Export each printed part as 3MF or STL. Print a test piece of the tightest area first, for example just the wall with the connectors.

An example prompt

A two-part enclosure for a Raspberry Pi 5 with its active cooler, printed in PETG with a 0.4 mm nozzle. 2 mm walls, 0.4 mm clearance around the board. The board sits on four standoffs for M2.5 screws in its 58 × 49 mm hole pattern. Openings for all ports on the board edges and for the microSD card. Vents in the lid above the cooler. The lid is held by four M3 screws into heat-set inserts in the base. Use the board's STEP file in inputs as a reference part. Make wall thickness, clearance and lid height parameters.

Every sentence answers a question the agent would otherwise have to guess. Requirements that should stay, such as the material or the screw type, go into the model's notes file, which the agent reads every time.

Rules of thumb for FDM printing

You do not have to type these into every prompt. SOMA gives the agent skills: sets of instructions for a topic, such as 3D printing, CNC or tolerances, which the agent reads when the topic comes up. The 3D printing skill brings these default settings:

SettingDefaultWhat it does
MaterialPLAPLA, PETG, ABS, ASA or TPU. The skill adjusts clearances and walls to it.
Nozzle and layer height0.4 mm, 0.2 mmWalls are planned as multiples of the nozzle width.
Build volume220 × 220 × 250 mmLarger parts are split, with pins or a lap joint.
Max. overhang without support45°Steeper faces are avoided, or the agent says where support is needed.
Max. bridge without support10 mmLonger flat ceilings get a different shape or support.
Minimum wall1.2 mmMore where the part carries load or holds screws.
Clearance per side for sliding fits0.3 mmFor lids and parts that slide or turn. PETG gets 0.1 mm more.

There are three ways to adapt them to your printer:

Beyond the settings, the skill tells the agent rules like these:

When the agent runs SOMA's printing check, it uses the same values: faces steeper than the overhang angle and walls thinner than the minimum show up in color. Values that come from your printer are worth one test print, for example a small lid and box to find the clearance that fits.

Check before you print

Example: a sensor logger enclosure

This desk enclosure for a sensor logger with a 2.8″ touch display (ESP32-S3) was designed with an agent in SOMA, starting from an existing CadQuery project. It holds the display board, a battery, four GX12 sensor sockets and three small boards, and is 152 × 88 × 52 mm.

3D printed sensor enclosure with a slanted display, three buttons in front and sockets at the back
Display set 2 mm into the slanted front, three button plungers below it, sensor sockets at the back.
Exploded view of the enclosure: cover, display board, middle frame with modules, base with buttons and screws
The exploded view shows the assembly order: base, middle frame with the electronics, cover, screws from below.

You can turn it, cut it open and explode it yourself on the models page.

Questions

Can AI design a case for my circuit board?

Yes. Give the agent the board size, hole pattern and the positions of the connectors, ideally as a STEP file of the board. It models the case around the board, with standoffs, cutouts and a lid. Check the connector cutouts and the fit before you print.

How do I get the connector positions right?

The best source is a STEP model of the board from the manufacturer, imported as a reference part. Without one, measure the board with calipers and give the agent the positions from one corner. Cut the model open at each connector to see if the opening lines up.

Which filament is best for electronics enclosures?

PLA is easy to print but gets soft above about 55 °C, which a closed case in the sun or next to warm electronics can reach. PETG or ASA hold up to more heat. Tell the agent the material: it affects wall thickness, clearances and how screws hold.

Can AI design snap-fit lids?

Yes, but snap fits depend heavily on the material and the printer. Screws or heat-set inserts are more forgiving for a first version. If you want a snap fit, ask for the hook as a parameter and print a test piece.

Should I export STL or 3MF?

Both work in common slicers. 3MF keeps units and several parts in one file, STL is supported everywhere. Export each printed part as its own file so you can orient and slice them separately.

Try it

SOMA is free and open source. Bring the agent you already use.