Find holes and faces of an STL
find_featuresLists cylindrical holes, bosses, and flat faces in an STL file with dimensions in mm, so you can inspect part features before topology optimization.
Instructions
List the holes, bosses and flat faces of an STL file, in mm. Read only: the file is read and nothing is written (CONTRACTS.md section 45).
stl_path: an STL file (a relative path starts at the work folder). About 4 s for a million triangles. A wrong input gives {"ok": false, "error": ...}.
A hole's point, axis, radius_mm and length_mm are the keys of a bore in interfaces (section 23).
holes: each cylindrical hole has id, point (the centre of the first end face), the unit axis, radius_mm, length_mm, end_point, depth (through, blind, closed or unknown), ends, arc_deg (the angle the wall covers), segments and chord_sag_mm (the facets lie that far inside the radius), fit (distance of the wall vertices to the circle) and coaxial_with (a stepped hole is two cylinders on one axis). Every hole is listed with its radius and fit, whatever its size.
bosses: convex cylinders (a shaft, a post), the same keys without depth.
flat_faces: planar regions, the largest first: normal (outward, unit), area_mm2, centroid, offset_mm.
mesh: faces, watertight, bounds_mm. A mesh that is not closed still gives what can be found (no repair).
method: numbers (each detection number as used) and counts. facts: plain sentences (an open mesh, a stepped hole, a feature near a limit, regions left out).
A hole whose wall joins a fillet, a tapered hole and a slot are not cylinders to this method.
Your STL as a region item of build_regions: {stl: {path: part.stl, plug_holes: [H1] or all, screw_holes: [H2] or all, ring_mm: 2}} (a relative path starts at the work folder; a growth box is one more item). Only a closed solid mesh is read (no repair). plug_holes fills those holes (ids stable for one file). screw_holes adds a frozen ring round each: t = 0.5 x d, at least 2 voxels, or ring_mm (a number, or {H2: 2}). {screw_ring: {path: part.stl, hole: H2}} is that ring as a fixed or load region. A mouth chamfer and a drill point stay.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| stl_path | Yes |