Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/upstream/main' into Plugin…
Browse files Browse the repository at this point in the history
…GcodeModifyPatches
  • Loading branch information
ThomasRahm committed Sep 13, 2024
2 parents bd4e0c0 + 5c8de19 commit fd1868c
Show file tree
Hide file tree
Showing 47 changed files with 3,065 additions and 176 deletions.
24 changes: 23 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ set(engine_SRCS # Except main.cpp.
src/communication/ArcusCommunication.cpp
src/communication/ArcusCommunicationPrivate.cpp
src/communication/CommandLine.cpp
src/communication/EmscriptenCommunication.cpp
src/communication/Listener.cpp

src/infill/ImageBasedDensityProvider.cpp
Expand Down Expand Up @@ -270,7 +271,28 @@ endif ()

if (CMAKE_CXX_PLATFORM_ID STREQUAL "emscripten")
message(STATUS "Building for Emscripten")
target_link_options(_CuraEngine PUBLIC -Wno-unused-command-line-argument -sINVOKE_RUN=0 -sEXPORT_NAME=CuraEngine -sEXPORTED_RUNTIME_METHODS=[callMain,FS] -sFORCE_FILESYSTEM=1 -sALLOW_MEMORY_GROWTH=1 -sEXPORT_ES6=1 -sMODULARIZE=1 -sSINGLE_FILE=1 -sENVIRONMENT=worker -sERROR_ON_UNDEFINED_SYMBOLS=0 -lembind --embind-emit-tsd CuraEngine.d.ts)
target_link_options(_CuraEngine
PUBLIC
"SHELL:-sINVOKE_RUN=0"
"SHELL:-sEXPORT_NAME=CuraEngine"
"SHELL:-sEXPORTED_RUNTIME_METHODS=[callMain,FS]"
"SHELL:-sFORCE_FILESYSTEM=1"
"SHELL:-sALLOW_MEMORY_GROWTH=1"
"SHELL:-sEXPORT_ES6=1"
"SHELL:-sMODULARIZE=1"
"SHELL:-sSINGLE_FILE=1"
"SHELL:-sENVIRONMENT=web"
"SHELL:-sERROR_ON_UNDEFINED_SYMBOLS=0"
"SHELL:-sWASM_BIGINT=1"
"SHELL:-sSTACK_SIZE=196608"
$<$<CONFIG:Debug>:SHELL:-sASSERTIONS=2>
$<$<CONFIG:Debug>:SHELL:-sSAFE_HEAP=1>
$<$<CONFIG:Debug>:SHELL:-sSTACK_OVERFLOW_CHECK=2>
$<$<CONFIG:Debug>:SHELL:-g3>
$<$<CONFIG:Debug>:SHELL:-gsource-map>
"SHELL:-lembind"
"SHELL:--embind-emit-tsd CuraEngine.d.ts"
)
endif ()

target_link_libraries(CuraEngine PRIVATE
Expand Down
4 changes: 2 additions & 2 deletions conandata.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
version: "5.8.0"
version: "5.9.0-alpha.0"
requirements:
- "scripta/0.1.0@ultimaker/testing"
requirements_arcus:
- "arcus/5.3.1"
requirements_plugins:
- "curaengine_grpc_definitions/0.2.1"
requirements_cura_resources:
- "cura_resources/5.8.0"
- "cura_resources/(latest)@ultimaker/testing"
2 changes: 1 addition & 1 deletion conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def requirements(self):
self.requires("protobuf/3.21.12")
self.requires("clipper/6.4.2@ultimaker/stable")
self.requires("boost/1.82.0")
self.requires("rapidjson/1.1.0")
self.requires("rapidjson/cci.20230929")
self.requires("stb/20200203")
self.requires("spdlog/1.12.0")
self.requires("fmt/10.1.1")
Expand Down
5 changes: 3 additions & 2 deletions include/Application.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include <cassert>
#include <cstddef>
#include <memory>
#include <string>

#include "utils/NoCopy.h"
Expand Down Expand Up @@ -38,14 +39,14 @@ class Application : NoCopy
* can assume that it is safe to access this without checking whether it is
* initialised.
*/
Communication* communication_ = nullptr;
std::shared_ptr<Communication> communication_;

/*
* \brief The slice that is currently ongoing.
*
* If no slice has started yet, this will be a nullptr.
*/
Slice* current_slice_ = nullptr;
std::shared_ptr<Slice> current_slice_;

/*!
* \brief ThreadPool with lifetime tied to Application
Expand Down
1 change: 1 addition & 0 deletions include/ExtruderPlan.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class ExtruderPlan
FRIEND_TEST(ExtruderPlanPathsParameterizedTest, BackPressureCompensationFull);
FRIEND_TEST(ExtruderPlanPathsParameterizedTest, BackPressureCompensationHalf);
FRIEND_TEST(ExtruderPlanTest, BackPressureCompensationEmptyPlan);
friend class FffGcodeWriterTest_SurfaceGetsExtraInfillLinesUnderIt_Test;
#endif
public:
size_t extruder_nr_{ 0 }; //!< The extruder used for this paths in the current plan.
Expand Down
2 changes: 2 additions & 0 deletions include/FffGcodeWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ struct MeshPathConfigs;
class FffGcodeWriter : public NoCopy
{
friend class FffProcessor; // Because FffProcessor exposes finalize (TODO)
friend class FffGcodeWriterTest_SurfaceGetsExtraInfillLinesUnderIt_Test;

private:
coord_t max_object_height; //!< The maximal height of all previously sliced meshgroups, used to avoid collision when moving to the next meshgroup to print.

Expand Down
7 changes: 7 additions & 0 deletions include/LayerPlan.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class LayerPlan : public NoCopy
friend class LayerPlanBuffer;
#ifdef BUILD_TESTS
friend class AddTravelTest;
friend class FffGcodeWriterTest_SurfaceGetsExtraInfillLinesUnderIt_Test;
#endif

public:
Expand Down Expand Up @@ -778,6 +779,12 @@ class LayerPlan : public NoCopy
*/
void applyBackPressureCompensation();

/*!
* If enabled, applies the gradual flow acceleration splitting, that improves printing quality when printing at very high speed,
* especially with a bowden extruder.
*/
void applyGradualFlow();

private:
/*!
* \brief Compute the preferred or minimum combing boundary
Expand Down
2 changes: 1 addition & 1 deletion include/TreeSupportSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ struct TreeSupportSettings
: RestPreference::BUILDPLATE)
, xy_distance(mesh_group_settings.get<coord_t>("support_xy_distance"))
, bp_radius(mesh_group_settings.get<coord_t>("support_tree_bp_diameter") / 2)
, diameter_scale_bp_radius(std::min(sin(0.7) * static_cast<double>(layer_height / branch_radius), 1.0 / (branch_radius / (support_line_width / 2.0))))
, diameter_scale_bp_radius(std::min(sin(0.7) * static_cast<double>(layer_height) / static_cast<double>(branch_radius), 1.0 / (branch_radius / (support_line_width / 2.0))))
, // Either 40° or as much as possible so that 2 lines will overlap by at least 50%, whichever is smaller.
support_overrides(mesh_group_settings.get<SupportDistPriority>("support_xy_overrides_z"))
, xy_min_distance(support_overrides == SupportDistPriority::Z_OVERRIDES_XY ? mesh_group_settings.get<coord_t>("support_xy_distance_overhang") : xy_distance)
Expand Down
13 changes: 6 additions & 7 deletions include/communication/CommandLine.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ using container_setting_map = std::unordered_map<std::string, setting_map>;
class CommandLine : public Communication
{
public:
CommandLine() = default;

/*
* \brief Construct a new communicator that interprets the command line to
* start a slice.
Expand Down Expand Up @@ -155,18 +157,15 @@ class CommandLine : public Communication
*/
void sliceNext() override;

private:
#ifdef __EMSCRIPTEN__
std::string progressHandler;
#endif

std::vector<std::filesystem::path> search_directories_;

protected:
/*
* \brief The command line arguments that the application was called with.
*/
std::vector<std::string> arguments_;

private:
std::vector<std::filesystem::path> search_directories_;

/*
* The last progress update that we output to stdcerr.
*/
Expand Down
65 changes: 65 additions & 0 deletions include/communication/EmscriptenCommunication.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// Copyright (c) 2024 UltiMaker
// CuraEngine is released under the terms of the AGPLv3 or higher

#ifndef EMSCRIPTENCOMMUNICATION_H
#define EMSCRIPTENCOMMUNICATION_H
#ifdef __EMSCRIPTEN__

#include "communication/CommandLine.h"

namespace cura
{

/**
* \class EmscriptenCommunication
* \brief A class for handling communication in an Emscripten environment.
*
* This class extends the CommandLine class and provides specific implementations
* for sending progress and handling slice information in an Emscripten environment.
*/
class EmscriptenCommunication : public CommandLine
{
private:
std::string progress_handler_; ///< Handler for progress messages.
std::string gcode_header_handler_; ///< Handler for getting the GCode handler.
std::string slice_info_handler_; ///< Handler for slice information messages.

/**
* \brief Creates a message containing slice information.
* \return A string containing the slice information message.
*/
[[nodiscard]] static std::string createSliceInfoMessage();

public:
/**
* \brief Constructor for EmscriptenCommunication.
* \param arguments A vector of strings containing the command line arguments.
*/
EmscriptenCommunication(const std::vector<std::string>& arguments);

/**
* \brief Sends the progress of the current operation.
* \param progress A double representing the progress percentage.
*/
void sendProgress(double progress) const override;

/**
* \brief Sends GcodeHeader
*/
void sendGCodePrefix(const std::string& prefix) const override;

/**
* \brief Initiates the slicing of the next item.
*/
void sliceNext() override;

bool isSequential() const override
{
return false;
}
};

} // namespace cura

#endif // __EMSCRIPTEN__
#endif // EMSCRIPTENCOMMUNICATION_H
2 changes: 1 addition & 1 deletion include/geometry/LinesSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ class LinesSet
template<class OtherLineType>
void push_back(LinesSet<OtherLineType>&& lines_set);

/*! \brief Pushes an entier set at the end */
/*! \brief Pushes an entire set at the end */
void push_back(const LinesSet& other)
{
lines_.insert(lines_.end(), other.lines_.begin(), other.lines_.end());
Expand Down
6 changes: 6 additions & 0 deletions include/geometry/PointsSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ class PointsSet
points_.push_back(point);
}

/*! \brief Pushes an entire set at the end */
void push_back(const PointsSet& other)
{
points_.insert(points_.end(), other.points_.begin(), other.points_.end());
}

void emplace_back(auto&&... args)
{
points_.emplace_back(std::forward<decltype(args)>(args)...);
Expand Down
Loading

0 comments on commit fd1868c

Please sign in to comment.