mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-18 20:28:08 -06:00
ENH: add traditional timelapse without wipe tower
Change-Id: I77792fb1a7af2ee95242c6f2501371dc0745287f (cherry picked from commit f6d434cc8b6c8d11d16bbabf9600c2f2b63868db)
This commit is contained in:
parent
4987f19147
commit
05625a5e43
10 changed files with 90 additions and 24 deletions
|
@ -152,7 +152,7 @@
|
|||
"silent_mode": "0",
|
||||
"single_extruder_multi_material": "1",
|
||||
"change_filament_gcode": "M620 S[next_extruder]A\nM204 S9000\n{if toolchange_count > 1}\nG17\nG2 Z{max_layer_z + 0.4} I0.86 J0.86 P1 F10000 ; spiral lift a little from second lift\n{endif}\nG1 Z{max_layer_z + 3.0} F1200\n\nG1 X70 F12000\nG1 Y245\nG1 Y265 F3000\nM400\nM106 P1 S0\n{if old_filament_temp > 0 && next_extruder < 255}M109 S[old_filament_temp]{endif}\nG1 X90 F3000\nG1 Y250 F4000\nG1 X100 F5000\nG1 X120 F12000\n\nG1 X20 Y50 F12000\nG1 Y-3\n\nT[next_extruder]\n\n; always use highest temperature to flush\nM400\nM109 S[nozzle_temperature_range_high]\n\n{if next_extruder < 255}\nG1 X54 F12000\nG1 Y265\n\nM400\n\nG92 E0\n{if flush_length_1 > 1}\n; FLUSH_START\n{if flush_length_1 > 23.7}\nG1 E23.7 F{old_filament_e_feedrate} ; do not need pulsatile flushing for start part\nG1 E{(flush_length_1 - 23.7) * 0.02} F50\nG1 E{(flush_length_1 - 23.7) * 0.23} F{old_filament_e_feedrate}\nG1 E{(flush_length_1 - 23.7) * 0.02} F50\nG1 E{(flush_length_1 - 23.7) * 0.23} F{new_filament_e_feedrate}\nG1 E{(flush_length_1 - 23.7) * 0.02} F50\nG1 E{(flush_length_1 - 23.7) * 0.23} F{new_filament_e_feedrate}\nG1 E{(flush_length_1 - 23.7) * 0.02} F50\nG1 E{(flush_length_1 - 23.7) * 0.23} F{new_filament_e_feedrate}\n{else}\nG1 E{flush_length_1} F{old_filament_e_feedrate}\n{endif}\n; FLUSH_END\nG1 E-[old_retract_length_toolchange] F1800\nG1 E[old_retract_length_toolchange] F300\n{endif}\n\n{if flush_length_2 > 1}\n; FLUSH_START\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\n; FLUSH_END\nG1 E-[new_retract_length_toolchange] F1800\nG1 E[new_retract_length_toolchange] F300\n{endif}\n\n{if flush_length_3 > 1}\n; FLUSH_START\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\n; FLUSH_END\nG1 E-[new_retract_length_toolchange] F1800\nG1 E[new_retract_length_toolchange] F300\n{endif}\n\n{if flush_length_4 > 1}\n; FLUSH_START\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\n; FLUSH_END\n{endif}\n\nM400\nM109 S[new_filament_temp]\n\nM400\nM106 P1 S255\nM400 S3\nG1 X80 F15000\nG1 X60 F15000\nG1 X80 F15000\nG1 X60 F15000; shake to put down garbage\n\nG92 E0\nG1 E-[new_retract_length_toolchange] F1800\n\nG1 X70 F5000\nG1 X90 F3000\nG1 Y255 F4000\nG1 X100 F5000\nG1 Y265 F5000\nG1 X70 F10000\nG1 X100 F5000\nG1 X70 F10000\nG1 X100 F5000\nG1 X165 F15000; wipe and shake\nG1 Y256 ; move Y to aside, prevent collision\nM400\nG1 Z[z_after_toolchange] F3000\n{if layer_z <= (initial_layer_print_height + 0.001)}\nM204 S[initial_layer_acceleration]\n{else}\nM204 S[default_acceleration]\n{endif}\n{else}\nG1 X[x_after_toolchange] Y[y_after_toolchange] Z[z_after_toolchange] F12000\n{endif}\nM621 S[next_extruder]A",
|
||||
"layer_change_gcode": "{if timelapse_no_toolhead}\nG92 E0\nG1 E-[retraction_length] F1800\nG1 X65 Y245 F12000 ; move to safe pos\nG1 Y265 F3000\nM400 P100\nM971 S11 C10 O0\nG92 E0\nG1 E[retraction_length] F300\nG1 X100 F5000\nG1 Y255\n{endif}",
|
||||
"layer_change_gcode": "{if timelapse_type == 1} ; timelapse with wipe tower\nG92 E0\nG1 E-[retraction_length] F1800\nG1 X65 Y245 F12000 ; move to safe pos\nG1 Y265 F3000\nM400 P100\nM971 S11 C10 O0\nG92 E0\nG1 E[retraction_length] F300\nG1 X100 F5000\nG1 Y255\n{elsif timelapse_type == 2} ; timelapse without wipe tower\nM971 S11 C10 O0\n{endif}",
|
||||
"machine_pause_gcode": "M400 U1\n",
|
||||
"wipe": [
|
||||
"1"
|
||||
|
|
|
@ -83,7 +83,7 @@ public:
|
|||
m_tool_change_idx(0),
|
||||
m_plate_origin(plate_origin),
|
||||
m_single_extruder_multi_material(print_config.single_extruder_multi_material),
|
||||
m_enable_timelapse_print(print_config.timelapse_no_toolhead.value),
|
||||
m_enable_timelapse_print(print_config.timelapse_type.value == TimelapseType::tlSmooth),
|
||||
m_is_first_print(true)
|
||||
{}
|
||||
|
||||
|
|
|
@ -545,7 +545,7 @@ WipeTower::WipeTower(const PrintConfig& config, int plate_idx, Vec3d plate_origi
|
|||
m_current_tool(initial_tool),
|
||||
//wipe_volumes(flush_matrix)
|
||||
m_wipe_volume(prime_volume),
|
||||
m_enable_timelapse_print(config.timelapse_no_toolhead.value)
|
||||
m_enable_timelapse_print(config.timelapse_type.value == TimelapseType::tlSmooth)
|
||||
{
|
||||
// Read absolute value of first layer speed, if given as percentage,
|
||||
// it is taken over following default. Speeds from config are not
|
||||
|
|
|
@ -683,7 +683,7 @@ static std::vector<std::string> s_Preset_print_options {
|
|||
"gcode_add_line_number", "enable_arc_fitting", "infill_combination", "adaptive_layer_height",
|
||||
"support_bottom_interface_spacing", "enable_overhang_speed", "overhang_1_4_speed", "overhang_2_4_speed", "overhang_3_4_speed", "overhang_4_4_speed",
|
||||
"initial_layer_infill_speed", "only_one_wall_top",
|
||||
"timelapse_no_toolhead"
|
||||
"timelapse_type"
|
||||
};
|
||||
|
||||
static std::vector<std::string> s_Preset_filament_options {
|
||||
|
|
|
@ -1756,7 +1756,7 @@ const WipeTowerData& Print::wipe_tower_data(size_t filaments_cnt) const
|
|||
|
||||
bool Print::enable_timelapse_print() const
|
||||
{
|
||||
return m_config.timelapse_no_toolhead.value;
|
||||
return m_config.timelapse_type.value == TimelapseType::tlSmooth;
|
||||
}
|
||||
|
||||
void Print::_make_wipe_tower()
|
||||
|
|
|
@ -12,6 +12,35 @@
|
|||
|
||||
#include <float.h>
|
||||
|
||||
namespace {
|
||||
std::set<std::string> SplitStringAndRemoveDuplicateElement(const std::string &str, const std::string &separator)
|
||||
{
|
||||
std::set<std::string> result;
|
||||
if (str.empty()) return result;
|
||||
|
||||
std::string strs = str + separator;
|
||||
size_t pos;
|
||||
size_t size = strs.size();
|
||||
|
||||
for (int i = 0; i < size; ++i) {
|
||||
pos = strs.find(separator, i);
|
||||
if (pos < size) {
|
||||
std::string sub_str = strs.substr(i, pos - i);
|
||||
result.insert(sub_str);
|
||||
i = pos + separator.size() - 1;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void ReplaceString(std::string &resource_str, const std::string &old_str, const std::string &new_str)
|
||||
{
|
||||
std::string::size_type pos = 0;
|
||||
while ((pos = resource_str.find(old_str)) != std::string::npos) { resource_str.replace(pos, old_str.length(), new_str); }
|
||||
}
|
||||
}
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
//! macro used to mark string used at localization,
|
||||
|
@ -187,6 +216,14 @@ static const t_config_enum_values s_keys_map_BrimType = {
|
|||
};
|
||||
CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(BrimType)
|
||||
|
||||
// using 0,1,2 to compatible with old files
|
||||
static const t_config_enum_values s_keys_map_TimelapseType = {
|
||||
{"0", tlClose},
|
||||
{"1", tlSmooth},
|
||||
{"2", tlTraditional}
|
||||
};
|
||||
CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(TimelapseType)
|
||||
|
||||
static const t_config_enum_values s_keys_map_DraftShield = {
|
||||
{ "disabled", dsDisabled },
|
||||
{ "limited", dsLimited },
|
||||
|
@ -2005,16 +2042,24 @@ void PrintConfigDef::init_fff_params()
|
|||
def->mode = comSimple;
|
||||
def->set_default_value(new ConfigOptionBool(false));
|
||||
|
||||
def = this->add("timelapse_no_toolhead", coBool);
|
||||
def = this->add("timelapse_type", coEnum);
|
||||
def->label = L("Timelapse");
|
||||
def->tooltip = L("If enabled, a timelapse video will be generated for each print. "
|
||||
"After each layer is printed, the toolhead will move to the excess chute, "
|
||||
"and then a snapshot is taken with the chamber camera. "
|
||||
def->tooltip = L("If smooth or traditional mode is selected, a timelapse video will be generated for each print. "
|
||||
"After each layer is printed, a snapshot is taken with the chamber camera. "
|
||||
"All of these snapshots are composed into a timelapse video when printing completes. "
|
||||
"If smooth mode is selected, the toolhead will move to the excess chute after each layer is printed "
|
||||
"and then take a snapshot. "
|
||||
"Since the melt filament may leak from the nozzle during the process of taking a snapshot, "
|
||||
"prime tower is required for nozzle priming.");
|
||||
"prime tower is required for smooth mode to wipe nozzle.");
|
||||
def->enum_keys_map = &ConfigOptionEnum<TimelapseType>::get_enum_values();
|
||||
def->enum_values.emplace_back("0");
|
||||
def->enum_values.emplace_back("1");
|
||||
def->enum_values.emplace_back("2");
|
||||
def->enum_labels.emplace_back(L("Close"));
|
||||
def->enum_labels.emplace_back(L("Smooth"));
|
||||
def->enum_labels.emplace_back(L("Traditional"));
|
||||
def->mode = comSimple;
|
||||
def->set_default_value(new ConfigOptionBool(false));
|
||||
def->set_default_value(new ConfigOptionEnum<TimelapseType>(tlClose));
|
||||
|
||||
def = this->add("standby_temperature_delta", coInt);
|
||||
def->label = L("Temperature variation");
|
||||
|
@ -3407,6 +3452,19 @@ void PrintConfigDef::handle_legacy(t_config_option_key &opt_key, std::string &va
|
|||
opt_key = "compatible_process_expression_group";
|
||||
} else if (opt_key == "cooling") {
|
||||
opt_key = "slow_down_for_layer_cooling";
|
||||
} else if (opt_key == "timelapse_no_toolhead") {
|
||||
opt_key = "timelapse_type";
|
||||
} else if (opt_key == "different_settings_to_system") {
|
||||
std::string copy_value = value;
|
||||
copy_value.erase(std::remove(copy_value.begin(), copy_value.end(), '\"'), copy_value.end()); // remove '"' in string
|
||||
std::set<std::string> split_keys = SplitStringAndRemoveDuplicateElement(copy_value, ";");
|
||||
for (std::string split_key : split_keys) {
|
||||
std::string copy_key = split_key, copy_value = "";
|
||||
handle_legacy(copy_key, copy_value);
|
||||
if (copy_key != split_key) {
|
||||
ReplaceString(value, split_key, copy_key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Ignore the following obsolete configuration keys:
|
||||
|
@ -3533,8 +3591,8 @@ void DynamicPrintConfig::normalize_fdm(int used_filaments)
|
|||
ConfigOptionBool* alh_opt = this->option<ConfigOptionBool>("adaptive_layer_height");
|
||||
ConfigOptionEnum<PrintSequence>* ps_opt = this->option<ConfigOptionEnum<PrintSequence>>("print_sequence");
|
||||
|
||||
ConfigOptionBool *timelapse_opt = this->option<ConfigOptionBool>("timelapse_no_toolhead");
|
||||
if (timelapse_opt && timelapse_opt->value == false) {
|
||||
ConfigOptionEnum<TimelapseType> *timelapse_opt = this->option<ConfigOptionEnum<TimelapseType>>("timelapse_type");
|
||||
if (timelapse_opt && timelapse_opt->value == TimelapseType::tlSmooth) {
|
||||
if (used_filaments == 1 || ps_opt->value == PrintSequence::ByObject)
|
||||
ept_opt->value = false;
|
||||
}
|
||||
|
|
|
@ -134,6 +134,12 @@ enum BrimType {
|
|||
btOuterAndInner,
|
||||
};
|
||||
|
||||
enum TimelapseType {
|
||||
tlClose,
|
||||
tlSmooth,
|
||||
tlTraditional
|
||||
};
|
||||
|
||||
enum DraftShield {
|
||||
dsDisabled, dsLimited, dsEnabled
|
||||
};
|
||||
|
@ -241,6 +247,7 @@ CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(SeamPosition)
|
|||
CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(SLADisplayOrientation)
|
||||
CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(SLAPillarConnectionMode)
|
||||
CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(BrimType)
|
||||
CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(TimelapseType)
|
||||
CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(BedType)
|
||||
CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(DraftShield)
|
||||
CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(ForwardCompatibilitySubstitutionRule)
|
||||
|
@ -862,7 +869,7 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE(
|
|||
// BBS: not in any preset, calculated before slicing
|
||||
((ConfigOptionBool, has_prime_tower))
|
||||
((ConfigOptionFloat, nozzle_volume))
|
||||
((ConfigOptionBool, timelapse_no_toolhead))
|
||||
((ConfigOptionEnum<TimelapseType>, timelapse_type))
|
||||
|
||||
)
|
||||
|
||||
|
|
|
@ -1932,8 +1932,8 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re
|
|||
auto co = dynamic_cast<const ConfigOptionEnum<PrintSequence>*>(m_config->option<ConfigOptionEnum<PrintSequence>>("print_sequence"));
|
||||
|
||||
const DynamicPrintConfig &dconfig = wxGetApp().preset_bundle->prints.get_edited_preset().config;
|
||||
const ConfigOption * option = dconfig.option("timelapse_no_toolhead");
|
||||
bool timelapse_enabled = option ? option->getBool() : false;
|
||||
auto timelapse_type = dconfig.option<ConfigOptionEnum<TimelapseType>>("timelapse_type");
|
||||
bool timelapse_enabled = timelapse_type ? (timelapse_type->value == TimelapseType::tlSmooth) : false;
|
||||
|
||||
if (timelapse_enabled || (filaments_count > 1 && wt && co != nullptr && co->value != PrintSequence::ByObject)) {
|
||||
for (int plate_id = 0; plate_id < n_plates; plate_id++) {
|
||||
|
|
|
@ -1104,8 +1104,8 @@ Vec3d PartPlate::estimate_wipe_tower_size(const double w, const double wipe_volu
|
|||
wipe_tower_size(2) = max_height;
|
||||
|
||||
const DynamicPrintConfig &dconfig = wxGetApp().preset_bundle->prints.get_edited_preset().config;
|
||||
const ConfigOption* option = dconfig.option("timelapse_no_toolhead");
|
||||
bool timelapse_enabled = option ? option->getBool() : false;
|
||||
auto timelapse_type = dconfig.option<ConfigOptionEnum<TimelapseType>>("timelapse_type");
|
||||
bool timelapse_enabled = timelapse_type ? (timelapse_type->value == TimelapseType::tlSmooth) : false;
|
||||
|
||||
double depth = wipe_volume * (plate_extruders.size() - 1) / (layer_height * w);
|
||||
if (timelapse_enabled || depth > EPSILON) {
|
||||
|
|
|
@ -1375,13 +1375,14 @@ void Tab::on_value_change(const std::string& opt_key, const boost::any& value)
|
|||
update_wiping_button_visibility();
|
||||
|
||||
if (opt_key == "enable_prime_tower") {
|
||||
bool timelapse_enabled = m_config->option<ConfigOptionBool>("timelapse_no_toolhead")->value;
|
||||
auto timelapse_type = m_config->option<ConfigOptionEnum<TimelapseType>>("timelapse_type");
|
||||
bool timelapse_enabled = timelapse_type->value == TimelapseType::tlSmooth;
|
||||
if (!boost::any_cast<bool>(value) && timelapse_enabled) {
|
||||
MessageDialog dlg(wxGetApp().plater(), _L("Prime tower is required by timeplase. Are you sure you want to disable both of them?"),
|
||||
_L("Warning"), wxICON_WARNING | wxYES | wxNO);
|
||||
if (dlg.ShowModal() == wxID_YES) {
|
||||
DynamicPrintConfig new_conf = *m_config;
|
||||
new_conf.set_key_value("timelapse_no_toolhead", new ConfigOptionBool(false));
|
||||
new_conf.set_key_value("timelapse_type", new ConfigOptionEnum<TimelapseType>(TimelapseType::tlClose));
|
||||
m_config_manipulation.apply(m_config, &new_conf);
|
||||
wxGetApp().plater()->update();
|
||||
}
|
||||
|
@ -1395,9 +1396,9 @@ void Tab::on_value_change(const std::string& opt_key, const boost::any& value)
|
|||
}
|
||||
|
||||
// reload scene to update timelapse wipe tower
|
||||
if (opt_key == "timelapse_no_toolhead") {
|
||||
if (opt_key == "timelapse_type") {
|
||||
bool wipe_tower_enabled = m_config->option<ConfigOptionBool>("enable_prime_tower")->value;
|
||||
if (!wipe_tower_enabled && boost::any_cast<bool>(value)) {
|
||||
if (!wipe_tower_enabled && boost::any_cast<int>(value) == int(TimelapseType::tlSmooth)) {
|
||||
MessageDialog dlg(wxGetApp().plater(), _L("Prime tower is required by timelapse. Do you want to enable both of them?"),
|
||||
_L("Warning"), wxICON_WARNING | wxYES | wxNO);
|
||||
if (dlg.ShowModal() == wxID_YES) {
|
||||
|
@ -1408,7 +1409,7 @@ void Tab::on_value_change(const std::string& opt_key, const boost::any& value)
|
|||
}
|
||||
else {
|
||||
DynamicPrintConfig new_conf = *m_config;
|
||||
new_conf.set_key_value("timelapse_no_toolhead", new ConfigOptionBool(false));
|
||||
new_conf.set_key_value("timelapse_type", new ConfigOptionEnum<TimelapseType>(TimelapseType::tlClose));
|
||||
m_config_manipulation.apply(m_config, &new_conf);
|
||||
}
|
||||
} else {
|
||||
|
@ -1910,7 +1911,7 @@ void TabPrint::build()
|
|||
optgroup = page->new_optgroup(L("Special mode"));
|
||||
optgroup->append_single_option_line("print_sequence");
|
||||
optgroup->append_single_option_line("spiral_mode", "spiral-vase");
|
||||
optgroup->append_single_option_line("timelapse_no_toolhead", "Timelapse");
|
||||
optgroup->append_single_option_line("timelapse_type", "None");
|
||||
//BBS: todo remove clearance to machine
|
||||
#if 0
|
||||
//line = { L("Extruder radius"), "" };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue