XelToFab

Introduction

XelToFab — Design field post-processing pipeline

XelToFab converts scalar design fields and callable SDF functions into clean, fabrication-ready triangle meshes and contours. It handles optional SDF evaluation plus the full post-processing pipeline: preprocessing, mesh extraction, smoothing, repair, and quality analysis.

Pipeline progression: raw field → binary threshold → extracted mesh → smoothed mesh

What it does

Given either a scalar field (a numpy array) or an SDF function (analytical or neural), XelToFab:

  1. Evaluates SDF functions (optional) — sample analytical or neural SDFs on a uniform or octree-adaptive grid via process_from_sdf()
  2. Preprocesses grid fields (optional) — Gaussian smoothing, thresholding, morphological cleanup
  3. Extracts geometry — marching cubes, dual contouring, surface nets, or manifold3d (3D → triangle mesh) or marching squares (2D → contours)
  4. Smooths the result — Taubin or bilateral filtering to remove staircase artifacts
  5. Repairs the mesh (optional) — non-manifold fixing for watertight geometry
  6. Remeshes for quality (optional) — isotropic remeshing for FEA-ready elements
  7. Decimates to target (optional) — quadric edge collapse to reduce face count
XelToFab pipeline with optional SDF Function → SDF Evaluate intake feeding Field, then Preprocess → Extract → Smooth → Repair → Remesh → Decimate

Key features

  • Multi-format input — NumPy, MATLAB, VTK, HDF5, CSV
  • 2D and 3D — contour extraction or triangle mesh generation
  • Multiple field types — density fields, SDFs, occupancy fields, and neural field outputs
  • SDF function evaluation — process neural models and analytical SDFs directly via process_from_sdf() with optional octree acceleration
  • Quality metrics — aspect ratio, min angle, scaled Jacobian via PyVista
  • CLI and Python APIxtf command-line tool or import directly

Quick examples

From a grid file (density or SDF array):

from xeltofab import load_field, process, save_mesh

result = process(load_field("field.npy"))
save_mesh(result, "output.stl")

From an SDF function (neural model, analytical formula):

from xeltofab import process_from_sdf, save_mesh

def my_sdf(points):  # [N, 3] → [N] signed distances
    return np.linalg.norm(points, axis=1) - 1.0

result = process_from_sdf(my_sdf, bounds=(-2, -2, -2, 2, 2, 2), resolution=64)
save_mesh(result, "sphere.stl")

Next steps

Outline