[TD]fix incorrect section lines with expression link

This commit is contained in:
wandererfan
2024-06-06 13:53:45 -04:00
committed by WandererFan
parent 26f5760aa5
commit 75b655fea0

View File

@@ -1130,7 +1130,13 @@ std::vector<DrawViewSection*> DrawViewPart::getSectionRefs() const
std::vector<App::DocumentObject*> inObjs = getInList();
for (auto& o : inObjs) {
if (o->isDerivedFrom<DrawViewSection>()) {
result.push_back(static_cast<TechDraw::DrawViewSection*>(o));
// expressions can add extra links to this DVP so we keep only
// objects that are BaseViews
auto section = dynamic_cast<TechDraw::DrawViewSection*>(o);
auto base = section->BaseView.getValue();
if (base == this) {
result.push_back(section);
}
}
}
return result;
@@ -1141,10 +1147,16 @@ std::vector<DrawViewDetail*> DrawViewPart::getDetailRefs() const
std::vector<DrawViewDetail*> result;
std::vector<App::DocumentObject*> inObjs = getInList();
for (auto& o : inObjs) {
if (o->isDerivedFrom<DrawViewDetail>()) {
if (!o->isRemoving()) {
result.push_back(static_cast<TechDraw::DrawViewDetail*>(o));
if (o->isDerivedFrom<DrawViewDetail>() &&
!o->isRemoving() ) {
// expressions can add extra links to this DVP so we keep only
// objects that are BaseViews
auto detail = dynamic_cast<TechDraw::DrawViewDetail*>(o);
auto base = detail->BaseView.getValue();
if (base == this) {
result.push_back(detail);
}
}
}
return result;