Repository navigation
Civil read ops: civil_station_offset and civil_surface_stats - #3413
Merged
HakanSeven12 merged 2 commits intoNov 22, 2026
Merged
Conversation
added 2 commits
November 21, 2026 15:07
Two read-only query ops over the decoded civil records, in the same op/query family the MCP ocs_read facade and the headless automation server serve: - civil_station_offset: the point at an alignment's station, offset perpendicular across it (positive right of travel, the way Civil 3D offsets run). The station is the one Civil 3D shows — past a station equation it runs on from the station ahead. Curves read along their arcs at the curvature the codec solved; spirals read from the codec's solved points. - civil_surface_stats: a TIN surface's elevation bounds and triangulation counts, over the vertices its visible triangles draw. Both answer from already-decoded data; nothing writes, selects or rebuilds.
"offset" is a pagination keyword across the read surface; the civil op takes its own "offset_distance" so the two never share a key. Also pin the tool-schema digest for the two new read ops.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Two read-only query ops on the existing op/query surface (the family
query,measure,recordsand the merged civil class-name filter #3389 live in), served by the headless automation server, the versioned control envelope, and the MCPocs_readfacade:{"op":"civil_station_offset","handle":"<hex>","station":<number>,"offset_distance":<number, optional, default 0>}→
{"ok":true,"handle","station","offset","raw_station","point":[x,y]}The point at an alignment's station, offset perpendicular across it. The station is the one Civil 3D shows — past a station equation it runs on from the station ahead (inverted from the codec's
display_station). Curves are measured and interpolated along their arcs at the curvature the codec solves (the same accounting as the codec's own station runs); spirals read from the codec's solved points.offset_distanceis signed across the alignment, positive right of travel, so the pagination keywordoffsetstays untouched.{"op":"civil_surface_stats","handle":"<hex>"}→
{"ok":true,"handle","min_elevation","max_elevation","vertices","triangles","visible_triangles"}A TIN surface's elevation bounds over the vertices its visible triangles draw (hidden/deleted triangles and the four bounding-corner vertices carry no drawn elevation), falling back to the stored snapshot triangulation.
Both answer from already-decoded
ArchEntityDataonly — nothing writes, selects or rebuilds, and the new code lives in one module (src/app/civil_query.rs) with unit tests for the geometry (line/arc interpolation, piece joins, station-equation inversion, drawn-triangle bounds).Verification (read-only, DE_Busbucht_2023.dwg)
Fresh API oracle captured live via the AEC Pilot bridge (
open_drawing readOnly:true→Alignment.PointLocation/ TinSurface enumeration →get_civil_contextbefore/after identical → close without saving), then the same file driven through a host built from this branch over the MCP bridge (scratch copy, no save):202BBA5"Blumenstrasse")PointLocationStraights and the alignment end are exact; the residual ≤ 3e-6 m on curve stations is the codec's own solved-geometry sampling, the same geometry the app draws. On the offset alignment
202BC2F("Blumenstrasse-Links-3.750") the op returns the codec's solved geometry faithfully, which drifts from the API by up to ~4 cm toward the far end — that divergence is in the codec's solve of that record (its solved length is 963.1486 vs the API's 963.1012), reported here for the codec-tracking ledger, not hidden.Surface
202B9DF"1. Urgelände": the op returns min 474.73, max 487.36 — exactly the live API values — withvisible_triangles1106 exactly the API's triangle count.vertices573 /triangles1140 are the codec's decoded totals (the known +4 corner-vertex / +34 hidden-triangle divergence row).Read-only proof: after running every op on the opened drawing, the class census (
query type:"AECC_ALIGNMENT"6 /type:"AECC_TIN_SURFACE"1) is identical before/after, total entities stay 12,870 (722 Extended), and documentrevision(0) andgeometry_revision(14) are unchanged — no decode drift, no mutation.Notes
TOOL_SCHEMA_DIGESTre-pinned for the two new read ops (deliberate, per the test's instruction);stationandoffset_distancejoin theocs_readparameter schema,offsetstays pagination-only.cargo test --workspace --lockedgreen (7,591 passed / 0 failed).