mirror of
https://github.com/QIDITECH/QIDISlicer.git
synced 2026-02-04 18:08:44 +03:00
exclude_object
This commit is contained in:
@@ -1487,6 +1487,13 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
|
|||||||
// Write end commands to file.
|
// Write end commands to file.
|
||||||
file.write(this->retract());
|
file.write(this->retract());
|
||||||
|
|
||||||
|
//B38
|
||||||
|
{
|
||||||
|
std::string gcode;
|
||||||
|
m_writer.add_object_change_labels(gcode);
|
||||||
|
file.write(gcode);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
file.write(m_writer.set_fan(0));
|
file.write(m_writer.set_fan(0));
|
||||||
|
|
||||||
@@ -2458,7 +2465,8 @@ void GCode::process_layer_single_object(
|
|||||||
++ object_id;
|
++ object_id;
|
||||||
gcode += std::string("; printing object ") + print_object.model_object()->name + " id:" + std::to_string(object_id) + " copy " + std::to_string(print_instance.instance_id) + "\n";
|
gcode += std::string("; printing object ") + print_object.model_object()->name + " id:" + std::to_string(object_id) + " copy " + std::to_string(print_instance.instance_id) + "\n";
|
||||||
//B38
|
//B38
|
||||||
gcode += std::string("EXCLUDE_OBJECT_START NAME=") + print_object.model_object()->name + "\n";
|
//gcode += std::string("EXCLUDE_OBJECT_START NAME=") + print_object.model_object()->name + "\n";
|
||||||
|
m_writer.set_object_start_str(std::string("EXCLUDE_OBJECT_START NAME=") + print_object.model_object()->name + "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -2636,7 +2644,12 @@ void GCode::process_layer_single_object(
|
|||||||
gcode += std::string("; stop printing object ") + print_object.model_object()->name + " id:" + std::to_string(object_id) +
|
gcode += std::string("; stop printing object ") + print_object.model_object()->name + " id:" + std::to_string(object_id) +
|
||||||
" copy " + std::to_string(print_instance.instance_id) + "\n";
|
" copy " + std::to_string(print_instance.instance_id) + "\n";
|
||||||
//B38
|
//B38
|
||||||
gcode += std::string("EXCLUDE_OBJECT_END NAME=") + print_object.model_object()->name + "\n";
|
//gcode += std::string("EXCLUDE_OBJECT_END NAME=") + print_object.model_object()->name + "\n";
|
||||||
|
if (!m_writer.is_object_start_str_empty()) {
|
||||||
|
m_writer.set_object_start_str("");
|
||||||
|
} else {
|
||||||
|
m_writer.set_object_end_str(std::string("EXCLUDE_OBJECT_END NAME=") + print_object.model_object()->name + "\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -2719,6 +2732,10 @@ std::string GCode::change_layer(coordf_t print_z)
|
|||||||
gcode += this->retract();
|
gcode += this->retract();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//B38
|
||||||
|
m_writer.add_object_change_labels(gcode);
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
std::ostringstream comment;
|
std::ostringstream comment;
|
||||||
comment << "move to next layer (" << m_layer_index << ")";
|
comment << "move to next layer (" << m_layer_index << ")";
|
||||||
@@ -3011,6 +3028,8 @@ std::string GCode::_extrude(const ExtrusionPath &path, const std::string_view de
|
|||||||
gcode += this->travel_to(path.first_point(), path.role(), comment);
|
gcode += this->travel_to(path.first_point(), path.role(), comment);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//B38
|
||||||
|
m_writer.add_object_change_labels(gcode);
|
||||||
|
|
||||||
// compensate retraction
|
// compensate retraction
|
||||||
gcode += this->unretract();
|
gcode += this->unretract();
|
||||||
@@ -3311,6 +3330,9 @@ std::string GCode::travel_to(const Point &point, ExtrusionRole role, std::string
|
|||||||
// Reset the wipe path when traveling, so one would not wipe along an old path.
|
// Reset the wipe path when traveling, so one would not wipe along an old path.
|
||||||
m_wipe.reset_path();
|
m_wipe.reset_path();
|
||||||
|
|
||||||
|
//B38
|
||||||
|
m_writer.add_object_change_labels(gcode);
|
||||||
|
|
||||||
|
|
||||||
// use G1 because we rely on paths being straight (G0 may make round paths)
|
// use G1 because we rely on paths being straight (G0 may make round paths)
|
||||||
if (travel.size() >= 2) {
|
if (travel.size() >= 2) {
|
||||||
|
|||||||
@@ -601,27 +601,27 @@ std::string GCodeWriter::set_fan(unsigned int speed) const
|
|||||||
|
|
||||||
|
|
||||||
//B38
|
//B38
|
||||||
//void GCodeWriter::add_object_start_labels(std::string &gcode)
|
void GCodeWriter::add_object_start_labels(std::string &gcode)
|
||||||
//{
|
{
|
||||||
// if (!m_gcode_label_objects_start.empty()) {
|
if (!m_gcode_label_objects_start.empty()) {
|
||||||
// gcode += m_gcode_label_objects_start;
|
gcode += m_gcode_label_objects_start;
|
||||||
// m_gcode_label_objects_start = "";
|
m_gcode_label_objects_start = "";
|
||||||
// }
|
}
|
||||||
//}
|
}
|
||||||
//
|
|
||||||
//void GCodeWriter::add_object_end_labels(std::string &gcode)
|
void GCodeWriter::add_object_end_labels(std::string &gcode)
|
||||||
//{
|
{
|
||||||
// if (!m_gcode_label_objects_end.empty()) {
|
if (!m_gcode_label_objects_end.empty()) {
|
||||||
// gcode += m_gcode_label_objects_end;
|
gcode += m_gcode_label_objects_end;
|
||||||
// m_gcode_label_objects_end = "";
|
m_gcode_label_objects_end = "";
|
||||||
// }
|
}
|
||||||
//}
|
}
|
||||||
//
|
|
||||||
//void GCodeWriter::add_object_change_labels(std::string &gcode)
|
void GCodeWriter::add_object_change_labels(std::string &gcode)
|
||||||
//{
|
{
|
||||||
// add_object_end_labels(gcode);
|
add_object_end_labels(gcode);
|
||||||
// add_object_start_labels(gcode);
|
add_object_start_labels(gcode);
|
||||||
//}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GCodeFormatter::emit_axis(const char axis, const double v, size_t digits) {
|
void GCodeFormatter::emit_axis(const char axis, const double v, size_t digits) {
|
||||||
|
|||||||
@@ -102,13 +102,13 @@ public:
|
|||||||
void set_is_first_layer(bool bval) { m_is_first_layer = bval; }
|
void set_is_first_layer(bool bval) { m_is_first_layer = bval; }
|
||||||
|
|
||||||
//B38
|
//B38
|
||||||
//void set_object_start_str(std::string start_string) { m_gcode_label_objects_start = start_string; }
|
void set_object_start_str(std::string start_string) { m_gcode_label_objects_start = start_string; }
|
||||||
//bool empty_object_start_str() { return m_gcode_label_objects_start.empty(); }
|
bool is_object_start_str_empty() { return m_gcode_label_objects_start.empty(); }
|
||||||
//void set_object_end_str(std::string end_string) { m_gcode_label_objects_end = end_string; }
|
void set_object_end_str(std::string end_string) { m_gcode_label_objects_end = end_string; }
|
||||||
//bool empty_object_end_str() { return m_gcode_label_objects_end.empty(); }
|
bool is_object_end_str_empty() { return m_gcode_label_objects_end.empty(); }
|
||||||
//void add_object_start_labels(std::string &gcode);
|
void add_object_start_labels(std::string &gcode);
|
||||||
//void add_object_end_labels(std::string &gcode);
|
void add_object_end_labels(std::string &gcode);
|
||||||
//void add_object_change_labels(std::string &gcode);
|
void add_object_change_labels(std::string &gcode);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -135,9 +135,9 @@ private:
|
|||||||
//B36
|
//B36
|
||||||
bool m_is_first_layer = true;
|
bool m_is_first_layer = true;
|
||||||
|
|
||||||
////B38
|
//B38
|
||||||
//std::string m_gcode_label_objects_start;
|
std::string m_gcode_label_objects_start;
|
||||||
//std::string m_gcode_label_objects_end;
|
std::string m_gcode_label_objects_end;
|
||||||
|
|
||||||
enum class Acceleration {
|
enum class Acceleration {
|
||||||
Travel,
|
Travel,
|
||||||
|
|||||||
Reference in New Issue
Block a user