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

Method createFile

GGEasy/forms/hatchingform.cpp:80–153  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78}
79
80void HatchingForm::createFile()
81{
82 const auto tool { ui->toolHolder->tool() };
83
84 if (!tool.isValid()) {
85 tool.errorMessageBox(this);
86 return;
87 }
88
89 Paths wPaths;
90 Paths wRawPaths;
91 FileInterface const* file = nullptr;
92 bool skip { true };
93
94 for (auto* item : App::scene()->selectedItems()) {
95 GraphicsItem* gi = dynamic_cast<GraphicsItem*>(item);
96 switch (static_cast<GiType>(item->type())) {
97 case GiType::DataSolid:
98 case GiType::DataPath:
99 if (!file) {
100 file = gi->file();
101 boardSide = file->side();
102 } else if (file != gi->file()) {
103 if (skip) {
104 if ((skip = (QMessageBox::question(this, tr("Warning"), tr("Work items from different files!\nWould you like to continue?"), QMessageBox::Yes, QMessageBox::No) == QMessageBox::No)))
105 return;
106 }
107 }
108 if (static_cast<GiType>(item->type()) == GiType::DataSolid)
109 wPaths.append(gi->paths());
110 else
111 wRawPaths.append(gi->paths());
112 break;
113 case GiType::ShCircle:
114 case GiType::ShRectangle:
115 case GiType::ShPolyLine:
116 case GiType::ShCirArc:
117 case GiType::ShText:
118 wRawPaths.append(gi->paths());
119 break;
120 case GiType::Drill:
121 wPaths.append(gi->paths());
122 break;
123 default:
124 break;
125 }
126 addUsedGi(gi);
127 }
128
129 if (wRawPaths.empty() && wPaths.empty()) {
130 QMessageBox::warning(this, tr("Warning"), tr("No selected items for working..."));
131 return;
132 }
133
134 GCode::GCodeParams gcp;
135 gcp.setConvent(ui->rbConventional->isChecked());
136 gcp.setSide(side);
137 gcp.tools.push_back(tool);

Callers

nothing calls this directly

Calls 15

errorMessageBoxMethod · 0.80
setConventMethod · 0.80
isCheckedMethod · 0.80
setGcpMethod · 0.80
addPathsMethod · 0.80
addRawPathsMethod · 0.80
toolMethod · 0.45
isValidMethod · 0.45
typeMethod · 0.45
fileMethod · 0.45
sideMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected