polyfoammesh.commercial.cad_healer
CAD defeaturing & healing — inspired by ANSA CAD Cleanup, SpaceClaim.
Provides automatic detection and repair of common CAD issues that prevent or degrade mesh generation:
Small feature detection (holes, fillets, chamfers, sliver faces)
Automatic hole filling
Narrow-face merging
STL watertight check and repair
Facet count reduction (decimation) with feature preservation
All operations preserve the original file — a healed copy is written to the case directory.
Classes
|
Automatic CAD healing and defeaturing. |
|
Summary of CAD healing operations performed. |
- class polyfoammesh.commercial.cad_healer.HealReport(original_faces=0, original_vertices=0, final_faces=0, final_vertices=0, holes_filled=0, degenerate_removed=0, watertight=False, operations=<factory>, warnings=<factory>)[source]
Bases:
objectSummary of CAD healing operations performed.
- Parameters:
- class polyfoammesh.commercial.cad_healer.CADHealer(thresholds=None)[source]
Bases:
objectAutomatic CAD healing and defeaturing.
Operates on
trimesh.Trimeshobjects. For file-level healing useheal_file()which reads → heals → writes.Usage:
healer = CADHealer() for mesh in meshes: report = healer.heal_mesh(mesh) healer.heal_file("input.step", "output.stl")
- heal_mesh(mesh)[source]
Apply all healing operations to a single mesh.
Returns a
HealReportsummarising what was done.- Return type:
- Parameters:
mesh (Trimesh)
- heal_meshes(meshes)[source]
Heal multiple meshes, returning a report per mesh.
- Return type:
- Parameters:
meshes (list[Trimesh])
- heal_file(input_path, output_path=None)[source]
Read a geometry file, heal all patches, optionally write.
- Parameters:
- Return type:
tuple[list[Trimesh] |None,list[HealReport]]- Returns:
(meshes, reports)— the healed meshes and a report per patch.