Skip to content

Commit

Permalink
Change error type and flatten logic to detect error when added sectio…
Browse files Browse the repository at this point in the history
…n touches GC segments
  • Loading branch information
svengoldberg committed Nov 29, 2024
1 parent 4933523 commit 2466e1d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 26 deletions.
20 changes: 7 additions & 13 deletions src/fuselage/CCPACSFuselage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,7 @@ void CCPACSFuselage::CreateNewConnectedElementBetween(std::string startElementUI
if(GetSegments().GetSegmentFromTo(startElementUID, endElementUID).GetGuideCurves())
{
throw tigl::CTiglError("Adding sections in fuselage segments containing guide curves is currently not supported.\n"
"In general, guide curves should only be added when all sections are already defined, since the guide curves depend on them.", TIGL_UID_ERROR);
"In general, guide curves should only be added when all sections are already defined, since the guide curves depend on them.", TIGL_ERROR);
}

std::string segmentToSplit = GetSegments().GetSegmentFromTo(startElementUID, endElementUID).GetUID();
Expand Down Expand Up @@ -807,13 +807,10 @@ void CCPACSFuselage::CreateNewConnectedElementAfter(std::string startElementUID)
// If the corresponding segment contains guide curves -> Throw error, since adding elements after gc-segments is not supported
for (int i=1; i <= GetSegmentCount(); i++)
{
if (GetSegment(i).GetEndSectionElementUID() == startElementUID)
if(GetSegment(i).GetGuideCurves())
{
if(GetSegment(i).GetGuideCurves())
{
throw tigl::CTiglError("Adding sections after fuselage segments containing guide curves is currently not supported.\n"
"In general, guide curves should only be added when all sections are already defined, since the guide curves depend on them.", TIGL_UID_ERROR);
}
throw tigl::CTiglError("Adding sections after fuselage segments containing guide curves is currently not supported.\n"
"In general, guide curves should only be added when all sections are already defined, since the guide curves depend on them.", TIGL_ERROR);
}
}

Expand Down Expand Up @@ -873,13 +870,10 @@ void CCPACSFuselage::CreateNewConnectedElementBefore(std::string startElementUID
// If the corresponding segment contains guide curves -> Throw error, since adding elements after gc-segments is not supported
for (int i=1; i <= GetSegmentCount(); i++)
{
if (GetSegment(i).GetStartSectionElementUID() == startElementUID)
if(GetSegment(i).GetGuideCurves())
{
if(GetSegment(i).GetGuideCurves())
{
throw tigl::CTiglError("Adding sections before fuselage segments containing guide curves is currently not supported.\n"
"In general, guide curves should only be added when all sections are already defined, since the guide curves depend on them.", TIGL_UID_ERROR);
}
throw tigl::CTiglError("Adding sections before fuselage segments containing guide curves is currently not supported.\n"
"In general, guide curves should only be added when all sections are already defined, since the guide curves depend on them.", TIGL_ERROR);
}
}

Expand Down
20 changes: 7 additions & 13 deletions src/wing/CCPACSWing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1410,7 +1410,7 @@ void CCPACSWing::CreateNewConnectedElementBetween(std::string startElementUID, s
if(GetSegments().GetSegmentFromTo(startElementUID, endElementUID).GetGuideCurves())
{
throw tigl::CTiglError("Adding sections in wing segments containing guide curves is currently not supported.\n"
"In general, guide curves should only be added when all sections are already defined, since the guide curves depend on them.", TIGL_UID_ERROR);
"In general, guide curves should only be added when all sections are already defined, since the guide curves depend on them.", TIGL_ERROR);
}

std::string segmentToSplit = GetSegments().GetSegmentFromTo(startElementUID, endElementUID).GetUID();
Expand Down Expand Up @@ -1464,13 +1464,10 @@ void CCPACSWing::CreateNewConnectedElementAfter(std::string startElementUID)
// If the corresponding segment contains guide curves -> Throw error, since adding elements after gc-segments is not supported
for (int i=1; i <= GetSegmentCount(); i++)
{
if (GetSegment(i).GetOuterSectionElementUID() == startElementUID)
if(GetSegment(i).GetGuideCurves())
{
if(GetSegment(i).GetGuideCurves())
{
throw tigl::CTiglError("Adding sections after wing segments containing guide curves is currently not supported.\n"
"In general, guide curves should only be added when all sections are already defined, since the guide curves depend on them.", TIGL_UID_ERROR);
}
throw tigl::CTiglError("Adding sections after wing segments containing guide curves is currently not supported.\n"
"In general, guide curves should only be added when all sections are already defined, since the guide curves depend on them.", TIGL_ERROR);
}
}

Expand Down Expand Up @@ -1531,13 +1528,10 @@ void CCPACSWing::CreateNewConnectedElementBefore(std::string startElementUID)
// If the corresponding segment contains guide curves -> Throw error, since adding elements after gc-segments is not supported
for (int i=1; i <= GetSegmentCount(); i++)
{
if (GetSegment(i).GetInnerSectionElementUID() == startElementUID)
if(GetSegment(i).GetGuideCurves())
{
if(GetSegment(i).GetGuideCurves())
{
throw tigl::CTiglError("Adding sections before wing segments containing guide curves is currently not supported.\n"
"In general, guide curves should only be added when all sections are already defined, since the guide curves depend on them.", TIGL_UID_ERROR);
}
throw tigl::CTiglError("Adding sections before wing segments containing guide curves is currently not supported.\n"
"In general, guide curves should only be added when all sections are already defined, since the guide curves depend on them.", TIGL_ERROR);
}
}

Expand Down

0 comments on commit 2466e1d

Please sign in to comment.