This repository has been archived by the owner on Jun 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathCuraEngine.patch
72 lines (64 loc) · 2.46 KB
/
CuraEngine.patch
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
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0b1bdeac..b168e6a4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -97,7 +97,7 @@ if (ENABLE_MORE_COMPILER_OPTIMIZATION_FLAGS AND NOT (CMAKE_BUILD_TYPE_UPPER MATC
if (MSVC)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} /fp:fast")
else()
- set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -Ofast -funroll-loops")
+ set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -funroll-loops")
endif()
endif ()
diff --git a/src/communication/CommandLine.cpp b/src/communication/CommandLine.cpp
index e05aebf3..08fe7281 100644
--- a/src/communication/CommandLine.cpp
+++ b/src/communication/CommandLine.cpp
@@ -22,6 +22,8 @@
#include "../utils/FMatrix4x3.h" //For the mesh_rotation_matrix setting.
#include "../utils/logoutput.h"
+#include <emscripten.h>
+
namespace cura
{
@@ -80,6 +82,11 @@ void CommandLine::sendProgress(const float& progress) const
return;
}
//TODO: Do we want to print a progress bar? We'd need a better solution to not have that progress bar be ruined by any logging.
+
+ //Call progress handler with progress
+ char js[100];
+ std::sprintf(js, "globalThis[\"cura-wasm-progress-callback\"](%f)", progress);
+ emscripten_run_script(js);
}
void CommandLine::sliceNext()
diff --git a/src/gcodeExport.cpp b/src/gcodeExport.cpp
index 5d75ea53..725f98c1 100644
--- a/src/gcodeExport.cpp
+++ b/src/gcodeExport.cpp
@@ -19,6 +19,8 @@
#include "utils/string.h" // MMtoStream, PrecisionedDouble
#include "WipeScriptConfig.h"
+#include <emscripten.h>
+
namespace cura {
std::string transliterate(const std::string& text)
@@ -273,6 +275,20 @@ std::string GCodeExport::getFileHeader(const std::vector<bool>& extruder_is_used
prefix << ";MAXZ:" << INT2MM(total_bounding_box.max.z) << new_line;
}
+ //Call metadata handler with metadata
+ char js[200];
+ std::sprintf(
+ js,
+ "globalThis[\"cura-wasm-metadata-callback\"](\"%s\", %d, %d, %d, %f, %d)",
+ flavorToString(flavor).c_str(),
+ ((print_time) ? static_cast<int>(*print_time) : 6666),
+ ((filament_used.size() >= 1)? static_cast<int>(filament_used[0]) : 6666),
+ ((filament_used.size() >= 2)? static_cast<int>(filament_used[1]) : 0),
+ Application::getInstance().current_slice->scene.extruders[0].settings.get<double>("machine_nozzle_size"),
+ int(getTotalFilamentUsed(0))
+ );
+ emscripten_run_script(js);
+
return prefix.str();
}