From 75b655fea024470ce5f352d904648c9edf8cf285 Mon Sep 17 00:00:00 2001 From: wandererfan Date: Thu, 6 Jun 2024 13:53:45 -0400 Subject: [PATCH] [TD]fix incorrect section lines with expression link --- src/Mod/TechDraw/App/DrawViewPart.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/Mod/TechDraw/App/DrawViewPart.cpp b/src/Mod/TechDraw/App/DrawViewPart.cpp index d6c93534d8..9e39ce5af5 100644 --- a/src/Mod/TechDraw/App/DrawViewPart.cpp +++ b/src/Mod/TechDraw/App/DrawViewPart.cpp @@ -1130,7 +1130,13 @@ std::vector DrawViewPart::getSectionRefs() const std::vector inObjs = getInList(); for (auto& o : inObjs) { if (o->isDerivedFrom()) { - result.push_back(static_cast(o)); + // expressions can add extra links to this DVP so we keep only + // objects that are BaseViews + auto section = dynamic_cast(o); + auto base = section->BaseView.getValue(); + if (base == this) { + result.push_back(section); + } } } return result; @@ -1141,10 +1147,16 @@ std::vector DrawViewPart::getDetailRefs() const std::vector result; std::vector inObjs = getInList(); for (auto& o : inObjs) { - if (o->isDerivedFrom()) { - if (!o->isRemoving()) { - result.push_back(static_cast(o)); + if (o->isDerivedFrom() && + !o->isRemoving() ) { + // expressions can add extra links to this DVP so we keep only + // objects that are BaseViews + auto detail = dynamic_cast(o); + auto base = detail->BaseView.getValue(); + if (base == this) { + result.push_back(detail); } + } } return result;