Skip to content

Fix #1386: geometry generation fails when creating a new CPACS file from the simpletest.cpacs.xml template#1387

Merged
svengoldberg merged 4 commits into
mainfrom
1386-geometry-generation-fails-when-creating-a-new-cpacs-file-from-the-simpletestcpacsxml-template
Jul 17, 2026
Merged

Fix #1386: geometry generation fails when creating a new CPACS file from the simpletest.cpacs.xml template#1387
svengoldberg merged 4 commits into
mainfrom
1386-geometry-generation-fails-when-creating-a-new-cpacs-file-from-the-simpletestcpacsxml-template

Conversation

@joergbrech

@joergbrech joergbrech commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes #1386.

Opening the TIGLCreator template TIGLCreator/data/templates/simpletest.cpacs.xml failed to generate geometry after #1367 switched the template's fuselage "Circle" profile from a pointList to a standardProfile/rectangle (heightToWidthRatio=1, cornerRadius=0.5).

That combination is the degenerate limit where a rounded rectangle becomes a pure circle: all four straight edges of the rectangle collapse to zero length. BuildWireRectangle (src/common/tiglcommonfunctions.cpp) didn't special-case this, so it still built a zero-length line segment for each straight edge and fed it into CTiglBSplineAlgorithms::concatCurves alongside the four quarter-circle arcs. Concatenating those degenerate segments produced knots that ended up closer together than OpenCASCADE's internal tolerance, and OCCT throws Standard_Failure: BSpline curve: Knots interval values too close.

Fix: BuildWireRectangle now skips adding a straight edge whenever its two endpoints coincide, instead of feeding a zero-length segment through the interpolation/concatenation pipeline. At the circle limit this correctly reduces to a wire built purely from the four quarter-circle arcs.

Finally, the scaling of the fuselage had to be adapted to obtain the same Sodacan-geometry we are all accustomed to. With the standard profile the radius was decreased.

This PR was co-authored with Claude Code and thoroughly checked by me.

How Has This Been Tested?

  • Added TiglCommonFunctions.BuildWireRectangle_FullCircleLimit in tests/unittests/tiglCommonFunctions.cpp, which reproduces the exact degenerate input (heightToWidthRatio=1, cornerRadius=0.5) used by the template. Before the fix this test throws Standard_Failure: BSpline curve: Knots interval values too close; after the fix it builds a valid, closed wire and lofts successfully.
  • Verified end-to-end by opening TIGLCreator/data/templates/simpletest.cpacs.xml directly and building both the fuselage and wing lofts — both now produce valid geometry (BRepCheck_Analyzer(...).IsValid()).
  • Ran the full unit test suite (pixi run -e default unittests): all 899 tests pass, no regressions (including the existing FuselageStandardProfile.* and TiglCommonFunctions.BuildWireRectangle_* cases covering non-degenerate rectangle/rounded-rectangle profiles).

Screenshots, that help to understand the changes(if applicabl

N/A (non-visual fix in geometry construction code).

Checklist for PR Author:

  • Unit or integration test added (if applicable)
  • Python interface updated (if applicable)
  • Python test added (if Python interface updated)
  • Doxygen docstrings added
  • ChangeLog.md updated

@github-actions

github-actions Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

PR Reminders

This PR has changes in src/, TIGLCreator/, and tests/unittests/ but not in tests/integrationtests/, tests/python/, or bindings/python_internal/. ChangeLog.md has changes.

  • 💡 Tip: Please check if new classes need to be added to the Python bindings

This is an automated reminder from CI

@codecov

codecov Bot commented Jul 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.21%. Comparing base (2dc512d) to head (c3c8f83).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1387      +/-   ##
==========================================
- Coverage   73.22%   73.21%   -0.02%     
==========================================
  Files         324      324              
  Lines       28567    28556      -11     
==========================================
- Hits        20919    20908      -11     
  Misses       7648     7648              
Flag Coverage Δ
unittests 73.21% <100.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/common/tiglcommonfunctions.cpp 78.31% <100.00%> (-0.21%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@joergbrech joergbrech changed the title Support the edge case of using a standard profile for a circle Fix #1386: geometry generation fails when creating a new CPACS file from the simpletest.cpacs.xml template Jul 17, 2026
@joergbrech
joergbrech marked this pull request as ready for review July 17, 2026 11:34
Comment thread src/common/tiglcommonfunctions.cpp Outdated

@svengoldberg svengoldberg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good and also like an elegant solution to me!

Just a small annotation here, although it does not belong to the present changes

@svengoldberg
svengoldberg merged commit 76802f0 into main Jul 17, 2026
17 checks passed
@svengoldberg
svengoldberg deleted the 1386-geometry-generation-fails-when-creating-a-new-cpacs-file-from-the-simpletestcpacsxml-template branch July 17, 2026 13:37
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.

Geometry generation fails when creating a new CPACS file from the simpletest.cpacs.xml template

2 participants