MCPcopy Create free account
hub / github.com/XRay3D/GERBER_X3 / createFile

Method createFile

GGEasy/forms/profileform.cpp:104–184  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102}
103
104void ProfileForm::createFile()
105{
106 m_usedItems.clear();
107 const auto tool { ui->toolHolder->tool() };
108 if (!tool.isValid()) {
109 tool.errorMessageBox(this);
110 return;
111 }
112
113 Paths wPaths;
114 Paths wRawPaths;
115 FileInterface const* file = nullptr;
116 bool skip { true };
117
118 for (auto* sItem : App::scene()->selectedItems()) {
119 GraphicsItem* gi = dynamic_cast<GraphicsItem*>(sItem);
120 switch (static_cast<GiType>(sItem->type())) {
121 case GiType::DataSolid:
122 case GiType::DataPath:
123 if (!file) {
124 file = gi->file();
125 boardSide = file->side();
126 } else if (file != gi->file()) {
127 if (skip) {
128 if ((skip = (QMessageBox::question(this, tr("Warning"), tr("Work items from different files!\nWould you like to continue?"), QMessageBox::Yes, QMessageBox::No) == QMessageBox::No)))
129 return;
130 }
131 }
132 if (static_cast<GiType>(sItem->type()) == GiType::DataSolid)
133 wPaths.append(gi->paths());
134 else
135 wRawPaths.append(gi->paths());
136 break;
137 case GiType::ShCircle:
138 case GiType::ShRectangle:
139 case GiType::ShPolyLine:
140 case GiType::ShCirArc:
141 case GiType::ShText:
142 wRawPaths.append(gi->paths());
143 break;
144 case GiType::Drill:
145 wPaths.append(gi->paths());
146 break;
147 default:
148 break;
149 }
150 addUsedGi(gi);
151 }
152
153 if (wRawPaths.empty() && wPaths.empty()) {
154 QMessageBox::warning(this, tr("Warning"), tr("No selected items for working..."));
155 return;
156 }
157
158 GCode::GCodeParams gcp;
159 gcp.setConvent(ui->rbConventional->isChecked());
160 gcp.setSide(side);
161 gcp.tools.push_back(tool);

Callers

nothing calls this directly

Calls 15

errorMessageBoxMethod · 0.80
setConventMethod · 0.80
isCheckedMethod · 0.80
isEmptyMethod · 0.80
setGcpMethod · 0.80
addPathsMethod · 0.80
addRawPathsMethod · 0.80
clearMethod · 0.45
toolMethod · 0.45
isValidMethod · 0.45
typeMethod · 0.45
fileMethod · 0.45

Tested by

no test coverage detected