Skip to content

Commit

Permalink
Get margin/remove inside corner values from correct extruder stack
Browse files Browse the repository at this point in the history
CURA 11395
  • Loading branch information
casperlamboo committed Jan 9, 2024
1 parent 956d47a commit fec51a2
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/raft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,15 @@ void Raft::generate(SliceDataStorage& storage)
assert(
storage.raftBaseOutline.size() == 0 && storage.raftInterfaceOutline.size() == 0 && storage.raftSurfaceOutline.size() == 0
&& "Raft polygon isn't generated yet, so should be empty!");
const Settings& settings = Application::getInstance().current_slice_->scene.current_mesh_group->settings.get<ExtruderTrain&>("raft_base_extruder_nr").settings_;
const Settings& settings = Application::getInstance().current_slice_->scene.current_mesh_group->settings;
const Settings& raft_base_extruder_train = Application::getInstance().current_slice_->scene.current_mesh_group->settings.get<ExtruderTrain&>("raft_base_extruder_nr").settings_;
const Settings& raft_interface_extruder_train = Application::getInstance().current_slice_->scene.current_mesh_group->settings.get<ExtruderTrain&>("raft_interface_extruder_nr").settings_;
const Settings& raft_surface_exturder_train = Application::getInstance().current_slice_->scene.current_mesh_group->settings.get<ExtruderTrain&>("raft_surface_extruder_nr").settings_;
constexpr bool include_support = true;
constexpr bool dont_include_prime_tower = false; // Prime tower raft will be handled separately in 'storage.primeRaftOutline'; see below.
const auto raft_base_margin = settings.get<coord_t>("raft_base_margin");
const auto raft_interface_margin = settings.get<coord_t>("raft_interface_margin");
const auto raft_surface_margin = settings.get<coord_t>("raft_surface_margin");
const auto raft_base_margin = raft_base_extruder_train.get<coord_t>("raft_base_margin");
const auto raft_interface_margin = raft_interface_extruder_train.get<coord_t>("raft_interface_margin");
const auto raft_surface_margin = raft_surface_exturder_train.get<coord_t>("raft_surface_margin");

storage.raftBaseOutline = storage.raftSurfaceOutline = storage.raftInterfaceOutline = storage.getLayerOutlines(0, include_support, dont_include_prime_tower);
storage.raftBaseOutline = storage.raftBaseOutline.offset(raft_base_margin, ClipperLib::jtRound);
Expand Down Expand Up @@ -55,7 +58,7 @@ void Raft::generate(SliceDataStorage& storage)
storage.raftInterfaceOutline = storage.raftInterfaceOutline.unionPolygons(ooze_shield_raft);
}

const auto remove_inside_corners = [&settings, &storage](Polygons& outline, bool remove_inside_corners, coord_t smoothing)
const auto remove_inside_corners = [&storage](Polygons& outline, bool remove_inside_corners, coord_t smoothing)
{
if (remove_inside_corners)
{
Expand All @@ -66,9 +69,9 @@ void Raft::generate(SliceDataStorage& storage)
outline = outline.offset(smoothing, ClipperLib::jtRound).offset(-smoothing, ClipperLib::jtRound);
}
};
remove_inside_corners(storage.raftBaseOutline, settings.get<bool>("raft_base_remove_inside_corners"), settings.get<coord_t>("raft_base_smoothing"));
remove_inside_corners(storage.raftInterfaceOutline, settings.get<bool>("raft_interface_remove_inside_corners"), settings.get<coord_t>("raft_interface_smoothing"));
remove_inside_corners(storage.raftSurfaceOutline, settings.get<bool>("raft_surface_remove_inside_corners"), settings.get<coord_t>("raft_surface_smoothing"));
remove_inside_corners(storage.raftBaseOutline, raft_base_extruder_train.get<bool>("raft_base_remove_inside_corners"), raft_base_extruder_train.get<coord_t>("raft_base_smoothing"));
remove_inside_corners(storage.raftInterfaceOutline, raft_interface_extruder_train.get<bool>("raft_interface_remove_inside_corners"), raft_interface_extruder_train.get<coord_t>("raft_interface_smoothing"));
remove_inside_corners(storage.raftSurfaceOutline, raft_surface_exturder_train.get<bool>("raft_surface_remove_inside_corners"), raft_surface_exturder_train.get<coord_t>("raft_surface_smoothing"));

if (storage.primeTower.enabled_ && ! storage.primeTower.would_have_actual_tower_)
{
Expand Down

0 comments on commit fec51a2

Please sign in to comment.