mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-05-31 02:24:27 +08:00
parent
22f93a34a8
commit
f485f66b2a
@ -2343,7 +2343,7 @@ std::string GCode::extrude_loop(ExtrusionLoop loop, std::string description, dou
|
|||||||
const EdgeGrid::Grid* edge_grid_ptr = (lower_layer_edge_grid && *lower_layer_edge_grid)
|
const EdgeGrid::Grid* edge_grid_ptr = (lower_layer_edge_grid && *lower_layer_edge_grid)
|
||||||
? lower_layer_edge_grid->get()
|
? lower_layer_edge_grid->get()
|
||||||
: nullptr;
|
: nullptr;
|
||||||
Point seam = m_seam_placer.get_seam(m_layer->id(), seam_position, loop,
|
Point seam = m_seam_placer.get_seam(*m_layer, seam_position, loop,
|
||||||
last_pos, EXTRUDER_CONFIG(nozzle_diameter),
|
last_pos, EXTRUDER_CONFIG(nozzle_diameter),
|
||||||
(m_layer == NULL ? nullptr : m_layer->object()),
|
(m_layer == NULL ? nullptr : m_layer->object()),
|
||||||
was_clockwise, edge_grid_ptr);
|
was_clockwise, edge_grid_ptr);
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include "libslic3r/EdgeGrid.hpp"
|
#include "libslic3r/EdgeGrid.hpp"
|
||||||
#include "libslic3r/ClipperUtils.hpp"
|
#include "libslic3r/ClipperUtils.hpp"
|
||||||
#include "libslic3r/SVG.hpp"
|
#include "libslic3r/SVG.hpp"
|
||||||
|
#include "libslic3r/Layer.hpp"
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
|
|
||||||
@ -282,7 +283,7 @@ void SeamPlacer::init(const Print& print)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
Point SeamPlacer::get_seam(const size_t layer_idx, const SeamPosition seam_position,
|
Point SeamPlacer::get_seam(const Layer& layer, const SeamPosition seam_position,
|
||||||
const ExtrusionLoop& loop, Point last_pos, coordf_t nozzle_dmr,
|
const ExtrusionLoop& loop, Point last_pos, coordf_t nozzle_dmr,
|
||||||
const PrintObject* po, bool was_clockwise, const EdgeGrid::Grid* lower_layer_edge_grid)
|
const PrintObject* po, bool was_clockwise, const EdgeGrid::Grid* lower_layer_edge_grid)
|
||||||
{
|
{
|
||||||
@ -292,6 +293,25 @@ Point SeamPlacer::get_seam(const size_t layer_idx, const SeamPosition seam_posit
|
|||||||
|
|
||||||
size_t po_idx = std::find(m_po_list.begin(), m_po_list.end(), po) - m_po_list.begin();
|
size_t po_idx = std::find(m_po_list.begin(), m_po_list.end(), po) - m_po_list.begin();
|
||||||
|
|
||||||
|
// Find current layer in respective PrintObject. Cache the result so the
|
||||||
|
// lookup is only done once per layer, not for each loop.
|
||||||
|
const Layer* layer_po = nullptr;
|
||||||
|
if (po == m_last_po && layer.print_z == m_last_print_z)
|
||||||
|
layer_po = m_last_layer_po;
|
||||||
|
else {
|
||||||
|
layer_po = po->get_layer_at_printz(layer.print_z);
|
||||||
|
m_last_po = po;
|
||||||
|
m_last_print_z = layer.print_z;
|
||||||
|
m_last_layer_po = layer_po;
|
||||||
|
}
|
||||||
|
if (! layer_po)
|
||||||
|
return last_pos;
|
||||||
|
|
||||||
|
// Index of this layer in the respective PrintObject.
|
||||||
|
size_t layer_idx = layer_po->id() - po->layers().front()->id(); // raft layers
|
||||||
|
|
||||||
|
assert(layer_idx < po->layer_count());
|
||||||
|
|
||||||
if (this->is_custom_seam_on_layer(layer_idx, po_idx)) {
|
if (this->is_custom_seam_on_layer(layer_idx, po_idx)) {
|
||||||
// Seam enf/blockers can begin and end in between the original vertices.
|
// Seam enf/blockers can begin and end in between the original vertices.
|
||||||
// Let add extra points in between and update the leghths.
|
// Let add extra points in between and update the leghths.
|
||||||
|
@ -13,6 +13,7 @@ namespace Slic3r {
|
|||||||
class PrintObject;
|
class PrintObject;
|
||||||
class ExtrusionLoop;
|
class ExtrusionLoop;
|
||||||
class Print;
|
class Print;
|
||||||
|
class Layer;
|
||||||
namespace EdgeGrid { class Grid; }
|
namespace EdgeGrid { class Grid; }
|
||||||
|
|
||||||
|
|
||||||
@ -40,7 +41,7 @@ class SeamPlacer {
|
|||||||
public:
|
public:
|
||||||
void init(const Print& print);
|
void init(const Print& print);
|
||||||
|
|
||||||
Point get_seam(const size_t layer_idx, const SeamPosition seam_position,
|
Point get_seam(const Layer& layer, const SeamPosition seam_position,
|
||||||
const ExtrusionLoop& loop, Point last_pos,
|
const ExtrusionLoop& loop, Point last_pos,
|
||||||
coordf_t nozzle_diameter, const PrintObject* po,
|
coordf_t nozzle_diameter, const PrintObject* po,
|
||||||
bool was_clockwise, const EdgeGrid::Grid* lower_layer_edge_grid);
|
bool was_clockwise, const EdgeGrid::Grid* lower_layer_edge_grid);
|
||||||
@ -55,6 +56,11 @@ private:
|
|||||||
TreeType tree;
|
TreeType tree;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Just a cache to save some lookups.
|
||||||
|
const Layer* m_last_layer_po = nullptr;
|
||||||
|
coordf_t m_last_print_z = -1.;
|
||||||
|
const PrintObject* m_last_po = nullptr;
|
||||||
|
|
||||||
|
|
||||||
std::vector<std::vector<CustomTrianglesPerLayer>> m_enforcers;
|
std::vector<std::vector<CustomTrianglesPerLayer>> m_enforcers;
|
||||||
std::vector<std::vector<CustomTrianglesPerLayer>> m_blockers;
|
std::vector<std::vector<CustomTrianglesPerLayer>> m_blockers;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user