STEP Overlay Promotion — Tiers and 2D/3D Parity ================================================ How an imported STEP file becomes traceable optical geometry in KrakenOS, why there are three different representations, and which row-level actions must remain available in the 3D inspector to match what the 2D surface table can already do. .. figure:: ../_static/knowledge_base/step_overlay_promotion/01_tier_flow.svg :width: 100% :alt: Tier 1, 2, 3 promotion flow Tier 1 (display-only STEP overlay) → Tier 2 (single STL-backed row) or Tier 3 (one analytic row per face) → trace-ready optical geometry. The tier choice changes how flipping, scene-placement handles, and physics tracing behave. .. contents:: :local: :depth: 2 Why three tiers --------------- Importing a STEP file from a vendor catalog gives you triangulated CAD geometry. KrakenOS has to bridge that to a sequential prescription that can be ray-traced. Each tier is a different point on the trade-off curve between *fast to import* and *physically rigorous*: * **Tier 1** keeps the STEP as a *display-only* overlay. Cheap and reversible — but rays don't trace through it. * **Tier 2** wraps the whole STEP body in a single ``SurfaceRow`` backed by an STL mesh. Rays trace against the rotated triangles, so it's a refractive/reflective solid in the scene, but interior surface curvatures are approximated by triangle facets. * **Tier 3** parses the STEP B-Rep, fits each analytic face (sphere, asphere, plane) to a true KrakenOS surface, and inserts one row per face. The lens traces as exact analytic surfaces — at the cost of needing a glass/material sequence and surfaces that the fitter recognises. Tier 1 — STEP overlay ~~~~~~~~~~~~~~~~~~~~~ Triggered by *Import Optical STEP* (and the corresponding LED / Camera / Lens slots). The STEP path is stored in ``editor.imported_optical_step_path`` (one slot per ``STEP_OVERLAY_LABELS = ("lens", "optical", "led", "camera")``), the mesh is tessellated for display, and the overlay carries placement state (``optical_step_rotation_x_deg``, ``optical_step_axis_offset_xy``, etc.). The 3D inspector renders it as an interactive body with **STEP rotation handles** (``_actor_step_rotate_map``) anchored at the overlay centroid. * Pickable: yes (face hover/selection works, axis-snap works). * Traceable: no — rays do not propagate through Tier 1 bodies unless an explicit physics preview is requested. * Handles: STEP rotation handles (X/Y/Z arcs about the overlay centroid). * Flippable: yes — a 180° rotation handle click rotates the overlay itself, but only the *visual* — until you promote, it's not in the trace. Tier 2 — STL optical-solid row ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Triggered by *Promote STEP to Optical Solid Row*, or automatically by ``_preserve_unpromoted_step_overlay`` when a slot is about to be reused for a different import. The current transformed mesh is saved to ``CAD_CACHE/promoted_step_overlays/