Skip to content

Commit

Permalink
Merge branch 'main' into CURA-11553-spike-scarring-prime-blob-scenario
Browse files Browse the repository at this point in the history
  • Loading branch information
wawanbreton authored Feb 29, 2024
2 parents 4788e09 + a3a8da5 commit 19b0770
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 35 deletions.
5 changes: 0 additions & 5 deletions include/settings/EnumSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -250,11 +250,6 @@ enum class InsetDirection
*/
enum class PrimeTowerMethod
{
/*!
* No prime tower is generated.
*/
NONE,

/*!
* Prime tower that minimizes time and used filament as much as possible.
*/
Expand Down
39 changes: 20 additions & 19 deletions src/FffGcodeWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1594,7 +1594,8 @@ std::vector<ExtruderUse>
assert(static_cast<int>(extruder_count) > 0);
std::vector<ExtruderUse> ret;
std::vector<bool> extruder_is_used_on_this_layer = storage.getExtrudersUsed(layer_nr);
PrimeTowerMethod method = mesh_group_settings.get<PrimeTowerMethod>("prime_tower_mode");
const auto method = mesh_group_settings.get<PrimeTowerMethod>("prime_tower_mode");
const auto prime_tower_enable = mesh_group_settings.get<bool>("prime_tower_enable");

// check if we are on the first layer
if (layer_nr == -static_cast<LayerIndex>(Raft::getTotalExtraLayers()))
Expand Down Expand Up @@ -1626,28 +1627,28 @@ std::vector<ExtruderUse>
{
ExtruderPrime prime = ExtruderPrime::None;

switch (method)
if (prime_tower_enable)
{
case PrimeTowerMethod::NONE:
break;

case PrimeTowerMethod::NORMAL:
if (extruder_is_used_on_this_layer[extruder_nr] && extruder_nr != last_extruder)
{
prime = ExtruderPrime::Prime;
}
else if (layer_nr < storage.max_print_height_second_to_last_extruder)
switch (method)
{
prime = ExtruderPrime::Sparse;
}
break;
case PrimeTowerMethod::NORMAL:
if (extruder_is_used_on_this_layer[extruder_nr] && extruder_nr != last_extruder)
{
prime = ExtruderPrime::Prime;
}
else if (layer_nr < storage.max_print_height_second_to_last_extruder)
{
prime = ExtruderPrime::Sparse;
}
break;

case PrimeTowerMethod::INTERLEAVED:
if (extruder_is_used_on_this_layer[extruder_nr] && extruder_nr != last_extruder)
{
prime = ExtruderPrime::Prime;
case PrimeTowerMethod::INTERLEAVED:
if (extruder_is_used_on_this_layer[extruder_nr] && extruder_nr != last_extruder)
{
prime = ExtruderPrime::Prime;
}
break;
}
break;
}

if (extruder_is_used_on_this_layer[extruder_nr] || prime != ExtruderPrime::None)
Expand Down
4 changes: 2 additions & 2 deletions src/FffPolygonGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -972,7 +972,7 @@ void FffPolygonGenerator::processOozeShield(SliceDataStorage& storage)
{
storage.oozeShield[layer_nr].removeSmallAreas(largest_printed_area);
}
if (mesh_group_settings.get<PrimeTowerMethod>("prime_tower_mode") != PrimeTowerMethod::NONE)
if (mesh_group_settings.get<bool>("prime_tower_enable"))
{
coord_t max_line_width = 0;
{ // compute max_line_width
Expand Down Expand Up @@ -1024,7 +1024,7 @@ void FffPolygonGenerator::processDraftShield(SliceDataStorage& storage)
maximum_deviation = std::min(maximum_deviation, extruder.settings_.get<coord_t>("meshfix_maximum_deviation"));
}
storage.draft_protection_shield = Simplify(maximum_resolution, maximum_deviation, 0).polygon(storage.draft_protection_shield);
if (mesh_group_settings.get<PrimeTowerMethod>("prime_tower_mode") != PrimeTowerMethod::NONE)
if (mesh_group_settings.get<bool>("prime_tower_enable"))
{
coord_t max_line_width = 0;
{ // compute max_line_width
Expand Down
2 changes: 1 addition & 1 deletion src/PrimeTower.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ PrimeTower::PrimeTower()
&& ((adhesion_type != EPlatformAdhesion::SKIRT) && (adhesion_type != EPlatformAdhesion::BRIM)));
}

enabled_ = method != PrimeTowerMethod::NONE && scene.current_mesh_group->settings.get<coord_t>("prime_tower_min_volume") > 10
enabled_ = scene.current_mesh_group->settings.get<bool>("prime_tower_enable") && scene.current_mesh_group->settings.get<coord_t>("prime_tower_min_volume") > 10
&& scene.current_mesh_group->settings.get<coord_t>("prime_tower_size") > 10;

would_have_actual_tower_ = enabled_; // Assume so for now.
Expand Down
10 changes: 2 additions & 8 deletions src/settings/Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -686,14 +686,8 @@ PrimeTowerMethod Settings::get<PrimeTowerMethod>(const std::string& key) const
{
return PrimeTowerMethod::INTERLEAVED;
}
else if (value == "normal")
{
return PrimeTowerMethod::NORMAL;
}
else // Default.
{
return PrimeTowerMethod::NONE;
}

return PrimeTowerMethod::NORMAL;
}

template<>
Expand Down

0 comments on commit 19b0770

Please sign in to comment.