Skip to content

Need mesh↔shape deviation (Hausdorff) tool + ability to measure invalid/loose-face shapes #41

Description

@gsdali

Context

Using OCCTMCP to verify mesh→analytic-CAD reconstructions in OCCTReconstruct (the standing
mandatory-analytic-verification policy:
correctness must be proven by an independent OCCT MCP measurement, never a render). Two gaps blocked the check.

Gap 1 — no deviation / Hausdorff between a mesh and a shape

measure_distance returns minimum distance between two bodies. For a reconstruction overlapping its
source mesh that is ~0 and useless. What's needed to certify a reconstruction is the directed/symmetric
deviation field
: max and RMS distance from mesh→solid (missing material / under-coverage) and solid→mesh
(over-extension), ideally with the worst-point location. This is the single most important verification
metric for measured reconstruction and there's no tool for it.

Proposal: measure_deviation(fromBodyId, toBodyId, samples?){ meshToSolid: {rms,max,worstPoint}, solidToMesh: {rms,max,worstPoint} } (sample one body's surface, project to the other).

Gap 2 — import/measure tools hard-gate on validity, so an in-progress reconstruction can't be loaded

A reconstruction-in-progress is often a compound of loose analytic faces (not yet sewn into a valid
solid), and may contain a few invalid faces. Every normal entry point refuses it:

  • import_file (STEP) → Error: Failed to write BREP … Shape is invalid or empty
  • import_file with healOnImport:true → same
  • read_brep (after converting to BREP) → same

I had to fall back to execute_script and compute Shape.bounds / subShapes(ofType:.face) by hand to
get any measurement. The whole point of verification is to measure the imperfect output, so the
analysis path shouldn't require validity. Concrete asks:

  • import_file / read_brep: a force/allowInvalid flag that loads the shape as-is (compound/shell)
    without the BREP-rewrite validity gate, so compute_metrics (bbox/principalAxes), validate_geometry,
    and the proposed measure_deviation can run on it.
  • compute_metrics should work on a loose-face compound (bbox/area at least).

Repro

  • Source mesh: Fixtures/body_0_fixed.stl (valid)
  • Reconstruction: 318-face loose-face STEP from reify … --nose-analytic whole trim (valid=false)
  • import_file the STEP → "Shape is invalid or empty". The mesh imports fine; the reconstruction can't be loaded to be measured against it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions