int main(int argc, const char** argv) { if(argc!=3) { printf("Usage: %s <.stl file> <.gcode file>\n",argv[0]); return 1; } // load config file to fill config map loadConfig("config.ini"); // load the .stl file std::vector<Vertex> vertices; std::vector<Triangle> triangles; loadStl(argv[1], vertices, triangles); // create layers and assign touched triangles to them std::vector<Layer> layers; float min_z; buildLayers(triangles, layers, min_z); // create printable segments for every layer for(int i=0; i<layers.size(); i++) buildSegments(i,layers[i]); // save filled layers in Gcode format saveGcode(argv[2],layers,min_z); return 0; }
Model::Model(const QString &filePath) : m_fileName(QFileInfo(filePath).fileName()) { QFile file(filePath); if (!file.open(QIODevice::ReadOnly)) return; if (filePath.endsWith(".stl", Qt::CaseInsensitive)) { loadStl(file); } else if (filePath.endsWith(".obj", Qt::CaseInsensitive)) { loadObj(file); } else if (filePath.endsWith(".gcode", Qt::CaseInsensitive)) { loadGCode(filePath.toStdString()); } m_transform.setToIdentity(); }