TechDraw: decorateLine fix (#21312)

* TechDraw: decorateLine fix

* Update CommandAnnotate.cpp
This commit is contained in:
PaddleStroke
2025-05-19 09:36:47 +02:00
committed by GitHub
parent 4cc069eb0a
commit 39b6a1e3a8

View File

@@ -1424,29 +1424,32 @@ void CmdTechDrawDecorateLine::activated(int iMsg)
}
std::vector<Gui::SelectionObject> selection = getSelection().getSelectionEx();
TechDraw::DrawViewPart* baseFeat = nullptr;
if (selection.empty()) {
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong Selection"),
QObject::tr("You must select a View and/or lines."));
return;
}
baseFeat = dynamic_cast<TechDraw::DrawViewPart *>(selection[0].getObject());
TechDraw::DrawViewPart* baseFeat = nullptr;
std::vector<std::string> subNames;
std::vector<Gui::SelectionObject>::iterator itSel = selection.begin();
for (; itSel != selection.end(); itSel++) {
if ((*itSel).getObject()->isDerivedFrom<TechDraw::DrawViewPart>()) {
subNames = (*itSel).getSubNames();
if (!subNames.empty()) {
baseFeat = static_cast<TechDraw::DrawViewPart*>((*itSel).getObject());
break;
}
}
}
if (!baseFeat) {
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong Selection"),
QObject::tr("No View in Selection."));
return;
}
std::vector<std::string> subNames;
std::vector<Gui::SelectionObject>::iterator itSel = selection.begin();
for (; itSel != selection.end(); itSel++) {
if ((*itSel).getObject()->isDerivedFrom<TechDraw::DrawViewPart>()) {
baseFeat = static_cast<TechDraw::DrawViewPart*> ((*itSel).getObject());
subNames = (*itSel).getSubNames();
}
}
std::vector<std::string> edgeNames;
for (auto& s: subNames) {
std::string geomType = DrawUtil::getGeomTypeFromName(s);