Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/draftwright/annotations/orchestrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@
from draftwright.annotations.leaders import drain_feature_leaders
from draftwright.annotations.sections import (
_add_section_view,
_clear_section_reservation,
_request_prismatic_detail,
_reserve_section_row,
_resolve_details,
Expand Down Expand Up @@ -442,6 +443,17 @@ def drain_and_reconcile(ctx, dwg: DrawingPort) -> None:
reconcile_witness_labels(dwg)


def _retire_optional_section_reservations_for_pmi(ctx, dwg, sections) -> None:
"""Let source-owned PMI dimensions outrank provisional section ink."""
if any(
candidate.name.startswith("pmi_")
for batch in ctx.corridor_batch.values()
for candidate in batch["cands"]
):
for section in sections:
_clear_section_reservation(dwg, section)


def _concentric_bore_diams(a: Analysis) -> list:
"""Distinct bore diameters on the rotation axis, in z_diams order (#10).

Expand Down Expand Up @@ -914,6 +926,12 @@ def _s_drain():
# Now every corridor feeder pass has registered; solve each shared strip once
# (ADR 2 (was 0009)) with label reconciliation, before the
# section/detail views so they see the placed ladder as an obstacle.
# The cutting-plane reservation has already protected early hole callouts.
# Imported source-owned PMI has no alternative semantic representation;
# optional future section ink must not consume its dimension corridor.
# Keep the reservation in ordinary builds so their established section
# and callout layout remains stable.
_retire_optional_section_reservations_for_pmi(ctx, dwg, _sections)
drain_and_reconcile(ctx, dwg)

def _s_grooves():
Expand Down
26 changes: 26 additions & 0 deletions tests/test_feature_edit_replay.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,32 @@
from draftwright import build_drawing


def test_imported_pmi_retires_optional_section_reservation_before_drain(monkeypatch):
"""An authored dimension outranks provisional section ink at the shared solve."""
from types import SimpleNamespace

from draftwright.annotations import orchestrator

part = Box(60, 40, 20) - Cylinder(4, 30) - Pos(0, 0, 2) * Cylinder(7, 20)
reserved_before_pmi = []
seen = []

def queue_pmi(drawing, _model, _analysis, *, ctx):
reserved_before_pmi.append(
any(name.endswith("_reservation") for name in drawing.annotations())
)
ctx.corridor_batch["test-pmi"] = {"cands": [SimpleNamespace(name="pmi_y_test")]}

def inspect_drain(_ctx, drawing):
seen.append(any(name.endswith("_reservation") for name in drawing.annotations()))

monkeypatch.setattr(orchestrator, "render_pmi", queue_pmi)
monkeypatch.setattr(orchestrator, "drain_and_reconcile", inspect_drain)
build_drawing(part, pmi="annotate")
assert reserved_before_pmi == [True]
assert seen == [False]


class TestFeatureEditReplay:
"""Replay through the production annotation passes."""

Expand Down
Loading