Repository navigation
Civil: write and read an empty TIN surface's shell (W2-2) - #656
Merged
Merged
Conversation
A surface the application has not built keeps no triangulation — only its shell: the four bounding corners at the drawing extremes, with no incident triangle and no triangles (the tutorials' Surface-2.dwg "EG", and the snapshot-only surface of Pipe Networks-3B.dwg). The reader refused the block (fewer than 7 vertices, zero triangles) and reported None, so a census of the drawing lost the surface; the writer had no way to add one. The reader now decodes the shell as a corner-only TinSurface (four vertices, no triangles) — empty, not None — and a snapshot of it the same way. The writer emits the app's own form for a surface with no data: add_empty_tin_surface, and add_tin_surface_with accepts definitions that bring no geometry (a snapshot-only surface) by storing the shell. Corners of a shell carry the bare corner flag (0x40) and -1 as their incident triangle, as the app stores them. Closes the D016 gap W2-2: the built Surface-2 now opens in Civil 3D with census 1 == 1 surfaces, audit clean, and the application reads the shell back as name EG, 0 vertices, 0 triangles — identical to the oracle.
Missed in b74c489: the civil::civil re-export references the new constructor, but the create-module export was left unstaged, breaking the crate build.
schoeller
force-pushed
the
surfparcel
branch
from
November 24, 2026 22:05
cef56d9 to
dcffaea
Compare
HakanSeven12
added a commit
that referenced
this pull request
Nov 24, 2026
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.
Closes the D016 gap W2-2 (and the folded W1-2 investigation) from the corpus packets.
Finding
A surface the application has not built keeps no triangulation — only a shell: the four bounding corners at the drawing extremes, each with
RL flags 0x40, RL -1and positions at the ±DBL_MAX extremes, thenBL 0triangles. Both records are in the tutorials corpus:Surface-2.dwg"EG" (the file's only surface): the app itself readsvertices=0 triangles=0(bridge probe), yet the codec reportedtin_surface() = Noneand the rebuilt file had 0 surfaces vs the oracle's 1.Pipe Networks-3B.dwgthird surface (W1-2): the same empty block stored twice withBL 0, BL 1, MMS01between — a snapshot-only empty surface (definitions decode as[Kind40(0)]). Same phenomenon, not a decode hole; the reader now surfaces it empty-not-None.Change
read_at): accept corner-only blocks —count >= 4(was 7) andtriangle_count == 0allowed whencount == 4. A shell decodes as aTinSurfacewith four vertices and no triangles (empty, notNone); a snapshot of one the same way. The probe fallback is protected by the exact-shape gate.Triangulation::empty()stores the app's own form; the triangulation closure writes -1 as a vertex's incident triangle when it has none (was 0 — latent) and the bare corner flag0x40on a shell (the app's form; built surfaces keep0x8440).add_empty_tin_surfaceadds a shell;add_tin_surface_withstores a shell for definitions that bring no geometry (reproducing the snapshot-only record), with an empty snapshot for a no-geometry prefix.Verification (corpus roundtrip, oracle = Civil Tutorials Drawings)
tin_surface count=1 names=["EG"]vs built 1 == 1, name identical;lwpolyline 85/85 BIT-EXACT; compare_verifytin_surface: 1 items BIT-EXACT; census{AcDbPolyline: 85, AeccDbSurfaceTin: 1}== oracle.AcDbPolyline=85 AeccDbSurfaceTin=1== oracle, and the app reads the built surfacetin name=EG vertices=0 triangles=0— identical to its read of the oracle.tin_surface() = Some(4, 0)andtin_snapshot() = Some(4, 0).Related open PRs: #655 (W1-5 COGO points, disjoint files). The W1-6 parcel re-measurement on this same tip is recorded in the campaign runlog: refusals unchanged (129/163, all "crosses or touches a member it may not meet"), no code change proposed.