All Tools

dsfab

The shared fabrication layer beneath the other data-sculpture tools. Takes geometry produced by tools like Semantic Form Sculptor and Dataset Topology Sculptor and turns it into printable, provenance-stamped output. A library, not a command-line tool.

dsfab on GitHub

  • Python
  • Fabrication
  • 3D Printing
  • Mesh
  • Library
  • Provenance

What it provides

dsfab sits between "I have a coloured mesh in memory" and "I have a fabricable file on disk with verifiable provenance." It is a shared dependency: tools that need to produce printable output import it rather than each implementing their own mesh pipeline.

Mesh export

Writes trimesh.Trimesh objects to four formats: PLY (per-vertex colour), OBJ (with MTL material file), STL, and 3MF. Each write returns the byte count and a SHA-256 digest.

Constraint fitting

fit_to_cube centres and scales any point set into a target build cube using bounding-box-midpoint centering, so skewed point clouds do not waste build volume. Geometry-agnostic: works on any set of 3D coordinates.

Printability validation

validate_printability checks for watertightness, manifold topology, consistent winding, and minimum feature size against the target build volume. Returns a structured result rather than raising, so callers decide how to handle failures.

Segmentation and provenance

segment_by_scalar partitions a mesh by a scalar field and render_legend_png produces a matching colour legend. write_manifest emits a SHA-256 manifest over normalised content, so any output traces back to its inputs and parameters.

Install

pip install dsfab

Requires Python 3.11 or newer. Dependencies: trimesh ≥ 4.0, numpy ≥ 1.26, matplotlib ≥ 3.8.

Tools that depend on dsfab (SFS, DTS) pull it automatically from PyPI. You only need to install it directly if you are building your own tool on top of the fabrication core.

Quick start

import trimesh
from pathlib import Path
import dsfab

mesh = trimesh.load("my_mesh.ply")
result = dsfab.write_mesh(mesh, Path("output.ply"), "ply")
print(f"Wrote {result.bytes} bytes, SHA-256: {result.sha256}")

Known limitations

  • glTF export is deferred to a later release.
  • Coloured 3MF round-trips correctly through trimesh. However, the m:colorgroup colour import path has not yet been independently confirmed in a slicer. If you rely on the colours surviving into your slicer, validate them in PrusaSlicer or Bambu Studio before a production print. The geometry is unaffected by this limitation; only the colour assignment in-slicer is uncertain.

Design notes

  • Presentation-agnostic: no stdout or stderr output, no sys.exit, no argv reads from library code. Callers own all I/O.
  • Deterministic output given the same inputs.
  • trimesh.Trimesh is the sole mesh type throughout the library. No parallel mesh representations.
  • 500 MB input cap. Path-traversal-safe file handling throughout.