PRUSA 2.7.0

This commit is contained in:
sunsets
2023-12-27 18:02:35 +08:00
parent b33112327f
commit 0a3c63dcb1
488 changed files with 92371 additions and 29443 deletions

View File

@@ -654,11 +654,14 @@ public:
GLModel m_model;
Vec3f m_world_position;
Transform3f m_world_transform;
// for seams, the position of the marker is on the last endpoint of the toolpath containing it
// the offset is used to show the correct value of tool position in the "ToolPosition" window
// see implementation of render() method
// For seams, the position of the marker is on the last endpoint of the toolpath containing it.
// This offset is used to show the correct value of tool position in the "ToolPosition" window.
// See implementation of render() method
Vec3f m_world_offset;
float m_z_offset{ 0.5f };
// z offset of the print
float m_z_offset{ 0.0f };
// z offset of the model
float m_model_z_offset{ 0.5f };
bool m_visible{ true };
//B43
GCodeProcessorResult::MoveVertex m_curr_move;
@@ -670,6 +673,7 @@ public:
void set_world_position(const Vec3f& position);
void set_world_offset(const Vec3f& offset) { m_world_offset = offset; }
void set_z_offset(float z_offset) { m_z_offset = z_offset; }
bool is_visible() const { return m_visible; }
void set_visible(bool visible) { m_visible = visible; }
@@ -686,32 +690,42 @@ public:
std::string parameters;
std::string comment;
};
struct Range
{
std::optional<size_t> min;
std::optional<size_t> max;
bool empty() const {
return !min.has_value() || !max.has_value();
}
bool contains(const Range& other) const {
return !this->empty() && !other.empty() && *this->min <= *other.min && *this->max >= other.max;
}
size_t size() const {
return empty() ? 0 : *this->max - *this->min + 1;
}
};
bool m_visible{ true };
uint64_t m_selected_line_id{ 0 };
size_t m_last_lines_size{ 0 };
std::string m_filename;
boost::iostreams::mapped_file_source m_file;
bool m_is_binary_file{ false };
// map for accessing data in file by line number
std::vector<size_t> m_lines_ends;
// current visible lines
std::vector<Line> m_lines;
std::vector<std::vector<size_t>> m_lines_ends;
std::vector<Line> m_lines_cache;
Range m_cache_range;
size_t m_max_line_length{ 0 };
public:
GCodeWindow() = default;
~GCodeWindow() { stop_mapping_file(); }
void load_gcode(const std::string& filename, const std::vector<size_t>& lines_ends);
void load_gcode(const GCodeProcessorResult& gcode_result);
void reset() {
stop_mapping_file();
m_lines_ends.clear();
m_lines.clear();
m_lines_cache.clear();
m_filename.clear();
}
void toggle_visibility() { m_visible = !m_visible; }
void render(float top, float bottom, size_t curr_line_id);
void render(float top, float bottom, uint64_t curr_line_id) const;
void stop_mapping_file();
private:
void add_gcode_line_to_lines_cache(const std::string& src);
};
struct Endpoints
@@ -767,6 +781,7 @@ private:
const GCodeProcessorResult *m_gcode_result;
float m_max_print_height{ 0.0f };
float m_z_offset{ 0.0f };
std::vector<ColorRGBA> m_tool_colors;
Layers m_layers;
std::array<unsigned int, 2> m_layers_z_range;
@@ -827,10 +842,13 @@ public:
const BoundingBoxf3& get_max_bounding_box() const {
BoundingBoxf3& max_bounding_box = const_cast<BoundingBoxf3&>(m_max_bounding_box);
if (!max_bounding_box.defined) {
if (m_shells_bounding_box.defined)
max_bounding_box = m_shells_bounding_box;
if (m_paths_bounding_box.defined) {
max_bounding_box.merge(m_paths_bounding_box);
max_bounding_box.merge(m_paths_bounding_box.max + m_sequential_view.marker.get_bounding_box().size().z() * Vec3d::UnitZ());
}
}
return m_max_bounding_box;
}
const std::vector<double>& get_layers_zs() const { return m_layers.get_zs(); }