Tech ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE set as default
This commit is contained in:
parent
23b6a597a8
commit
50c6fc1719
7 changed files with 1 additions and 176 deletions
|
@ -939,14 +939,9 @@ void GCode::_do_export(Print& print, FILE* file, ThumbnailsGeneratorCallback thu
|
||||||
m_last_height = 0.f;
|
m_last_height = 0.f;
|
||||||
m_last_layer_z = 0.f;
|
m_last_layer_z = 0.f;
|
||||||
m_max_layer_z = 0.f;
|
m_max_layer_z = 0.f;
|
||||||
#if ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE
|
|
||||||
m_last_width = 0.f;
|
m_last_width = 0.f;
|
||||||
#endif // ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE
|
|
||||||
#if ENABLE_GCODE_VIEWER_DATA_CHECKING
|
#if ENABLE_GCODE_VIEWER_DATA_CHECKING
|
||||||
m_last_mm3_per_mm = 0.;
|
m_last_mm3_per_mm = 0.;
|
||||||
#if !ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE
|
|
||||||
m_last_width = 0.f;
|
|
||||||
#endif // !ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE
|
|
||||||
#endif // ENABLE_GCODE_VIEWER_DATA_CHECKING
|
#endif // ENABLE_GCODE_VIEWER_DATA_CHECKING
|
||||||
|
|
||||||
// How many times will be change_layer() called?
|
// How many times will be change_layer() called?
|
||||||
|
@ -2644,13 +2639,11 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description,
|
||||||
gcode += buf;
|
gcode += buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE
|
|
||||||
if (last_was_wipe_tower || m_last_width != path.width) {
|
if (last_was_wipe_tower || m_last_width != path.width) {
|
||||||
m_last_width = path.width;
|
m_last_width = path.width;
|
||||||
sprintf(buf, ";%s%g\n", GCodeProcessor::Width_Tag.c_str(), m_last_width);
|
sprintf(buf, ";%s%g\n", GCodeProcessor::Width_Tag.c_str(), m_last_width);
|
||||||
gcode += buf;
|
gcode += buf;
|
||||||
}
|
}
|
||||||
#endif // ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE
|
|
||||||
|
|
||||||
#if ENABLE_GCODE_VIEWER_DATA_CHECKING
|
#if ENABLE_GCODE_VIEWER_DATA_CHECKING
|
||||||
if (last_was_wipe_tower || (m_last_mm3_per_mm != path.mm3_per_mm)) {
|
if (last_was_wipe_tower || (m_last_mm3_per_mm != path.mm3_per_mm)) {
|
||||||
|
@ -2658,14 +2651,6 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description,
|
||||||
sprintf(buf, ";%s%f\n", GCodeProcessor::Mm3_Per_Mm_Tag.c_str(), m_last_mm3_per_mm);
|
sprintf(buf, ";%s%f\n", GCodeProcessor::Mm3_Per_Mm_Tag.c_str(), m_last_mm3_per_mm);
|
||||||
gcode += buf;
|
gcode += buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE
|
|
||||||
if (last_was_wipe_tower || m_last_width != path.width) {
|
|
||||||
m_last_width = path.width;
|
|
||||||
sprintf(buf, ";%s%g\n", GCodeProcessor::Width_Tag.c_str(), m_last_width);
|
|
||||||
gcode += buf;
|
|
||||||
}
|
|
||||||
#endif // !ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE
|
|
||||||
#endif // ENABLE_GCODE_VIEWER_DATA_CHECKING
|
#endif // ENABLE_GCODE_VIEWER_DATA_CHECKING
|
||||||
|
|
||||||
if (last_was_wipe_tower || std::abs(m_last_height - path.height) > EPSILON) {
|
if (last_was_wipe_tower || std::abs(m_last_height - path.height) > EPSILON) {
|
||||||
|
|
|
@ -131,14 +131,9 @@ public:
|
||||||
m_volumetric_speed(0),
|
m_volumetric_speed(0),
|
||||||
m_last_pos_defined(false),
|
m_last_pos_defined(false),
|
||||||
m_last_extrusion_role(erNone),
|
m_last_extrusion_role(erNone),
|
||||||
#if ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE
|
|
||||||
m_last_width(0.0f),
|
m_last_width(0.0f),
|
||||||
#endif // ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE
|
|
||||||
#if ENABLE_GCODE_VIEWER_DATA_CHECKING
|
#if ENABLE_GCODE_VIEWER_DATA_CHECKING
|
||||||
m_last_mm3_per_mm(0.0),
|
m_last_mm3_per_mm(0.0),
|
||||||
#if !ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE
|
|
||||||
m_last_width(0.0f),
|
|
||||||
#endif // !ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE
|
|
||||||
#endif // ENABLE_GCODE_VIEWER_DATA_CHECKING
|
#endif // ENABLE_GCODE_VIEWER_DATA_CHECKING
|
||||||
m_brim_done(false),
|
m_brim_done(false),
|
||||||
m_second_layer_things_done(false),
|
m_second_layer_things_done(false),
|
||||||
|
@ -333,14 +328,9 @@ private:
|
||||||
float m_last_height{ 0.0f };
|
float m_last_height{ 0.0f };
|
||||||
float m_last_layer_z{ 0.0f };
|
float m_last_layer_z{ 0.0f };
|
||||||
float m_max_layer_z{ 0.0f };
|
float m_max_layer_z{ 0.0f };
|
||||||
#if ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE
|
|
||||||
float m_last_width{ 0.0f };
|
float m_last_width{ 0.0f };
|
||||||
#endif // ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE
|
|
||||||
#if ENABLE_GCODE_VIEWER_DATA_CHECKING
|
#if ENABLE_GCODE_VIEWER_DATA_CHECKING
|
||||||
double m_last_mm3_per_mm;
|
double m_last_mm3_per_mm;
|
||||||
#if !ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE
|
|
||||||
float m_last_width{ 0.0f };
|
|
||||||
#endif // !ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE
|
|
||||||
#endif // ENABLE_GCODE_VIEWER_DATA_CHECKING
|
#endif // ENABLE_GCODE_VIEWER_DATA_CHECKING
|
||||||
|
|
||||||
Point m_last_pos;
|
Point m_last_pos;
|
||||||
|
|
|
@ -40,13 +40,8 @@ const std::string GCodeProcessor::Estimated_Printing_Time_Placeholder_Tag = "; _
|
||||||
const float GCodeProcessor::Wipe_Width = 0.05f;
|
const float GCodeProcessor::Wipe_Width = 0.05f;
|
||||||
const float GCodeProcessor::Wipe_Height = 0.05f;
|
const float GCodeProcessor::Wipe_Height = 0.05f;
|
||||||
|
|
||||||
#if ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE
|
|
||||||
const std::string GCodeProcessor::Width_Tag = "WIDTH:";
|
const std::string GCodeProcessor::Width_Tag = "WIDTH:";
|
||||||
#endif // ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE
|
|
||||||
#if ENABLE_GCODE_VIEWER_DATA_CHECKING
|
#if ENABLE_GCODE_VIEWER_DATA_CHECKING
|
||||||
#if !ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE
|
|
||||||
const std::string GCodeProcessor::Width_Tag = "WIDTH:";
|
|
||||||
#endif // !ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE
|
|
||||||
const std::string GCodeProcessor::Mm3_Per_Mm_Tag = "MM3_PER_MM:";
|
const std::string GCodeProcessor::Mm3_Per_Mm_Tag = "MM3_PER_MM:";
|
||||||
#endif // ENABLE_GCODE_VIEWER_DATA_CHECKING
|
#endif // ENABLE_GCODE_VIEWER_DATA_CHECKING
|
||||||
|
|
||||||
|
@ -799,10 +794,8 @@ void GCodeProcessor::reset()
|
||||||
m_feedrate = 0.0f;
|
m_feedrate = 0.0f;
|
||||||
m_width = 0.0f;
|
m_width = 0.0f;
|
||||||
m_height = 0.0f;
|
m_height = 0.0f;
|
||||||
#if ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE
|
|
||||||
m_forced_width = 0.0f;
|
m_forced_width = 0.0f;
|
||||||
m_forced_height = 0.0f;
|
m_forced_height = 0.0f;
|
||||||
#endif // ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE
|
|
||||||
m_mm3_per_mm = 0.0f;
|
m_mm3_per_mm = 0.0f;
|
||||||
m_fan_speed = 0.0f;
|
m_fan_speed = 0.0f;
|
||||||
|
|
||||||
|
@ -1133,7 +1126,6 @@ void GCodeProcessor::process_tags(const std::string_view comment)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE
|
|
||||||
if (!m_producers_enabled || m_producer == EProducer::PrusaSlicer) {
|
if (!m_producers_enabled || m_producer == EProducer::PrusaSlicer) {
|
||||||
// height tag
|
// height tag
|
||||||
if (starts_with(comment, Height_Tag)) {
|
if (starts_with(comment, Height_Tag)) {
|
||||||
|
@ -1148,24 +1140,6 @@ void GCodeProcessor::process_tags(const std::string_view comment)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
if ((!m_producers_enabled || m_producer == EProducer::PrusaSlicer) &&
|
|
||||||
starts_with(comment, Height_Tag)) {
|
|
||||||
// height tag
|
|
||||||
if (!parse_number(comment.substr(Height_Tag.size()), m_height))
|
|
||||||
BOOST_LOG_TRIVIAL(error) << "GCodeProcessor encountered an invalid value for Height (" << comment << ").";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if ENABLE_GCODE_VIEWER_DATA_CHECKING
|
|
||||||
// width tag
|
|
||||||
if (starts_with(comment, Width_Tag)) {
|
|
||||||
if (! parse_number(comment.substr(Width_Tag.size()), m_width_compare.last_tag_value))
|
|
||||||
BOOST_LOG_TRIVIAL(error) << "GCodeProcessor encountered an invalid value for Width (" << comment << ").";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif // ENABLE_GCODE_VIEWER_DATA_CHECKING
|
|
||||||
#endif // ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE
|
|
||||||
|
|
||||||
// color change tag
|
// color change tag
|
||||||
if (starts_with(comment, Color_Change_Tag)) {
|
if (starts_with(comment, Color_Change_Tag)) {
|
||||||
|
@ -1397,7 +1371,6 @@ bool GCodeProcessor::process_simplify3d_tags(const std::string_view comment)
|
||||||
}
|
}
|
||||||
|
|
||||||
// geometry
|
// geometry
|
||||||
#if ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE
|
|
||||||
// ; tool
|
// ; tool
|
||||||
std::string tag = " tool";
|
std::string tag = " tool";
|
||||||
pos = comment.find(tag);
|
pos = comment.find(tag);
|
||||||
|
@ -1423,35 +1396,6 @@ bool GCodeProcessor::process_simplify3d_tags(const std::string_view comment)
|
||||||
|
|
||||||
// ; layer
|
// ; layer
|
||||||
tag = " layer";
|
tag = " layer";
|
||||||
#else
|
|
||||||
#if ENABLE_GCODE_VIEWER_DATA_CHECKING
|
|
||||||
// ; tool
|
|
||||||
std::string tag = " tool";
|
|
||||||
pos = comment.find(tag);
|
|
||||||
if (pos == 0) {
|
|
||||||
const std::string_view data = comment.substr(pos + tag.length());
|
|
||||||
std::string h_tag = "H";
|
|
||||||
size_t h_start = data.find(h_tag);
|
|
||||||
size_t h_end = data.find_first_of(' ', h_start);
|
|
||||||
std::string w_tag = "W";
|
|
||||||
size_t w_start = data.find(w_tag);
|
|
||||||
size_t w_end = data.find_first_of(' ', w_start);
|
|
||||||
if (h_start != data.npos) {
|
|
||||||
if (! parse_number(data.substr(h_start + 1, (h_end != data.npos) ? h_end - h_start - 1 : h_end), m_height_compare.last_tag_value))
|
|
||||||
BOOST_LOG_TRIVIAL(error) << "GCodeProcessor encountered an invalid value for Height (" << comment << ").";
|
|
||||||
}
|
|
||||||
if (w_start != data.npos) {
|
|
||||||
if (! parse_number(data.substr(w_start + 1, (w_end != data.npos) ? w_end - w_start - 1 : w_end), m_width_compare.last_tag_value))
|
|
||||||
BOOST_LOG_TRIVIAL(error) << "GCodeProcessor encountered an invalid value for Width (" << comment << ").";
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
#endif // ENABLE_GCODE_VIEWER_DATA_CHECKING
|
|
||||||
|
|
||||||
// ; layer
|
|
||||||
std::string tag = " layer";
|
|
||||||
#endif // ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE
|
|
||||||
pos = comment.find(tag);
|
pos = comment.find(tag);
|
||||||
if (pos == 0) {
|
if (pos == 0) {
|
||||||
// skip lines "; layer end"
|
// skip lines "; layer end"
|
||||||
|
@ -1542,7 +1486,6 @@ bool GCodeProcessor::process_ideamaker_tags(const std::string_view comment)
|
||||||
}
|
}
|
||||||
|
|
||||||
// geometry
|
// geometry
|
||||||
#if ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE
|
|
||||||
// width
|
// width
|
||||||
tag = "WIDTH:";
|
tag = "WIDTH:";
|
||||||
pos = comment.find(tag);
|
pos = comment.find(tag);
|
||||||
|
@ -1560,27 +1503,6 @@ bool GCodeProcessor::process_ideamaker_tags(const std::string_view comment)
|
||||||
BOOST_LOG_TRIVIAL(error) << "GCodeProcessor encountered an invalid value for Height (" << comment << ").";
|
BOOST_LOG_TRIVIAL(error) << "GCodeProcessor encountered an invalid value for Height (" << comment << ").";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
#if ENABLE_GCODE_VIEWER_DATA_CHECKING
|
|
||||||
// width
|
|
||||||
tag = "WIDTH:";
|
|
||||||
pos = comment.find(tag);
|
|
||||||
if (pos != comment.npos) {
|
|
||||||
if (! parse_number(comment.substr(pos + tag.length()), m_width_compare.last_tag_value))
|
|
||||||
BOOST_LOG_TRIVIAL(error) << "GCodeProcessor encountered an invalid value for Width (" << comment << ").";
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// height
|
|
||||||
tag = "HEIGHT:";
|
|
||||||
pos = comment.find(tag);
|
|
||||||
if (pos != comment.npos) {
|
|
||||||
if (! parse_number(comment.substr(pos + tag.length()), m_height_compare.last_tag_value))
|
|
||||||
BOOST_LOG_TRIVIAL(error) << "GCodeProcessor encountered an invalid value for Height (" << comment << ").";
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
#endif // ENABLE_GCODE_VIEWER_DATA_CHECKING
|
|
||||||
#endif // ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE
|
|
||||||
|
|
||||||
// layer
|
// layer
|
||||||
pos = comment.find("LAYER:");
|
pos = comment.find("LAYER:");
|
||||||
|
@ -1809,7 +1731,6 @@ void GCodeProcessor::process_G1(const GCodeReader::GCodeLine& line)
|
||||||
m_mm3_per_mm_compare.update(area_toolpath_cross_section, m_extrusion_role);
|
m_mm3_per_mm_compare.update(area_toolpath_cross_section, m_extrusion_role);
|
||||||
#endif // ENABLE_GCODE_VIEWER_DATA_CHECKING
|
#endif // ENABLE_GCODE_VIEWER_DATA_CHECKING
|
||||||
|
|
||||||
#if ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE
|
|
||||||
if (m_forced_height > 0.0f)
|
if (m_forced_height > 0.0f)
|
||||||
m_height = m_forced_height;
|
m_height = m_forced_height;
|
||||||
else {
|
else {
|
||||||
|
@ -1822,25 +1743,10 @@ void GCodeProcessor::process_G1(const GCodeReader::GCodeLine& line)
|
||||||
#if ENABLE_GCODE_VIEWER_DATA_CHECKING
|
#if ENABLE_GCODE_VIEWER_DATA_CHECKING
|
||||||
m_height_compare.update(m_height, m_extrusion_role);
|
m_height_compare.update(m_height, m_extrusion_role);
|
||||||
#endif // ENABLE_GCODE_VIEWER_DATA_CHECKING
|
#endif // ENABLE_GCODE_VIEWER_DATA_CHECKING
|
||||||
#else
|
|
||||||
if ((m_producers_enabled && m_producer != EProducer::PrusaSlicer) || m_height == 0.0f) {
|
|
||||||
if (m_end_position[Z] > m_extruded_last_z + EPSILON) {
|
|
||||||
m_height = m_end_position[Z] - m_extruded_last_z;
|
|
||||||
#if ENABLE_GCODE_VIEWER_DATA_CHECKING
|
|
||||||
m_height_compare.update(m_height, m_extrusion_role);
|
|
||||||
#endif // ENABLE_GCODE_VIEWER_DATA_CHECKING
|
|
||||||
m_extruded_last_z = m_end_position[Z];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif // ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE
|
|
||||||
|
|
||||||
#if ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE
|
|
||||||
if (m_forced_width > 0.0f)
|
if (m_forced_width > 0.0f)
|
||||||
m_width = m_forced_width;
|
m_width = m_forced_width;
|
||||||
else if (m_extrusion_role == erExternalPerimeter)
|
else if (m_extrusion_role == erExternalPerimeter)
|
||||||
#else
|
|
||||||
if (m_extrusion_role == erExternalPerimeter)
|
|
||||||
#endif // ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE
|
|
||||||
// cross section: rectangle
|
// cross section: rectangle
|
||||||
m_width = delta_pos[E] * static_cast<float>(M_PI * sqr(1.05f * filament_radius)) / (delta_xyz * m_height);
|
m_width = delta_pos[E] * static_cast<float>(M_PI * sqr(1.05f * filament_radius)) / (delta_xyz * m_height);
|
||||||
else if (m_extrusion_role == erBridgeInfill || m_extrusion_role == erNone)
|
else if (m_extrusion_role == erBridgeInfill || m_extrusion_role == erNone)
|
||||||
|
|
|
@ -85,13 +85,8 @@ namespace Slic3r {
|
||||||
static const float Wipe_Width;
|
static const float Wipe_Width;
|
||||||
static const float Wipe_Height;
|
static const float Wipe_Height;
|
||||||
|
|
||||||
#if ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE
|
|
||||||
static const std::string Width_Tag;
|
static const std::string Width_Tag;
|
||||||
#endif // ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE
|
|
||||||
#if ENABLE_GCODE_VIEWER_DATA_CHECKING
|
#if ENABLE_GCODE_VIEWER_DATA_CHECKING
|
||||||
#if !ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE
|
|
||||||
static const std::string Width_Tag;
|
|
||||||
#endif // !ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE
|
|
||||||
static const std::string Mm3_Per_Mm_Tag;
|
static const std::string Mm3_Per_Mm_Tag;
|
||||||
#endif // ENABLE_GCODE_VIEWER_DATA_CHECKING
|
#endif // ENABLE_GCODE_VIEWER_DATA_CHECKING
|
||||||
|
|
||||||
|
@ -438,10 +433,8 @@ namespace Slic3r {
|
||||||
float m_feedrate; // mm/s
|
float m_feedrate; // mm/s
|
||||||
float m_width; // mm
|
float m_width; // mm
|
||||||
float m_height; // mm
|
float m_height; // mm
|
||||||
#if ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE
|
|
||||||
float m_forced_width; // mm
|
float m_forced_width; // mm
|
||||||
float m_forced_height; // mm
|
float m_forced_height; // mm
|
||||||
#endif // ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE
|
|
||||||
float m_mm3_per_mm;
|
float m_mm3_per_mm;
|
||||||
float m_fan_speed; // percentage
|
float m_fan_speed; // percentage
|
||||||
ExtrusionRole m_extrusion_role;
|
ExtrusionRole m_extrusion_role;
|
||||||
|
|
|
@ -46,12 +46,9 @@ public:
|
||||||
m_gcode += buf;
|
m_gcode += buf;
|
||||||
sprintf(buf, ";%s%s\n", GCodeProcessor::Extrusion_Role_Tag.c_str(), ExtrusionEntity::role_to_string(erWipeTower).c_str());
|
sprintf(buf, ";%s%s\n", GCodeProcessor::Extrusion_Role_Tag.c_str(), ExtrusionEntity::role_to_string(erWipeTower).c_str());
|
||||||
m_gcode += buf;
|
m_gcode += buf;
|
||||||
#if ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE || ENABLE_GCODE_VIEWER_DATA_CHECKING
|
|
||||||
change_analyzer_line_width(line_width);
|
change_analyzer_line_width(line_width);
|
||||||
#endif // ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE || ENABLE_GCODE_VIEWER_DATA_CHECKING
|
}
|
||||||
}
|
|
||||||
|
|
||||||
#if ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE
|
|
||||||
WipeTowerWriter& change_analyzer_line_width(float line_width) {
|
WipeTowerWriter& change_analyzer_line_width(float line_width) {
|
||||||
// adds tag for analyzer:
|
// adds tag for analyzer:
|
||||||
char buf[64];
|
char buf[64];
|
||||||
|
@ -59,19 +56,8 @@ public:
|
||||||
m_gcode += buf;
|
m_gcode += buf;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
#endif // ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE
|
|
||||||
|
|
||||||
#if ENABLE_GCODE_VIEWER_DATA_CHECKING
|
#if ENABLE_GCODE_VIEWER_DATA_CHECKING
|
||||||
#if !ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE
|
|
||||||
WipeTowerWriter& change_analyzer_line_width(float line_width) {
|
|
||||||
// adds tag for analyzer:
|
|
||||||
char buf[64];
|
|
||||||
sprintf(buf, ";%s%f\n", GCodeProcessor::Width_Tag.c_str(), line_width);
|
|
||||||
m_gcode += buf;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
#endif // !ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE
|
|
||||||
|
|
||||||
WipeTowerWriter& change_analyzer_mm3_per_mm(float len, float e) {
|
WipeTowerWriter& change_analyzer_mm3_per_mm(float len, float e) {
|
||||||
static const float area = float(M_PI) * 1.75f * 1.75f / 4.f;
|
static const float area = float(M_PI) * 1.75f * 1.75f / 4.f;
|
||||||
float mm3_per_mm = (len == 0.f ? 0.f : area * e / len);
|
float mm3_per_mm = (len == 0.f ? 0.f : area * e / len);
|
||||||
|
@ -874,12 +860,8 @@ void WipeTower::toolchange_Unload(
|
||||||
const float line_width = m_perimeter_width * m_filpar[m_current_tool].ramming_line_width_multiplicator; // desired ramming line thickness
|
const float line_width = m_perimeter_width * m_filpar[m_current_tool].ramming_line_width_multiplicator; // desired ramming line thickness
|
||||||
const float y_step = line_width * m_filpar[m_current_tool].ramming_step_multiplicator * m_extra_spacing; // spacing between lines in mm
|
const float y_step = line_width * m_filpar[m_current_tool].ramming_step_multiplicator * m_extra_spacing; // spacing between lines in mm
|
||||||
|
|
||||||
#if ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE || ENABLE_GCODE_VIEWER_DATA_CHECKING
|
|
||||||
writer.append("; CP TOOLCHANGE UNLOAD\n")
|
writer.append("; CP TOOLCHANGE UNLOAD\n")
|
||||||
.change_analyzer_line_width(line_width);
|
.change_analyzer_line_width(line_width);
|
||||||
#else
|
|
||||||
writer.append("; CP TOOLCHANGE UNLOAD\n");
|
|
||||||
#endif // ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE || ENABLE_GCODE_VIEWER_DATA_CHECKING
|
|
||||||
|
|
||||||
unsigned i = 0; // iterates through ramming_speed
|
unsigned i = 0; // iterates through ramming_speed
|
||||||
m_left_to_right = true; // current direction of ramming
|
m_left_to_right = true; // current direction of ramming
|
||||||
|
@ -942,9 +924,7 @@ void WipeTower::toolchange_Unload(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Vec2f end_of_ramming(writer.x(),writer.y());
|
Vec2f end_of_ramming(writer.x(),writer.y());
|
||||||
#if ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE || ENABLE_GCODE_VIEWER_DATA_CHECKING
|
|
||||||
writer.change_analyzer_line_width(m_perimeter_width); // so the next lines are not affected by ramming_line_width_multiplier
|
writer.change_analyzer_line_width(m_perimeter_width); // so the next lines are not affected by ramming_line_width_multiplier
|
||||||
#endif // ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE || ENABLE_GCODE_VIEWER_DATA_CHECKING
|
|
||||||
|
|
||||||
// Retraction:
|
// Retraction:
|
||||||
float old_x = writer.x();
|
float old_x = writer.x();
|
||||||
|
|
|
@ -96,7 +96,6 @@
|
||||||
//===================
|
//===================
|
||||||
#define ENABLE_2_3_0_BETA3 1
|
#define ENABLE_2_3_0_BETA3 1
|
||||||
|
|
||||||
#define ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE (1 && ENABLE_2_3_0_BETA3)
|
|
||||||
#define ENABLE_RENDER_PATH_REFRESH_AFTER_OPTIONS_CHANGE (1 && ENABLE_2_3_0_BETA3)
|
#define ENABLE_RENDER_PATH_REFRESH_AFTER_OPTIONS_CHANGE (1 && ENABLE_2_3_0_BETA3)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -127,11 +127,9 @@ void GCodeViewer::IBuffer::reset()
|
||||||
|
|
||||||
bool GCodeViewer::Path::matches(const GCodeProcessor::MoveVertex& move) const
|
bool GCodeViewer::Path::matches(const GCodeProcessor::MoveVertex& move) const
|
||||||
{
|
{
|
||||||
#if ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE
|
|
||||||
auto matches_percent = [](float value1, float value2, float max_percent) {
|
auto matches_percent = [](float value1, float value2, float max_percent) {
|
||||||
return std::abs(value2 - value1) / value1 <= max_percent;
|
return std::abs(value2 - value1) / value1 <= max_percent;
|
||||||
};
|
};
|
||||||
#endif // ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE
|
|
||||||
|
|
||||||
switch (move.type)
|
switch (move.type)
|
||||||
{
|
{
|
||||||
|
@ -144,29 +142,15 @@ bool GCodeViewer::Path::matches(const GCodeProcessor::MoveVertex& move) const
|
||||||
case EMoveType::Extrude: {
|
case EMoveType::Extrude: {
|
||||||
// use rounding to reduce the number of generated paths
|
// use rounding to reduce the number of generated paths
|
||||||
#if ENABLE_SPLITTED_VERTEX_BUFFER
|
#if ENABLE_SPLITTED_VERTEX_BUFFER
|
||||||
#if ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE
|
|
||||||
return type == move.type && extruder_id == move.extruder_id && cp_color_id == move.cp_color_id && role == move.extrusion_role &&
|
return type == move.type && extruder_id == move.extruder_id && cp_color_id == move.cp_color_id && role == move.extrusion_role &&
|
||||||
move.position[2] <= sub_paths.front().first.position[2] && feedrate == move.feedrate && fan_speed == move.fan_speed &&
|
move.position[2] <= sub_paths.front().first.position[2] && feedrate == move.feedrate && fan_speed == move.fan_speed &&
|
||||||
height == round_to_nearest(move.height, 2) && width == round_to_nearest(move.width, 2) &&
|
height == round_to_nearest(move.height, 2) && width == round_to_nearest(move.width, 2) &&
|
||||||
matches_percent(volumetric_rate, move.volumetric_rate(), 0.05f);
|
matches_percent(volumetric_rate, move.volumetric_rate(), 0.05f);
|
||||||
#else
|
#else
|
||||||
return type == move.type && move.position[2] <= sub_paths.front().position[2] && role == move.extrusion_role && height == round_to_nearest(move.height, 2) &&
|
|
||||||
width == round_to_nearest(move.width, 2) && feedrate == move.feedrate && fan_speed == move.fan_speed &&
|
|
||||||
volumetric_rate == round_to_nearest(move.volumetric_rate(), 2) && extruder_id == move.extruder_id &&
|
|
||||||
cp_color_id == move.cp_color_id;
|
|
||||||
#endif // ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE
|
|
||||||
#else
|
|
||||||
#if ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE
|
|
||||||
return type == move.type && extruder_id == move.extruder_id && cp_color_id == move.cp_color_id && role == move.extrusion_role &&
|
return type == move.type && extruder_id == move.extruder_id && cp_color_id == move.cp_color_id && role == move.extrusion_role &&
|
||||||
move.position[2] <= first.position[2] && feedrate == move.feedrate && fan_speed == move.fan_speed &&
|
move.position[2] <= first.position[2] && feedrate == move.feedrate && fan_speed == move.fan_speed &&
|
||||||
height == round_to_nearest(move.height, 2) && width == round_to_nearest(move.width, 2) &&
|
height == round_to_nearest(move.height, 2) && width == round_to_nearest(move.width, 2) &&
|
||||||
matches_percent(volumetric_rate, move.volumetric_rate(), 0.05f);
|
matches_percent(volumetric_rate, move.volumetric_rate(), 0.05f);
|
||||||
#else
|
|
||||||
return type == move.type && move.position[2] <= first.position[2] && role == move.extrusion_role && height == round_to_nearest(move.height, 2) &&
|
|
||||||
width == round_to_nearest(move.width, 2) && feedrate == move.feedrate && fan_speed == move.fan_speed &&
|
|
||||||
volumetric_rate == round_to_nearest(move.volumetric_rate(), 2) && extruder_id == move.extruder_id &&
|
|
||||||
cp_color_id == move.cp_color_id;
|
|
||||||
#endif // ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE
|
|
||||||
#endif // ENABLE_SPLITTED_VERTEX_BUFFER
|
#endif // ENABLE_SPLITTED_VERTEX_BUFFER
|
||||||
}
|
}
|
||||||
case EMoveType::Travel: {
|
case EMoveType::Travel: {
|
||||||
|
@ -195,25 +179,13 @@ void GCodeViewer::TBuffer::add_path(const GCodeProcessor::MoveVertex& move, unsi
|
||||||
Path::Endpoint endpoint = { b_id, i_id, s_id, move.position };
|
Path::Endpoint endpoint = { b_id, i_id, s_id, move.position };
|
||||||
// use rounding to reduce the number of generated paths
|
// use rounding to reduce the number of generated paths
|
||||||
#if ENABLE_SPLITTED_VERTEX_BUFFER
|
#if ENABLE_SPLITTED_VERTEX_BUFFER
|
||||||
#if ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE
|
|
||||||
paths.push_back({ move.type, move.extrusion_role, move.delta_extruder,
|
paths.push_back({ move.type, move.extrusion_role, move.delta_extruder,
|
||||||
round_to_nearest(move.height, 2), round_to_nearest(move.width, 2), move.feedrate, move.fan_speed,
|
round_to_nearest(move.height, 2), round_to_nearest(move.width, 2), move.feedrate, move.fan_speed,
|
||||||
move.volumetric_rate(), move.extruder_id, move.cp_color_id, { { endpoint, endpoint } } });
|
move.volumetric_rate(), move.extruder_id, move.cp_color_id, { { endpoint, endpoint } } });
|
||||||
#else
|
#else
|
||||||
paths.push_back({ move.type, move.extrusion_role, move.delta_extruder,
|
|
||||||
round_to_nearest(move.height, 2), round_to_nearest(move.width, 2), move.feedrate, move.fan_speed,
|
|
||||||
round_to_nearest(move.volumetric_rate(), 2), move.extruder_id, move.cp_color_id, { { endpoint, endpoint } } });
|
|
||||||
#endif // ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE
|
|
||||||
#else
|
|
||||||
#if ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE
|
|
||||||
paths.push_back({ move.type, move.extrusion_role, endpoint, endpoint, move.delta_extruder,
|
paths.push_back({ move.type, move.extrusion_role, endpoint, endpoint, move.delta_extruder,
|
||||||
round_to_nearest(move.height, 2), round_to_nearest(move.width, 2), move.feedrate, move.fan_speed,
|
round_to_nearest(move.height, 2), round_to_nearest(move.width, 2), move.feedrate, move.fan_speed,
|
||||||
move.volumetric_rate(), move.extruder_id, move.cp_color_id });
|
move.volumetric_rate(), move.extruder_id, move.cp_color_id });
|
||||||
#else
|
|
||||||
paths.push_back({ move.type, move.extrusion_role, endpoint, endpoint, move.delta_extruder,
|
|
||||||
round_to_nearest(move.height, 2), round_to_nearest(move.width, 2), move.feedrate, move.fan_speed,
|
|
||||||
round_to_nearest(move.volumetric_rate(), 2), move.extruder_id, move.cp_color_id });
|
|
||||||
#endif // ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE
|
|
||||||
#endif // ENABLE_SPLITTED_VERTEX_BUFFER
|
#endif // ENABLE_SPLITTED_VERTEX_BUFFER
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue