diff --git a/src/wing/CCPACSWing.cpp b/src/wing/CCPACSWing.cpp index e999b7c0d..afcf3c56c 100644 --- a/src/wing/CCPACSWing.cpp +++ b/src/wing/CCPACSWing.cpp @@ -360,7 +360,13 @@ PNamedShape CCPACSWing::BuildLoft() const TopoDS_Shape CCPACSWing::GetLoftWithCutouts() { - return (*wingShapeWithCutouts)->Shape(); + if (NumberOfControlSurfaces(*this) == 0) { + LOG(WARNING) << "No control devices defined, GetLoftWithCutOuts() will return a clean shape."; + return (*wingCleanShape)->Shape(); + } + else { + return (*wingShapeWithCutouts)->Shape(); + } } // Builds a fused shape of all wing segments diff --git a/tests/unittests/tiglWing.cpp b/tests/unittests/tiglWing.cpp index ac2c1053e..f78c2fb98 100644 --- a/tests/unittests/tiglWing.cpp +++ b/tests/unittests/tiglWing.cpp @@ -19,7 +19,9 @@ * @brief Tests for testing non classified wing functions. */ +#include "BRepCheck_Analyzer.hxx" #include "test.h" // Brings in the GTest framework +#include "testUtils.h" #include "tigl.h" #include #include @@ -409,6 +411,27 @@ TEST_F(TiglWing, depthDirection) vtp.SetSymmetryAxis(vtpSymAx); } +TEST_F(WingSimple, testGetWingWithCutOuts) +{ + tigl::CCPACSConfigurationManager& manager = tigl::CCPACSConfigurationManager::GetInstance(); + tigl::CCPACSConfiguration& config = manager.GetConfiguration(tiglSimpleWingHandle); + tigl::CTiglUIDManager& uidmgr = config.GetUIDManager(); + auto& wing = uidmgr.ResolveObject("Wing"); + + // Check for warning if no control surfaces are defined + { // Scope to destroy object of type CaptureTiGLLog and therefore reset console verbosity + CaptureTiGLLog t{TILOG_WARNING}; + wing.GetLoftWithCutouts(); + auto logOutput = t.log(); + + std::string comparisonString = "No control devices defined, GetLoftWithCutOuts() will return a clean shape."; + ASSERT_TRUE((logOutput.find(comparisonString)) != std::string::npos); + } // scope + + ASSERT_TRUE(BRepCheck_Analyzer(wing.GetLoftWithCutouts()).IsValid()); + +} + TEST_F(WingSimple, wingGetMAC_success) { double c_1, x_1, y_1, z_1;