Improved SLA layer view: Low layer shall be rendered from the slice above,
triangulated slices are shifted slightly away from the clipping planes. FDM: Ported a "(bridged)" G-code comment from upstream.
This commit is contained in:
parent
9652e8193a
commit
e0e1e2b682
@ -2408,6 +2408,9 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description,
|
|||||||
{
|
{
|
||||||
std::string gcode;
|
std::string gcode;
|
||||||
|
|
||||||
|
if (is_bridge(path.role()))
|
||||||
|
description += " (bridge)";
|
||||||
|
|
||||||
// go to first point of extrusion path
|
// go to first point of extrusion path
|
||||||
if (!m_last_pos_defined || m_last_pos != path.first_point()) {
|
if (!m_last_pos_defined || m_last_pos != path.first_point()) {
|
||||||
gcode += this->travel_to(
|
gcode += this->travel_to(
|
||||||
|
@ -350,10 +350,10 @@ public:
|
|||||||
}
|
}
|
||||||
const PrintObjects& objects() const { return m_objects; }
|
const PrintObjects& objects() const { return m_objects; }
|
||||||
|
|
||||||
const SLAPrintConfig& print_config() const { return m_print_config; }
|
const SLAPrintConfig& print_config() const { return m_print_config; }
|
||||||
const SLAPrinterConfig& printer_config() const { return m_printer_config; }
|
const SLAPrinterConfig& printer_config() const { return m_printer_config; }
|
||||||
const SLAMaterialConfig& material_config() const { return m_material_config; }
|
const SLAMaterialConfig& material_config() const { return m_material_config; }
|
||||||
|
const SLAPrintObjectConfig& default_object_config() const { return m_default_object_config; }
|
||||||
|
|
||||||
std::string output_filename() const override;
|
std::string output_filename() const override;
|
||||||
|
|
||||||
|
@ -5009,23 +5009,28 @@ void GLCanvas3D::_render_sla_slices() const
|
|||||||
|
|
||||||
if ((bottom_obj_triangles.empty() || bottom_sup_triangles.empty() || top_obj_triangles.empty() || top_sup_triangles.empty()) && obj->is_step_done(slaposIndexSlices))
|
if ((bottom_obj_triangles.empty() || bottom_sup_triangles.empty() || top_obj_triangles.empty() || top_sup_triangles.empty()) && obj->is_step_done(slaposIndexSlices))
|
||||||
{
|
{
|
||||||
|
double layer_height = print->default_object_config().layer_height.value;
|
||||||
double initial_layer_height = print->material_config().initial_layer_height.value;
|
double initial_layer_height = print->material_config().initial_layer_height.value;
|
||||||
LevelID key_zero = obj->get_slice_records().begin()->key();
|
LevelID key_zero = obj->get_slice_records().begin()->key();
|
||||||
LevelID key_low = LevelID((clip_min_z - initial_layer_height) / SCALING_FACTOR) + key_zero;
|
// Slice at the center of the slab starting at clip_min_z will be rendered for the lower plane.
|
||||||
|
LevelID key_low = LevelID((clip_min_z - initial_layer_height + layer_height) / SCALING_FACTOR) + key_zero;
|
||||||
|
// Slice at the center of the slab ending at clip_max_z will be rendered for the upper plane.
|
||||||
LevelID key_high = LevelID((clip_max_z - initial_layer_height) / SCALING_FACTOR) + key_zero;
|
LevelID key_high = LevelID((clip_max_z - initial_layer_height) / SCALING_FACTOR) + key_zero;
|
||||||
auto slice_range = obj->get_slice_records(key_low - LevelID(SCALED_EPSILON), key_high - LevelID(SCALED_EPSILON));
|
auto slice_range = obj->get_slice_records(key_low - LevelID(SCALED_EPSILON), key_high - LevelID(SCALED_EPSILON));
|
||||||
auto it_low = slice_range.begin();
|
auto it_low = slice_range.begin();
|
||||||
auto it_high = std::prev(slice_range.end());
|
auto it_high = std::prev(slice_range.end());
|
||||||
|
// Offset to avoid OpenGL Z fighting between the object's horizontal surfaces and the triangluated surfaces of the cuts.
|
||||||
|
double plane_shift_z = 0.002f;
|
||||||
|
|
||||||
if (! it_low.is_end() && it_low->key() < key_low + LevelID(SCALED_EPSILON)) {
|
if (! it_low.is_end() && it_low->key() < key_low + LevelID(SCALED_EPSILON)) {
|
||||||
const ExPolygons& obj_bottom = obj->get_slices_from_record(it_low, soModel);
|
const ExPolygons& obj_bottom = obj->get_slices_from_record(it_low, soModel);
|
||||||
const ExPolygons& sup_bottom = obj->get_slices_from_record(it_low, soSupport);
|
const ExPolygons& sup_bottom = obj->get_slices_from_record(it_low, soSupport);
|
||||||
// calculate model bottom cap
|
// calculate model bottom cap
|
||||||
if (bottom_obj_triangles.empty() && !obj_bottom.empty())
|
if (bottom_obj_triangles.empty() && !obj_bottom.empty())
|
||||||
bottom_obj_triangles = triangulate_expolygons_3d(obj_bottom, clip_min_z, true);
|
bottom_obj_triangles = triangulate_expolygons_3d(obj_bottom, clip_min_z - plane_shift_z, true);
|
||||||
// calculate support bottom cap
|
// calculate support bottom cap
|
||||||
if (bottom_sup_triangles.empty() && !sup_bottom.empty())
|
if (bottom_sup_triangles.empty() && !sup_bottom.empty())
|
||||||
bottom_sup_triangles = triangulate_expolygons_3d(sup_bottom, clip_min_z, true);
|
bottom_sup_triangles = triangulate_expolygons_3d(sup_bottom, clip_min_z - plane_shift_z, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! it_high.is_end() && it_high->key() < key_high + LevelID(SCALED_EPSILON)) {
|
if (! it_high.is_end() && it_high->key() < key_high + LevelID(SCALED_EPSILON)) {
|
||||||
@ -5033,10 +5038,10 @@ void GLCanvas3D::_render_sla_slices() const
|
|||||||
const ExPolygons& sup_top = obj->get_slices_from_record(it_high, soSupport);
|
const ExPolygons& sup_top = obj->get_slices_from_record(it_high, soSupport);
|
||||||
// calculate model top cap
|
// calculate model top cap
|
||||||
if (top_obj_triangles.empty() && !obj_top.empty())
|
if (top_obj_triangles.empty() && !obj_top.empty())
|
||||||
top_obj_triangles = triangulate_expolygons_3d(obj_top, clip_max_z, false);
|
top_obj_triangles = triangulate_expolygons_3d(obj_top, clip_max_z + plane_shift_z, false);
|
||||||
// calculate support top cap
|
// calculate support top cap
|
||||||
if (top_sup_triangles.empty() && !sup_top.empty())
|
if (top_sup_triangles.empty() && !sup_top.empty())
|
||||||
top_sup_triangles = triangulate_expolygons_3d(sup_top, clip_max_z, false);
|
top_sup_triangles = triangulate_expolygons_3d(sup_top, clip_max_z + plane_shift_z, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user