| 70 | } |
| 71 | |
| 72 | void VoronoiForm::createFile() |
| 73 | { |
| 74 | const auto tool { ui->toolHolder->tool() }; |
| 75 | if (!tool.isValid()) { |
| 76 | tool.errorMessageBox(this); |
| 77 | return; |
| 78 | } |
| 79 | |
| 80 | Paths wPaths; |
| 81 | Paths wRawPaths; |
| 82 | FileInterface const* file = nullptr; |
| 83 | bool skip { true }; |
| 84 | |
| 85 | auto testFile = [&file, &skip, this](GraphicsItem* gi) -> bool { |
| 86 | if (!file) { |
| 87 | file = gi->file(); |
| 88 | boardSide = gi->file()->side(); |
| 89 | } |
| 90 | if (file != gi->file()) { |
| 91 | if (skip) { |
| 92 | if ((skip = (QMessageBox::question(this, tr("Warning"), tr("Work items from different files!\nWould you like to continue?"), QMessageBox::Yes, QMessageBox::No) == QMessageBox::No))) |
| 93 | return true; |
| 94 | } |
| 95 | } |
| 96 | return {}; |
| 97 | }; |
| 98 | |
| 99 | for (auto* item : App::scene()->selectedItems()) { |
| 100 | auto gi = dynamic_cast<GraphicsItem*>(item); |
| 101 | switch (static_cast<GiType>(item->type())) { |
| 102 | case GiType::DataSolid: |
| 103 | wPaths.append(static_cast<GraphicsItem*>(item)->paths()); |
| 104 | break; |
| 105 | case GiType::DataPath: |
| 106 | if (testFile(gi)) |
| 107 | return; |
| 108 | wRawPaths.append(static_cast<GraphicsItem*>(item)->paths()); |
| 109 | break; |
| 110 | case GiType::Drill: |
| 111 | if (testFile(gi)) |
| 112 | return; |
| 113 | wPaths.append(static_cast<GraphicsItem*>(item)->paths(1)); |
| 114 | default: |
| 115 | break; |
| 116 | } |
| 117 | addUsedGi(gi); |
| 118 | } |
| 119 | |
| 120 | if (wPaths.empty() && wRawPaths.empty()) { |
| 121 | QMessageBox::warning(this, tr("Warning"), tr("No selected items for working...")); |
| 122 | return; |
| 123 | } |
| 124 | |
| 125 | GCode::GCodeParams gpc; |
| 126 | gpc.setConvent(true); |
| 127 | gpc.setSide(GCode::Outer); |
| 128 | gpc.tools.push_back(tool); |
| 129 | gpc.params[GCode::GCodeParams::Depth] = ui->dsbxDepth->value(); |
nothing calls this directly
no test coverage detected