Skip to content

Return empty shapes instead of throwing exceptions if nacelle or pylon definition is missing#1323

Open
joergbrech wants to merge 4 commits into
mainfrom
779-problem-showing-an-aircraft-with-engine-but-without-nacelle
Open

Return empty shapes instead of throwing exceptions if nacelle or pylon definition is missing#1323
joergbrech wants to merge 4 commits into
mainfrom
779-problem-showing-an-aircraft-with-engine-but-without-nacelle

Conversation

@joergbrech

Copy link
Copy Markdown
Contributor

Description

Fixes #779.

TiGL previously threw a CTiglError when trying to display an aircraft configuration containing an engine without a nacelle definition (e.g., an engine buried in the fuselage) or a pylon without geometry segments. This prevented the aircraft from being displayed at all in TiGLCreator.

Changes

  • src/engine_nacelle/CCPACSEnginePosition.cpp: BuildLoft() now returns an empty PNamedShape() instead of throwing when the engine has no nacelle definition. This matches the established pattern used by other components like CCPACSAircraftModel::BuildLoft() and CCPACSDuctAssembly::BuildShape().
  • src/engine_pylon/CTiglEnginePylonBuilder.cpp: BuildShape() now returns an empty PNamedShape() instead of throwing when the pylon has no segments.
  • src/geometry/CTiglAbstractGeometricComponent.cpp: Added null checks in CalcBoundingBox(), GetMirroredLoft(), and GetIsOn() to handle the case where the loft is null, preventing crashes in dependent methods.

How Has This Been Tested?

  • Manually tested opening files in TiGLCreator.
  • A new unit test has been added. The existing tests run without failure.

Screenshots, that help to understand the changes(if applicable):

Checklist:

Task Finished Reviewer Approved
At least one test for the new functionality was added.
  • yes
  • does not apply
  • OK
New classes have been added to the Python interface.
  • yes
  • does not apply
  • OK
The code is properly documented with doxygen docstrings
  • yes
  • does not apply
  • OK
Changes are documented at the top of ChangeLog.md
  • yes
  • does not apply
  • OK

@joergbrech joergbrech linked an issue Jun 10, 2026 that may be closed by this pull request
@codecov

codecov Bot commented Jun 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 65.00000% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.03%. Comparing base (8350f01) to head (1db04c9).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
src/engine_nacelle/CCPACSEnginePosition.cpp 42.85% 4 Missing ⚠️
src/geometry/CTiglAbstractGeometricComponent.cpp 75.00% 3 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1323      +/-   ##
==========================================
+ Coverage   72.96%   73.03%   +0.06%     
==========================================
  Files         322      322              
  Lines       28290    28297       +7     
==========================================
+ Hits        20643    20667      +24     
+ Misses       7647     7630      -17     
Flag Coverage Δ
unittests 73.03% <65.00%> (+0.06%) ⬆️

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

Files with missing lines Coverage Δ
src/engine_pylon/CTiglEnginePylonBuilder.cpp 22.22% <100.00%> (+22.22%) ⬆️
src/geometry/CTiglAbstractGeometricComponent.cpp 79.16% <75.00%> (-1.79%) ⬇️
src/engine_nacelle/CCPACSEnginePosition.cpp 30.76% <42.85%> (+16.48%) ⬆️

... and 3 files with indirect coverage changes

🚀 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 requested a review from svengoldberg June 11, 2026 13:12

@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 to me!

I just have a small question...
After that, for me, the PR is ready to merge

boost::optional<CCPACSEngineNacelle>& nacelle = engine.GetNacelle();
auto transform = this->GetTransformationMatrix();
CTiglEngineNacelleBuilder builder(*nacelle, transform);
return builder.BuildShape();

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.

Just to be safe, I am not too familiar with the lofting of nacelles...

Is it impossible that this code part might throw an error, because of the if-check before?
In the old code, there is this try/catch block

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.

Problem showing an aircraft with engine, but without nacelle

2 participants