← Ecky CAD / Ecky Language Reference

REFERENCE / 05

Verify Clauses

Use verify when source should declare structural expectations explicitly.

(model
  (verify
    (tag plate_connected)
    (intent "The plate must be one connected mesh")
    (metric pieces (stl connected-component-count))
    (expect pieces (= 1)))
  (part plate (box 60 30 4)))
  • model verification is top-level under model
  • component-owned verification is the one exception: a verify clause may

sit directly inside define-component, before its geometry expression, and expands once per instance

  • one verify clause requires exactly one tag, metric, and expect
  • optional intent, severity, and when sections may each appear once
  • sections may be authored in any order; emitted source uses tag, intent,

severity, when, metric, expect

  • nested verify inside geometry or helper expressions is rejected
  • empty (verify) is rejected

tag

(tag body_shell body.front_window_1)
  • carries authored labels, ids, or references
  • payload stays opaque to compiler/core IR
  • useful for human grouping and later diagnostics

intent

(intent "Assembly must remain connected")
  • optional human explanation of the invariant
  • does not create a second requirement id; tag remains stable identity

severity

(severity error)
(severity warning)
  • omission means error
  • a failed error expectation blocks structural verification
  • a failed warning expectation stays visible but does not make the model red
  • invalid syntax, invalid conditions, and evaluation errors always block;

warning cannot hide a broken check

when

(when assembly-preview)
(when (and assembly-preview (not print-layout)))
  • optional boolean gate evaluated from effective render parameters
  • accepts booleans, boolean parameter names, and nested not, and, or
  • false returns explicit skipped evidence; metric and expectation do not run
  • unknown/non-boolean parameters, bad arity, and unknown operators are errors

metric

(metric check (manifest has-step))
(metric triangles (stl triangle-count))
(metric gap (clearance min-distance body.front_window_1 lid.front_skirt))
  • first item usually names local check alias
  • second item is metric expression
  • current runtime metric namespaces:
  • manifest
  • stl
  • clearance

Current shipped metric keys:

  • manifest has-step
  • manifest has-model-stl
  • manifest edge-target-count
  • manifest face-target-count
  • manifest export-format-count
  • manifest part-count
  • stl triangle-count
  • stl connected-component-count
  • stl non-manifold-edge-count
  • stl overhang-face-count
  • stl bed-contact-area-ratio [part-id]
  • stl bed-contact-x-span-ratio [part-id]
  • stl bed-contact-y-span-ratio [part-id]
  • clearance min-distance

Bed-contact ratios compare downward planar faces touching the lowest Z plane against all downward planar faces. Area ratio catches models whose nominal bottom is mostly suspended. X/Y span ratios catch models resting only on one small island, edge, or corner. Pass an optional part id to analyze that part's STL instead of the combined model STL.

clearance min-distance compares the minimum distance between two named selectors.

  • selectors can name parts, selection targets, or correspondence outputs
  • part selectors use manifest bounds
  • edge and face selectors use runtime mesh target geometry when available
  • unresolved selectors fail authored verify with a raw runtime error

expect

(expect check (= true))
(expect triangles (> 100))
  • first item should reference the metric alias used above
  • second item is comparator form
  • current shipped comparators:
  • =
  • >
  • >=
  • <
  • <=

A failed expectation records which metric missed its threshold. Inspect the measurement before changing geometry. Removing the check also removes the requirement it was meant to test.