Share vertex entities between triangles so edge loops are topologically closed - #18
Merged
Merged
Conversation
Copilot
AI
changed the title
[WIP] Fix issue with KOMPAS.exe reading step result error
Share vertex entities between triangles so edge loops are topologically closed
Aug 1, 2026
slugdev
marked this pull request as ready for review
August 1, 2026 17:26
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.
STEP files produced from STL meshes are rejected by strict readers (KOMPAS: "Link list is empty OR contains more than 2 items / corrupt file structure").
build_tri_bodysharedEDGE_CURVEentities between neighbouring triangles viaedge_map, but created three freshVERTEX_POINTentities per triangle. When triangle B reused an edge curve created by triangle A, that edge's endpoints were A's vertices while B's remaining edges used B's own vertices — so theEDGE_LOOPonly closed by coordinate, never by entity identity.On the model attached to the issue (194,886 triangles): 152,171 of 194,859 loops were disconnected, and the file held 584,577
VERTEX_POINTentities for 97,443 distinct locations.Changes
StepKernel::build_tri_body: vertices are looked up in a coordinate-keyedstd::mapand reused, mirroring whatbuild_tri_body_mergedalready does. Edges meeting at a point now reference one sharedVERTEX_POINT.test/check_vertex_sharing.cmake+vertex_sharingctest: convertscube.stlwithoutmergeplanar, asserts exactly 8VERTEX_POINTentities, and walks everyEDGE_LOOPchecking end-vertex id == next start-vertex id.After the change the issue's model yields 0 disconnected loops and 97,443 vertices (one per unique point); output size drops from 258 MB to 209 MB.
Not addressed
27 degenerate triangles in that model are still dropped, leaving 79 free edges. The shell is emitted as an
OPEN_SHELLinside aSHELL_BASED_SURFACE_MODEL, so this remains schema-valid and is left as-is.