mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-08-01 07:12:07 +00:00
ENH: buildvolume: add logic to support extruder_printable_height
jira: no-jira Change-Id: I962c4aed8c536c0fd8b89ae090cd0463c5d645db (cherry picked from commit 43773d77010492453473797e77e83e9a4630c25f)
This commit is contained in:
@@ -9,9 +9,11 @@
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
BuildVolume::BuildVolume(const std::vector<Vec2d> &printable_area, const double printable_height, const std::vector<std::vector<Vec2d>> &extruder_areas) : m_bed_shape(printable_area), m_max_print_height(printable_height), m_extruder_shapes(extruder_areas)
|
||||
BuildVolume::BuildVolume(const std::vector<Vec2d> &printable_area, const double printable_height, const std::vector<std::vector<Vec2d>> &extruder_areas, const std::vector<double>& extruder_printable_heights)
|
||||
: m_bed_shape(printable_area), m_max_print_height(printable_height), m_extruder_shapes(extruder_areas), m_extruder_printable_height(extruder_printable_heights)
|
||||
{
|
||||
assert(printable_height >= 0);
|
||||
assert(extruder_printable_heights.size() == extruder_areas.size());
|
||||
|
||||
m_polygon = Polygon::new_scale(printable_area);
|
||||
assert(m_polygon.is_counter_clockwise());
|
||||
@@ -83,6 +85,7 @@ BuildVolume::BuildVolume(const std::vector<Vec2d> &printable_area, const double
|
||||
m_shared_volume.data[1] = m_bboxf.min.y();
|
||||
m_shared_volume.data[2] = m_bboxf.max.x();
|
||||
m_shared_volume.data[3] = m_bboxf.max.y();
|
||||
m_shared_volume.zs[1] = m_bboxf.max.z();
|
||||
for (unsigned int index = 0; index < m_extruder_shapes.size(); index++)
|
||||
{
|
||||
std::vector<Vec2d>& extruder_shape = m_extruder_shapes[index];
|
||||
@@ -97,7 +100,7 @@ BuildVolume::BuildVolume(const std::vector<Vec2d> &printable_area, const double
|
||||
return;
|
||||
}
|
||||
|
||||
if (extruder_shape == printable_area) {
|
||||
if ((extruder_shape == printable_area)&&(extruder_printable_heights[index] == printable_height)) {
|
||||
extruder_volume.same_with_bed = true;
|
||||
extruder_volume.type = m_type;
|
||||
extruder_volume.bbox = m_bbox;
|
||||
@@ -110,7 +113,7 @@ BuildVolume::BuildVolume(const std::vector<Vec2d> &printable_area, const double
|
||||
double poly_area = poly.area();
|
||||
extruder_volume.bbox = get_extents(poly);
|
||||
BoundingBoxf temp_bboxf = get_extents(extruder_shape);
|
||||
extruder_volume.bboxf = BoundingBoxf3{ to_3d(temp_bboxf.min, 0.), to_3d(temp_bboxf.max, printable_height) };
|
||||
extruder_volume.bboxf = BoundingBoxf3{ to_3d(temp_bboxf.min, 0.), to_3d(temp_bboxf.max, extruder_printable_heights[index]) };
|
||||
|
||||
if (extruder_shape.size() >= 4 && std::abs((poly_area - double(extruder_volume.bbox.size().x()) * double(extruder_volume.bbox.size().y()))) < sqr(SCALED_EPSILON))
|
||||
{
|
||||
@@ -161,11 +164,13 @@ BuildVolume::BuildVolume(const std::vector<Vec2d> &printable_area, const double
|
||||
m_shared_volume.data[2] = extruder_volume.bboxf.max.x();
|
||||
if (m_shared_volume.data[3] > extruder_volume.bboxf.max.y())
|
||||
m_shared_volume.data[3] = extruder_volume.bboxf.max.y();
|
||||
if (m_shared_volume.zs[1] > extruder_volume.bboxf.max.z())
|
||||
m_shared_volume.zs[1] = extruder_volume.bboxf.max.z();
|
||||
}
|
||||
|
||||
m_shared_volume.type = static_cast<int>(m_type);
|
||||
m_shared_volume.zs[0] = 0.f;
|
||||
m_shared_volume.zs[1] = printable_height;
|
||||
//m_shared_volume.zs[1] = printable_height;
|
||||
}
|
||||
|
||||
BOOST_LOG_TRIVIAL(debug) << "BuildVolume printable_area clasified as: " << this->type_name();
|
||||
|
||||
@@ -55,12 +55,13 @@ public:
|
||||
// Initialized to empty, all zeros, Invalid.
|
||||
BuildVolume() {}
|
||||
// Initialize from PrintConfig::printable_area and PrintConfig::printable_height
|
||||
BuildVolume(const std::vector<Vec2d> &printable_area, const double printable_height, const std::vector<std::vector<Vec2d>> &extruder_areas);
|
||||
BuildVolume(const std::vector<Vec2d> &printable_area, const double printable_height, const std::vector<std::vector<Vec2d>> &extruder_areas, const std::vector<double>& extruder_printable_heights);
|
||||
|
||||
// Source data, unscaled coordinates.
|
||||
const std::vector<Vec2d>& printable_area() const { return m_bed_shape; }
|
||||
double printable_height() const { return m_max_print_height; }
|
||||
const std::vector<std::vector<Vec2d>>& extruder_areas() const { return m_extruder_shapes; }
|
||||
const std::vector<double>& extruder_heights() const { return m_extruder_printable_height; }
|
||||
const BuildSharedVolume& get_shared_volume() const { return m_shared_volume; }
|
||||
|
||||
// Derived data
|
||||
@@ -139,6 +140,7 @@ private:
|
||||
BuildSharedVolume m_shared_volume; //used for rendering
|
||||
// Source definition of the print volume height (PrintConfig::printable_height)
|
||||
double m_max_print_height { 0.f };
|
||||
std::vector<double> m_extruder_printable_height;
|
||||
|
||||
// Derived values.
|
||||
BuildVolume_Type m_type { BuildVolume_Type::Invalid };
|
||||
|
||||
@@ -226,6 +226,7 @@ class Print;
|
||||
//BBS: add bed exclude area
|
||||
Pointfs bed_exclude_area;
|
||||
std::vector<Pointfs> extruder_areas;
|
||||
std::vector<double> extruder_heights;
|
||||
//BBS: add toolpath_outside
|
||||
bool toolpath_outside;
|
||||
//BBS: add object_label_enabled
|
||||
|
||||
@@ -3553,7 +3553,7 @@ static void generate_support_areas(Print &print, TreeSupport* tree_support, cons
|
||||
print.set_status(69, _L("Generating support"));
|
||||
generate_support_toolpaths(print_object.support_layers(), print_object.config(), support_params, print_object.slicing_parameters(),
|
||||
raft_layers, bottom_contacts, top_contacts, intermediate_layers, interface_layers, base_interface_layers);
|
||||
|
||||
|
||||
auto t_end = std::chrono::high_resolution_clock::now();
|
||||
BOOST_LOG_TRIVIAL(info) << "Total time of organic tree support: " << 0.001 * std::chrono::duration_cast<std::chrono::microseconds>(t_end - t_start).count() << " ms";
|
||||
#if 0
|
||||
@@ -4020,7 +4020,7 @@ void generate_tree_support_3D(PrintObject &print_object, TreeSupport* tree_suppo
|
||||
Points bedpts = tree_support->m_machine_border.contour.points;
|
||||
Pointfs bedptsf;
|
||||
std::transform(bedpts.begin(), bedpts.end(), std::back_inserter(bedptsf), [](const Point &p) { return unscale(p); });
|
||||
BuildVolume build_volume{ bedptsf, tree_support->m_print_config->printable_height, {}};
|
||||
BuildVolume build_volume{ bedptsf, tree_support->m_print_config->printable_height, {}, {} };
|
||||
|
||||
TreeSupport3D::generate_support_areas(*print_object.print(), tree_support, build_volume, { idx }, throw_on_cancel);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user