Overnight Loop, Zero Polygon Pain

Our CAD exports used to land as six-million-triangle tangles, forcing us to burn two or three hours per part repairing holes and trimming razor-thin struts before any CFD could even start. That drudgery throttled us to a couple of design variants a week.

We wrote MeshDoctor — a lean C++20 tool that seals gaps, strips away non-functional geometry, and retessellates the surface through a single C-level call wired into our Git CI. Cleanup now finishes in under five minutes, triangle counts plunge by roughly seventy percent, solver wall-clock drops from seven hours to just over two, and nearly ten new variants roll out every week. Nights are finally for physics, not polygon surgery.

Common Questions

Q: What problem were we solving?
- Our STL exports were six-million-triangle beasts; manual cleanup took two–three hours per file and throttled us to a couple of CFD/FEA variants per week.

Q: What is MeshDoctor in one sentence?
- A lean C++20 pipeline that seals gaps, strips non-functional geometry and retessellates the surface, all callable from a single C-level function.

Q: How fast is it?
- Cleanup time dropped from hours to under five minutes, easily fitting inside an overnight CI loop.

Q: What measurable gains did we see?
- ~70 % fewer elements, solver wall-clock cut from 7 h 20 m to ~2 h, and our weekly design throughput jumped from two variants to nearly ten.

Q: Does it break downstream scripts?
- No—vertex IDs stay intact except in deleted regions, so existing boundary-condition scripts keep working.

Q: How hard was integration?
- One static library plus a CLI; we wired it into GitLab CI with a single command.

Q: Why write it ourselves instead of using off-the-shelf tools?
- Zero third-party dependencies means deterministic behaviour, tiny binaries and no vendor lock-in—perfect for a safety-critical, fast-iterating workflow.

Q: What’s next?
- We’re building on MeshDoctor’s curvature and thickness metrics to automate lattice-density optimisation and further slash print failures.

Contact Elf.3D to explore how custom mesh processing algorithms might address your unique challenges. We approach every conversation with curiosity about your specific needs rather than generic solutions.

*Interested in discussing your mesh processing challenges? We'd be happy to explore possibilities together.*

Bespoke Algorithms Unlocked Overnight Simulation


When a three-engineer startup building lattice-based heat-exchanger inserts found that mesh cleanup routinely out-paced their CFD/FEA runs, they turned to Elf.3D. By supplying a from-scratch, modern-C++ pipeline—exposed through a minimal C interface—we slashed manual pre-processing from hours to minutes, cut element counts by 70 %, and turned a weekly design sprint into a nightly optimisation loop.

The Problem Landscape


The client’s product is a family of patient-specific, additively manufactured heat-exchanger cores for small aerospace power units. Each core is a dense gyroid lattice wrapped in a thin shell; serial numbers, QA coupons and support tabs are embossed directly onto the print.

  • Manual bottleneck. Every CAD export landed as a 6–8 M-triangle STL riddled with logos, fillets and razor-thin struts. Cleaning a single file took one engineer two to three hours, eclipsing the two-hour solver run that followed.
  • Design cadence stalled. Because cleanup was manual, the team could push only one or two new geometries per week—far too slow for an aggressive optimisation roadmap.
  • Toolchain constraints. The shop runs a lightweight Git-based CI pipeline; any solution had to integrate via command-line calls and finish in under five minutes to fit an overnight loop.

Why They Picked Elf.3D


Elf.3D specialises in custom geometry algorithms—no third-party libraries, no generic kernels—built with the reliable core of modern C++ and wrapped in a plain-C API. That model gives small teams industrial-grade processing without vendor lock-in: they can drive every function from Python, Bash or any other language that can load a C DLL. Our three-step delivery method—understand → build & test → integrate—is laid out on our own site.

Key factors that sealed the deal:

  • Uncompromising bespoke code. Every line would target the client’s part family; zero outside dependencies meant deterministic behaviour and a tiny binary.
  • Direct access to experts. A short client list lets Elf.3D’s senior engineers stay on every stand-up call, “working shoulder-to-shoulder with our customers as a problem-solver.”
  • Geometry pedigree. Thirty-plus years of combined computational-geometry experience underpin our service promise.

Technical Blueprint — The MeshDoctor™ Pipeline

MeshDoctor™ at a Glance


table-1
Stage Task Method Outcome
Heal Close gaps, fix normals Automated repair sweep Watertight mesh
Detect Locate décor, thin struts Multi-scale dihedral scan Non-functional parts isolated
Clean Remove flagged faces Safe boolean delete Traceable geometry changes
Patch Fill & retessellate Minimal-area cap + local remesh Solver-ready surface

Implementation Details

  • Language & Safety. The entire pipeline is written in the stable subset of C++ 20—standard containers, value semantics, no exceptions across the C boundary. That subset is the same one adopted in many safety-critical frameworks; static analysis passes cleanly under multiple compilers.
  • Plain-C Interface. Every exported symbol follows the pattern `elf3d_mesh_op(ctx*, const elf3d_mesh*, elf3d_mesh*)`. Structures use POD layouts, so Python’s `ctypes` can marshal them with no glue code.
  • Deterministic memory. Algorithms avoid dynamic allocation hotspots; most work occurs in stage-local memory pools sized at startup. Re-runs under identical inputs are bitwise-reproducible—handy for validation audits.
Integrating into the Startup’s Pipeline

  • 1. Prototype in 10 days. A single static library plus `meshdoctor_cli` processed twenty historical STLs in < five minutes each, meeting the overnight target.
  • 2. CI Hook. The startup added one line to their GitLab YAML:
  • ```yaml
  • script:
  • - meshdoctor_cli --in "$STL" --out "$STL_CLEAN"
  • ```
  • 3. Solver Hand-Off. Because vertex IDs are preserved (except inside deleted regions), boundary-condition scripts continued to work with no edits.
  • 4. Validation. A diff log maps every deleted triangle, so engineers can visually confirm that only non-functional features were removed.
Quantifiable Impact

table-2
KPI Before MeshDoctor After MeshDoctor Delta
Manual clean-up per file 120–180 min < 10 min (visual check) –94 %
Surface triangles 6.8 M 2.4 M –65 %
Volume elements 25 M 8.1 M –68 %
Solver wall-clock 7 h 20 m 2 h 05 m –5 h 15 m
Design variants per week 2 9 – 10 ×4–5

By week four, the team had doubled its optimisation depth by inserting an extra nightly gradient step—an impossible dream when manual cleanup ruled the calendar.

Business Value Beyond the Numbers

  • Cash saved on compute. Trimming five hours off every solver run cut cloud HPC spend by ~60 %.
  • Fewer reprints. Because the same algorithm thickened thin struts automatically, failed builds dropped by 30 % in the first quarter.
  • Morale boost. Engineers now iterate on design, not polygons—a big retention lever in a talent-tight market.
Lessons for Other Small Teams

  • 1. Automate the obvious first. If an engineer can describe the cleanup rule in a sentence (e.g., “delete everything thinner than 0.2 mm”), code can do it faster.
  • 2. Preserve intent, not triangles. Our pipeline removes geometry only if it fails a client-defined relevance test; everything else stays byte-for-byte.
  • 3. Think language-agnostic. A C shim means your future workflow—whether in Python notebooks or batch scripts—won’t have to learn C++.
What’s Next for the Client

The startup’s next milestone is a fully automated lattice-density optimisation loop. MeshDoctor’s API already returns per-face curvature and thickness metrics; the optimiser will use these fields to vary cell size while respecting pressure-drop constraints. Future modules on our roadmap include:

  • Spectral segmentation for identifying flow channels.
  • GPU-accelerated distance fields for even faster thickness checks.
  • Parametric support-structure pruning tied to printer profiles.

About Elf.3D:

From booleans and offsetting to repairing, remeshing and full-blown simulation pre-processing, Elf.3D “develops 3D solutions, from concept to prototype, working shoulder-to-shoulder with our customers.” We deliver:

  • Bespoke algorithms—written in modern C++, no third-party dependencies.
  • Flexible integration—plain-C APIs, static libraries or low-footprint CLIs.
  • Senior-level attention—the people who write the code also answer your calls.