mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-20 03:43:52 +00:00
Fix nozzle marker position
This commit is contained in:
@@ -1326,6 +1326,8 @@ void GCodeProcessor::process_buffer(const std::string &buffer)
|
|||||||
|
|
||||||
void GCodeProcessor::finalize(bool post_process)
|
void GCodeProcessor::finalize(bool post_process)
|
||||||
{
|
{
|
||||||
|
m_result.z_offset = m_z_offset;
|
||||||
|
|
||||||
// update width/height of wipe moves
|
// update width/height of wipe moves
|
||||||
for (GCodeProcessorResult::MoveVertex& move : m_result.moves) {
|
for (GCodeProcessorResult::MoveVertex& move : m_result.moves) {
|
||||||
if (move.type == EMoveType::Wipe) {
|
if (move.type == EMoveType::Wipe) {
|
||||||
|
|||||||
@@ -202,6 +202,7 @@ class Print;
|
|||||||
int timelapse_warning_code {0};
|
int timelapse_warning_code {0};
|
||||||
bool support_traditional_timelapse{true};
|
bool support_traditional_timelapse{true};
|
||||||
float printable_height;
|
float printable_height;
|
||||||
|
float z_offset;
|
||||||
SettingsIds settings_ids;
|
SettingsIds settings_ids;
|
||||||
size_t extruders_count;
|
size_t extruders_count;
|
||||||
bool backtrace_enabled;
|
bool backtrace_enabled;
|
||||||
|
|||||||
@@ -856,7 +856,6 @@ void GCodeViewer::SequentialView::GCodeWindow::stop_mapping_file()
|
|||||||
void GCodeViewer::SequentialView::render(const bool has_render_path, float legend_height, const libvgcode::Viewer* viewer, uint32_t gcode_id, int canvas_width, int canvas_height, int right_margin, const libvgcode::EViewType& view_type)
|
void GCodeViewer::SequentialView::render(const bool has_render_path, float legend_height, const libvgcode::Viewer* viewer, uint32_t gcode_id, int canvas_width, int canvas_height, int right_margin, const libvgcode::EViewType& view_type)
|
||||||
{
|
{
|
||||||
if (has_render_path && m_show_marker) {
|
if (has_render_path && m_show_marker) {
|
||||||
// marker.set_world_position(current_position);
|
|
||||||
// marker.set_world_offset(current_offset);
|
// marker.set_world_offset(current_offset);
|
||||||
|
|
||||||
marker.render(canvas_width, canvas_height, view_type);
|
marker.render(canvas_width, canvas_height, view_type);
|
||||||
@@ -1205,6 +1204,7 @@ void GCodeViewer::load_as_gcode(const GCodeProcessorResult& gcode_result, const
|
|||||||
m_custom_gcode_per_print_z = gcode_result.custom_gcode_per_print_z;
|
m_custom_gcode_per_print_z = gcode_result.custom_gcode_per_print_z;
|
||||||
|
|
||||||
m_max_print_height = gcode_result.printable_height;
|
m_max_print_height = gcode_result.printable_height;
|
||||||
|
m_z_offset = gcode_result.z_offset;
|
||||||
|
|
||||||
//BBS: add mutex for protection of gcode result
|
//BBS: add mutex for protection of gcode result
|
||||||
// if (m_layers.empty()) {
|
// if (m_layers.empty()) {
|
||||||
@@ -1363,6 +1363,7 @@ void GCodeViewer::reset()
|
|||||||
m_paths_bounding_box = BoundingBoxf3();
|
m_paths_bounding_box = BoundingBoxf3();
|
||||||
m_max_bounding_box = BoundingBoxf3();
|
m_max_bounding_box = BoundingBoxf3();
|
||||||
m_max_print_height = 0.0f;
|
m_max_print_height = 0.0f;
|
||||||
|
m_z_offset = 0.0f;
|
||||||
m_extruders_count = 0; // TODO
|
m_extruders_count = 0; // TODO
|
||||||
// m_extruder_ids = std::vector<unsigned char>(); // TODO
|
// m_extruder_ids = std::vector<unsigned char>(); // TODO
|
||||||
m_filament_diameters = std::vector<float>();
|
m_filament_diameters = std::vector<float>();
|
||||||
@@ -1403,6 +1404,9 @@ void GCodeViewer::render(int canvas_width, int canvas_height, int right_margin)
|
|||||||
auto current = m_viewer.get_view_visible_range(); // TODO: verify
|
auto current = m_viewer.get_view_visible_range(); // TODO: verify
|
||||||
auto endpoints = m_viewer.get_view_full_range();
|
auto endpoints = m_viewer.get_view_full_range();
|
||||||
m_sequential_view.m_show_marker = m_sequential_view.m_show_marker || (current.back() != endpoints.back() && !m_no_render_path);
|
m_sequential_view.m_show_marker = m_sequential_view.m_show_marker || (current.back() != endpoints.back() && !m_no_render_path);
|
||||||
|
const libvgcode::PathVertex& curr_vertex = m_viewer.get_current_vertex();
|
||||||
|
m_sequential_view.marker.set_world_position(libvgcode::convert(curr_vertex.position));
|
||||||
|
m_sequential_view.marker.set_z_offset(m_z_offset + 0.5f);
|
||||||
// BBS fixed buttom margin. m_moves_slider.pos_y
|
// BBS fixed buttom margin. m_moves_slider.pos_y
|
||||||
m_sequential_view.render(!m_no_render_path, legend_height, &m_viewer, m_viewer.get_current_vertex().gcode_id, canvas_width, canvas_height - bottom_margin * m_scale, right_margin * m_scale, m_viewer.get_view_type());
|
m_sequential_view.render(!m_no_render_path, legend_height, &m_viewer, m_viewer.get_current_vertex().gcode_id, canvas_width, canvas_height - bottom_margin * m_scale, right_margin * m_scale, m_viewer.get_view_type());
|
||||||
|
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ public:
|
|||||||
// the offset is used to show the correct value of tool position in the "ToolPosition" window
|
// the offset is used to show the correct value of tool position in the "ToolPosition" window
|
||||||
// see implementation of render() method
|
// see implementation of render() method
|
||||||
Vec3f m_world_offset;
|
Vec3f m_world_offset;
|
||||||
float m_z_offset{ 0.5f };
|
float m_z_offset{ 0.0f };
|
||||||
// z offset of the model
|
// z offset of the model
|
||||||
float m_model_z_offset{ 0.5f };
|
float m_model_z_offset{ 0.5f };
|
||||||
GCodeProcessorResult::MoveVertex m_curr_move;
|
GCodeProcessorResult::MoveVertex m_curr_move;
|
||||||
@@ -97,6 +97,7 @@ public:
|
|||||||
|
|
||||||
void set_world_position(const Vec3f& position) { m_world_position = position; }
|
void set_world_position(const Vec3f& position) { m_world_position = position; }
|
||||||
void set_world_offset(const Vec3f& offset) { m_world_offset = offset; }
|
void set_world_offset(const Vec3f& offset) { m_world_offset = offset; }
|
||||||
|
void set_z_offset(float z_offset) { m_z_offset = z_offset; }
|
||||||
|
|
||||||
#if ENABLE_ACTUAL_SPEED_DEBUG
|
#if ENABLE_ACTUAL_SPEED_DEBUG
|
||||||
void set_actual_speed_y_range(const std::pair<float, float>& y_range) {
|
void set_actual_speed_y_range(const std::pair<float, float>& y_range) {
|
||||||
@@ -187,6 +188,7 @@ private:
|
|||||||
//BBS: add shell bounding box
|
//BBS: add shell bounding box
|
||||||
BoundingBoxf3 m_shell_bounding_box;
|
BoundingBoxf3 m_shell_bounding_box;
|
||||||
float m_max_print_height{ 0.0f };
|
float m_max_print_height{ 0.0f };
|
||||||
|
float m_z_offset{ 0.0f };
|
||||||
|
|
||||||
ConfigOptionMode m_user_mode;
|
ConfigOptionMode m_user_mode;
|
||||||
bool m_fold = {false};
|
bool m_fold = {false};
|
||||||
|
|||||||
Reference in New Issue
Block a user