-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.cpp
103 lines (84 loc) · 4.58 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/*
* 2022, Michał Zmyślony, mlz22@cam.ac.uk.
*
* Please cite Michał Zmyślony and Dr John Biggins if you use any part of this code in work you publish or distribute.
*
* This file is part of gCodeGenerator.
*
* gCodeGenerator is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* gCodeGenerator is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with Foobar. If not, see <https://www.gnu.org/licenses/>.
*/
#include <iostream>
#include <boost/filesystem.hpp>
#include <boost/dll.hpp>
#include <filesystem>
#include "source/engine/hyrel.h"
#include "source/engine/extrusion_configuration.h"
#include "source/engine/printer_configuration.h"
#include "source/engine/full_printing_configuration.h"
namespace fs = boost::filesystem;
int main() {
fs::path cwd = boost::dll::program_location().parent_path().parent_path();
fs::path paths_directory = cwd.parent_path() / "vector_slicer" / "output" / "paths";
if (!fs::exists(paths_directory)) {
paths_directory = cwd.parent_path() / "paths";
}
if (!fs::exists(paths_directory)) {
throw std::runtime_error("Paths directory does not exist.");
}
fs::path export_directory = cwd / "gcode";
// All units are in mm
ExtrusionConfiguration extrusion_configuration(240, 80, 0.2,
0.1, 1.0, 20);
PrinterConfiguration printing_configuration(3000, 0, 1,
13, 15,
60000, 10000, 20000);
// For priming 1297 pulses is a single microlitre, tune this value in order to obtain desirable flow.
// Single microlitre is 14 mm of "filament" for a nozzle diameter of 300 um.
// 100 pulses = 1 mm of filament
// 320k pulses is a single lead screw revolution
// 10k priming rate corresponds to around 6000 printing speed
int uv_duty_cycle = 50;
double first_layer_height = extrusion_configuration.getLayerHeight() + 0.025;
std::vector<double> tool_offset = {101, 86, 0};
double pattern_offset = 3;
FullPrintingConfiguration printer(extrusion_configuration, printing_configuration,
export_directory, tool_offset, uv_duty_cycle, first_layer_height);
std::cout << "\nGenerating GCode for the files contained in" << std::endl << '\t' << paths_directory
<< std::endl;
printer.printPatternGrid({{paths_directory / "longitudinal_20_10_mm"},
{paths_directory / "evertor_10_mm_0"}},
{{4, 6}},
pattern_offset, false, 0);
printer.printPatternGrid({{paths_directory / "longitudinal_20_10_mm"},
{paths_directory / "iris_5_mm_0", paths_directory / "cylinder_5_mm_0"}},
{{4}},
pattern_offset, false, 0);
for (int i = 1; i < 5; i++) {
printer.printPatternGrid({{paths_directory / "longitudinal_20_10_mm"},
{paths_directory / "radial_10_mm_SHWO", paths_directory / "radial_10_mm_MHMO",
paths_directory / "radial_10_mm_WHSO"}},
{{1, i}},
pattern_offset, false, 0);
}
printer.printPatternColumn(paths_directory / "three_charge_blob", 1, pattern_offset, false, 0);
printer.printPatternColumn(paths_directory / "star_shape", 1, pattern_offset, false, 0);
printer.printPatternColumn(paths_directory / "longitudinal_20_10_mm", 6, pattern_offset, false, 0);
double printing_distance = 10;
int number_of_lines = 15;
// printer.tuneLineSeparation(printing_distance, number_of_lines,
// 1, 0.8, 5);
// printer.tuneLineSeparationAndSpeed(printing_distance, number_of_lines,
// 0.8, 1.2, 3,
// 200, 300, 5);
//
printer.tuneLineSeparationAndHeight(printing_distance, number_of_lines,
1.5, 1.0, 3,
0.145, 0.105, 3);
//
std::cout << "Generation complete." << std::endl;
return 0;
}