Skip to content

Output formats

File For
<name>.py (always) the parametric source: change a Dims value, rebuild everything
.step editing in other CAD (Fusion, Onshape, FreeCAD, SolidWorks): an exact solid you can push/pull, fillet and cut, without feature history; changes there don't flow back to the script
.stl any slicer
.3mf slicers that read it (Bambu Studio, OrcaSlicer, PrusaSlicer); keeps units
.png 6-view preview, assembly render, section views
.glb binary glTF: web pages, three.js, Blender, Windows 3D Viewer, AR; one named, colored node per piece, in meters (glTF's unit) and Y-up (glTF's axes); a tessellated mesh, not an exact solid. Not in the default set: ask for it with formats="glb" or all
_print.md the print sheet: size, filament and time estimates, supports, tip-over, walls and infill, fits and hole compensation, assembly notes, for the slicer. Not in the default set: formats="print" or all
_hardware.json the declared whole-assembly hardware BOM: versioned JSON metadata, with variant and confirmation status; opt in with formats="hardware" or all
_bom.md the shopping list of the declared hardware: one table (Qty, Item, Specification, Used for, Source/link, Status), identical items merged, items without a confirmed specification marked check before ordering, and a total. Reads as plain text and renders on GitHub and in editors. Opt in with formats="bom" or all
_bom.csv the same list as CSV for a spreadsheet (Excel, Google Sheets) or a shopping cart: UTF-8 with a byte-order mark, RFC 4180 quoting, and cells that start with =, +, - or @ prefixed with ' so a spreadsheet never runs them as formulas. Opt in with formats="bom_csv" or all
_spec.md the replication spec of a part copied from a physical original: its MEASURE.md joined with the script's Dims (measured vs modeled, class, why changed) and the flags. Written only for a part with a MEASURE.md; opt in with formats="spec" or all
_view.glb, _view.html the 3D view: export writes one per variant (view=)

Bambu Studio: \"The 3mf file has invalid config, load geometry data only\"

That message is expected. The 3MF files are plain, standard 3MF (the shape, in millimeters) without a Bambu project config (printer, filament and plate settings). Click OK: the part loads normally and you slice it with your own settings. If a large part lands off the plate, use Arrange (A).

Pick them in your config (formats = ["3mf", "png"], see Settings), per run (b123d-print build --formats step,3mf), or with formats= on the MCP export tool. all means all ten (step, stl, 3mf, png, glb, print, hardware, bom, bom_csv, spec). Default: step, stl, 3mf and png. What to do with the files in the slicer: From part to print.

The download/pull format filter tells the text formats apart by name: print selects only *_print.md, hardware only *_hardware.json, bom only *_bom.md, bom_csv only *_bom.csv and spec only *_spec.md. Other outputs, such as traced outlines, remain available in an unfiltered whole-part download. out/README.md always comes along.

Where each file goes

Files go to parts/<name>/out/, sorted into folders by file name:

Folder Files
out/print/ .3mf, .stl, _print.md: what you open in the slicer
out/print/templates/ .3mf and .stl of fit-test templates
out/cad/ .step, .glb (including _view.glb)
out/images/ .png: previews, section views, before/after, compare, orientation, trace and highlight pictures
out/docs/ _bom.md, _bom.csv, _hardware.json, _view.html, trace outlines (_outline.json, _outline.py)
out/README.md a short index: what is where, which file to slice

A template's STEP goes to cad/ and its PNGs to images/, like any other. A variant's files carry its key as a suffix, and section views carry the plane and position (images/plate_2gang_to_1gang_xy2.45.png is the XY section at Z = 2.45). Parts exported before 0.3.11 had every file directly in out/; the next export (or any tool run on the part) moves them into their folders. Which of these files to keep: What to save.

3D view in the browser

Turn the part around in a browser before you print it, without a slicer. export makes one view per variant (its view= parameter: print, the default, shows the printable parts on the bed as they print, side by side; assembly shows assembly(d) with its stand-ins; none makes none):

  • parts/<name>/out/cad/<name>[_<variant>]_view.glb (or _assembly_view.glb): the model, one node per piece, each in its own color;
  • over HTTP, a signed view link: https://<server>/view/<workspace>/<expires>.<signature>/<name>/<name>_view. It opens the viewer page and needs no token; it expires with the download links (--link-ttl). download_part lists the view links again;
  • locally (stdio), parts/<name>/out/docs/<name>_view.html: one self-contained file, viewer and model inline. It opens from file://, works offline and loads nothing from the network, so you can mail it or keep it with the part. b123d-print view <name> writes the same file from the command line (--assembly, --variant, --parts, --open to open the browser too);
  • over SSH, the .glb comes home with b123d-print pull; then b123d-print view <name> on your machine writes the HTML.

The viewer shows the pieces in the part's own coordinates (millimeters, Z up, the bed at Z = 0) with: orbit (drag), pan (right-drag or shift-drag) and zoom (scroll or pinch); a list of the pieces with their sizes, to show or hide each one; the bed grid (10 mm squares); the overall size and extent in mm and an optional bounding box; a section plane across X, Y or Z with a slider (and flip); and iso, top, front and right views.

The 3D view of the esp_ir_blaster example: base and lid on the bed, the piece list, sizes in mm

The viewer is three.js (MIT), shipped inside the package, so the page needs no internet access, neither on the server nor in the browser. See Credits for its license.

Multi-colour parts (several bodies)

A part that prints in several filaments at once (text or a logo inlaid in a second colour, on an AMS, MMU or tool changer) is declared as bodies that print together:

from b123d_print import bodies

def build(d):
    ...
    return bodies(base=plate - letters, inlay=(letters, "white"))

Each keyword is a body, in order; its value is a shape, or (shape, colour) with any build123d colour (a name, "#rrggbb", an RGB tuple). Names are letters, digits, _ and - (they name files). It works as the single part, as one piece of a dict, or as a lazy piece, and survives Rot/Pos into print orientation. The inlay recipe makes the pocket and the inlay from one insert.

What each format does with it:

File A multi-body part
.3mf one object named after the file, with one part (a mesh) per body, named after the body and coloured, in order. Bambu Studio, OrcaSlicer and PrusaSlicer load it as one object with several parts: give each part its filament there. The colours are display colours (3MF base materials): slicers do not map them to filaments by themselves
.stl <name>.stl is the union (one solid, for a one-colour print); <name>_<body>.stl holds each body, to load together as one object's parts
.step a Compound whose children carry the body names and colours
.png, .glb each body in its own colour, with a legend (a node per body)
_print.md a Bodies (multi-colour) table (colour, volume, filament, Z range per body), the layers the bodies share, and how to give each part its filament

The checks treat the part as what the printer makes: overhangs, thin features, holes, bed edges, tip-over, the build volume and your own Wall and Probe checks run on the union of the bodies, so an inlay's floor is not an overhang and bodies that touch are not a gap. The automatic bodies check fails when two bodies overlap (the slicer would print the overlap in either filament), and warns on a body that touches no other (a pocket larger than its inlay, or a body floating) or that is narrower than one line width. It cannot tell whether an inlay fills all of its pocket: cut the pocket with the inlay itself.