Skip to content
Permalink
Browse files

remove dependency of datum element if creation of copy fails

  • Loading branch information...
wwmayer committed Jun 15, 2019
1 parent 588c265 commit 9177b4057cf5ffade1183367f39996ba993f5d46
Showing with 11 additions and 6 deletions.
  1. +11 −6 src/Mod/PartDesign/Gui/TaskDatumParameters.cpp
@@ -151,23 +151,28 @@ bool TaskDlgDatumParameters::accept() {
if (result == QDialog::DialogCode::Rejected)
return false;
else if (!dlg.radioXRef->isChecked()) {
std::vector<App::DocumentObject*> objs;
std::vector<App::DocumentObject*> copyObjects;
std::vector<std::string> copySubValues;
std::vector<std::string> subs = pcDatum->Support.getSubValues();
int index = 0;
for (App::DocumentObject* obj : pcDatum->Support.getValues()) {
if (!pcActiveBody->hasObject(obj) && !pcActiveBody->getOrigin()->hasObject(obj)) {
objs.push_back(PartDesignGui::TaskFeaturePick::makeCopy(obj, subs[index], dlg.radioIndependent->isChecked()));
copies.push_back(objs.back());
subs[index] = "";
auto* copy = PartDesignGui::TaskFeaturePick::makeCopy(obj, subs[index], dlg.radioIndependent->isChecked());
if (copy) {
copyObjects.push_back(copy);
copies.push_back(copyObjects.back());
copySubValues.push_back(std::string());
}
}
else {
objs.push_back(obj);
copyObjects.push_back(obj);
copySubValues.push_back(subs[index]);
}

index++;
}

pcDatum->Support.setValues(objs, subs);
pcDatum->Support.setValues(copyObjects, copySubValues);
}
}

0 comments on commit 9177b40

Please sign in to comment.
You can’t perform that action at this time.