Skip to content

Viewpoint XML: write an enabled section box only as section_box - #133

Merged
mahach666 merged 1 commit into
IOExtend:mainfrom
menes97:fix/section-box-roundtrip
Nov 12, 2026
Merged

mahach666 merged 1 commit into
IOExtend:mainfrom
menes97:fix/section-box-roundtrip

Conversation

@menes97

@menes97 menes97 commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

Fixes #59

NwcXmlViewpointSerializer.Serialize wrote an enabled section box twice: its six planes into <clip_planes> and the box itself as <section_box>. The reader takes every <clip_plane> as a section plane and also restores the box, so each round trip added six more planes with indices 0..5.

<clip_planes> now holds only vp.SectionPlanes, and the box is written only as <section_box>, the first option in the issue. Deserialize is unchanged. Two consequences worth knowing:

  • A box-only viewpoint no longer writes <clip_planes> at all.
  • XML written by earlier versions still has the box planes in <clip_planes>, so reading it once still gives six extra planes. They stop multiplying after the next save.

I didn't add a marker for the box planes, because nothing in the repo reads them back from <clip_planes>: the IFC, BCF and clipper paths call SectionBox.ToSectionPlanes() themselves.

Test: Serialize_SectionBoxAndPlane_RoundTripsUnchanged (XmlViewpointSerializerTests) round-trips a viewpoint with an enabled box and one CreateTop plane at index 7 three times. Each time it checks that there is still one plane with the same index, normal, distance and alignment, and the same enabled box. Without the change there are 7 planes after the first round trip.

dotnet build NwcIO.slnx succeeds, and NwcIO.Tests passes locally: 228 passed, and 2 skipped because they need private Navisworks files (.NET 10.0.400 on Windows, with global.json pinned down to it temporarily; not committed).

🤖 Generated with Claude Code

Its six planes were also written to clip_planes, where the reader takes
every entry as a section plane, so each save and load added six more
planes with indices 0..5 next to the restored box.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mahach666
mahach666 merged commit 16f0b83 into IOExtend:main Nov 12, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Viewpoint XML round-trip duplicates section-box planes into SectionPlanes on every save/load

2 participants