Building practical AI
Deepak Kumar Tiwari

Deepak Kumar Tiwari

Technology & AI Leader · Building practical systems

Multimodal inspection / Guide 80

CAD Assembly Collision Verification Beyond Bounding Boxes

Build CAD assembly collision verification that separates AABB candidates from actual geometry checks, preserving assembly identity, coverage, and uncertainty.

Illustrative engineering guide. Examples are not client deployments, production-ready integrations, or evidence of measured results. Validate the design with your domain and security owners.

Reference workflow: Assembly revision and pose; Geometry coverage validation; Broad-phase pair candidates; Specialist narrow-phase checks; Reviewed engineering packet.
Reference workflow. Steps identify responsibilities, not necessarily separate agents. Branches and recovery paths are explained below. Open full-size diagram.

A hypothetical mechanical engineer asks an assistant to inspect an assembly screenshot and confirm that a bracket does not collide with a housing. The screenshot looks plausible. A quick bounding-box check then reports overlap, and the assistant reverses its answer to “collision confirmed.” Neither conclusion is justified: the image hides internal geometry, and the boxes may overlap while the actual parts remain separated.

CAD assembly collision verification needs a staged evidence pipeline. Candidate interpretation identifies which parts and pose deserve checking. Broad-phase geometry selects possible interactions. A specialist narrow-phase method evaluates actual geometry under documented tolerances. The output remains an engineering review packet, not a claim that the manufactured assembly will fit or operate safely under every condition.

Freeze Identity, Pose, and Coverage

Bind every run to assembly revision, configuration, part instance IDs, geometry digests, transform hierarchy, and pose. A part number alone is insufficient when several instances exist or when a configuration suppresses one component. Include omitted, suppressed, failed-to-import, and intentionally excluded parts in the coverage ledger. Missing geometry is unknown, not an empty region that automatically clears collision checks.

Record the assembly coordinate frame, axis directions, handedness, and units. Resolve local-to-world transforms before comparing bounds. A millimeter part loaded into a meter scene can yield spectacular but meaningless intersections. For a screenshot, retain original frame provenance, camera pose, render settings, and the assembly revision it depicts. Rendered pixels are orientation aids, not substitutes for authoritative geometry.

W3C PROV provides concepts for tracing source entities through processing activities. Use that lineage to connect tessellated meshes to their CAD solids and an interference report to the exact pose and engine version. A geometry digest proves which bytes were used; it does not prove that those bytes correctly represent the intended design or manufactured part.

Broad Phase Does Not Establish Collision

An axis-aligned bounding box encloses geometry along the chosen coordinate axes. Disjoint conservative boxes can eliminate a pair from an overlap search for that pose under stated assumptions. Overlapping boxes only identify a candidate pair. Hollow shapes, concave parts, diagonal members, and unused interior space make box overlap much less specific than actual mesh or solid intersection.

CGAL’s AABB tree manual explicitly describes testing bounding boxes during traversal and input primitives at the leaves. That distinction matters: using an AABB hierarchy to accelerate primitive queries is not equivalent to stopping at box overlap. The manual also warns about degenerate primitives. A geometry engine requires valid inputs and appropriate predicates; it is not infallible physical ground truth.

Narrow-phase checks should state whether they test surface intersection, solid penetration, minimum distance, or contact. Full containment may require solid-aware reasoning beyond surface crossings. Intended mating contact is not necessarily interference. IfcOpenShell’s geometry tree documentation illustrates distinct intersection, collision, and clearance queries in another geometry domain. Select the method appropriate to the CAD representation instead of treating every spatial query as the same test.

A Synthetic Broad-Phase Harness

This stdlib example tests the HARNESS, not a CAD engine, trained vision model, or actual mesh intersection. It validates assembly identity, part coverage, units, finite bounds, and an illustrative registration uncertainty limit. It produces only a narrow-phase requirement or a bounded broad-phase exclusion. The code never emits collision confirmed.

import math

base = {"assembly": "fixture-12", "revision": "r6", "pose": "closed",
        "parts": {"bracket-1", "housing-1"}, "coords": "assembly_world",
        "units": "mm", "uncertainty_mm": 0.05,
        "geometry_source": "synthetic-solids-r6", "frame": "render-r6-closed",
        "a": ((0, 0, 0), (4, 4, 4)),
        "b": ((3, 3, 3), (7, 7, 7))}

def broad_phase(record):
    if (record["assembly"], record["revision"], record["pose"]) != (
            "fixture-12", "r6", "closed"):
        return "identity_mismatch"
    if record["parts"] != {"bracket-1", "housing-1"}:
        return "coverage_unknown"
    error = record["uncertainty_mm"]
    if (record["coords"] != "assembly_world" or record["units"] != "mm"
            or not record["geometry_source"] or not record["frame"]
            or not math.isfinite(error) or not 0 <= error <= 0.1):
        return "measurement_unknown"
    a, b = record["a"], record["b"]
    for box in (a, b):
        if (len(box) != 2 or any(len(point) != 3 for point in box)
                or not all(math.isfinite(v) for point in box for v in point)
                or any(box[0][i] > box[1][i] for i in range(3))):
            return "invalid_bounds"
    overlap = all(a[0][i] - error <= b[1][i] + error
                  and b[0][i] - error <= a[1][i] + error for i in range(3))
    return "narrow_phase_required" if overlap else "broad_phase_excluded"

assert broad_phase(base) == "narrow_phase_required"
assert broad_phase(dict(base, b=((8, 8, 8), (9, 9, 9)))) == "broad_phase_excluded"
assert broad_phase(dict(base, revision="r5")) == "identity_mismatch"
assert broad_phase(dict(base, parts={"bracket-1"})) == "coverage_unknown"
assert broad_phase(dict(base, uncertainty_mm=0.2)) == "measurement_unknown"
assert broad_phase(dict(base, units="m")) == "measurement_unknown"
assert broad_phase(dict(base, a=((5, 0, 0), (4, 4, 4)))) == "invalid_bounds"
print("synthetic broad-phase checks passed; mesh intersection not tested")

Expanding each box by the supplied uncertainty is a conservative toy assumption about per-axis registration error. It is not a complete tolerance-stack calculation or probabilistic contact model. The fixture does not prove that boxes actually enclose their source geometry. Production must verify that contract, transform bounds correctly, and invalidate cached bounds whenever pose or geometry changes.

Review Geometry and Engineering Meaning

For each candidate pair, include part instance identities, original geometry references, transforms, broad-phase result, narrow-phase method, numerical tolerances, and unresolved coverage. If a geometry engine fails on one part, retain that failure in the packet. Do not silently drop the pair and report that the assembly has no collisions.

The construction drawing verification lab applies comparable identity and uncertainty controls to physical observations. For CAD review, the code review agent guide offers a useful workflow analogy: automated checks prepare evidence for a responsible reviewer rather than granting themselves merge or release authority. Here the reviewer must distinguish intended contact, design interference, and manufacturing allowance.

A geometry specialist earns its complexity when it runs genuine solid or mesh operations with inspectable settings. A second language model looking at the same screenshot does not provide independent measurement. For moving mechanisms, a static closed-pose check says nothing about the swept path. Sampled poses may miss collisions between samples; use an appropriate motion-aware method and document its assumptions before making broader claims.

Authenticate project access, isolate proprietary geometry by tenant, and treat CAD annotations as untrusted instructions. The sample omits file parsing, mesh generation, real transforms, narrow-phase computation, calibration, secure storage, and persistence. A model should not modify geometry or release manufacturing files because it found a likely correction. Limit output to approved advisory tickets, and reconcile uncertain ticket writes using the existing operation identity.

Acceptance Tests

  1. Use overlapping boxes around separated concave geometry and require narrow-phase investigation rather than confirming collision.
  2. Omit a required component and show unknown coverage instead of a clean assembly result.
  3. Change assembly revision or pose while reusing cached bounds and reject the stale comparison.
  4. Supply mismatched units, invalid bounds, or excessive uncertainty and abstain before pair classification.
  5. Make narrow-phase processing fail and retain the pair as unresolved rather than counting it as collision-free.
  6. Check one static pose and verify that the report does not claim clearance across the mechanism’s complete motion path.

Evaluate Pair Coverage Separately

Compare screenshot judgments and box-only classifications against specialist-adjudicated geometry cases. Measure candidate-pair recall over all confirmed interfering pairs, false candidate rate over narrow-phase-cleared pairs, and processed pair coverage over the declared part-and-pose scope. Report unsupported geometry and excluded configurations separately. A high success rate on imported parts can conceal the most difficult components being dropped.

Begin with one assembly configuration and mandatory mechanical review. Track corrections to part identity and contact interpretation before optimizing runtime. The first AI systems engineering task is to remove the label collision from every broad-phase-only result. A useful harness knows exactly when it has narrowed the search and exactly when it has not yet answered the engineering question.

Sources