support Prusa XL

This commit is contained in:
SoftFever 2024-07-13 16:35:36 +08:00
parent f59c70a7fc
commit 0b8515ed20
5 changed files with 21 additions and 19 deletions

View file

@ -1105,14 +1105,14 @@ void GCode::PlaceholderParserIntegration::init(const GCodeWriter &writer)
const std::vector<Extruder> &extruders = writer.extruders();
if (! extruders.empty()) {
this->num_extruders = extruders.back().id() + 1;
this->e_retracted.assign(num_extruders, 0);
this->e_restart_extra.assign(num_extruders, 0);
this->e_retracted.assign(MAXIMUM_EXTRUDER_NUMBER, 0);
this->e_restart_extra.assign(MAXIMUM_EXTRUDER_NUMBER, 0);
this->opt_e_retracted = new ConfigOptionFloats(e_retracted);
this->opt_e_restart_extra = new ConfigOptionFloats(e_restart_extra);
this->output_config.set_key_value("e_retracted", this->opt_e_retracted);
this->output_config.set_key_value("e_restart_extra", this->opt_e_restart_extra);
if (! writer.config.use_relative_e_distances) {
e_position.assign(num_extruders, 0);
e_position.assign(MAXIMUM_EXTRUDER_NUMBER, 0);
opt_e_position = new ConfigOptionFloats(e_position);
this->output_config.set_key_value("e_position", opt_e_position);
}
@ -1144,8 +1144,8 @@ void GCode::PlaceholderParserIntegration::update_from_gcodewriter(const GCodeWri
if (this->num_extruders > 0) {
const std::vector<Extruder> &extruders = writer.extruders();
assert(! extruders.empty() && num_extruders == extruders.back().id() + 1);
this->e_retracted.assign(num_extruders, 0);
this->e_restart_extra.assign(num_extruders, 0);
this->e_retracted.assign(MAXIMUM_EXTRUDER_NUMBER, 0);
this->e_restart_extra.assign(MAXIMUM_EXTRUDER_NUMBER, 0);
this->opt_extruded_volume->values.assign(num_extruders, 0);
this->opt_extruded_weight->values.assign(num_extruders, 0);
double total_volume = 0.;
@ -1165,7 +1165,7 @@ void GCode::PlaceholderParserIntegration::update_from_gcodewriter(const GCodeWri
opt_e_retracted->values = this->e_retracted;
opt_e_restart_extra->values = this->e_restart_extra;
if (! writer.config.use_relative_e_distances) {
this->e_position.assign(num_extruders, 0);
this->e_position.assign(MAXIMUM_EXTRUDER_NUMBER, 0);
for (const Extruder &e : extruders)
this->e_position[e.id()] = e.position();
this->opt_e_position->values = this->e_position;
@ -1179,11 +1179,11 @@ void GCode::PlaceholderParserIntegration::validate_output_vector_variables()
if (this->opt_position->values.size() != 3)
throw Slic3r::RuntimeError("\"position\" output variable must not be resized by the script.");
if (this->num_extruders > 0) {
if (this->opt_e_position && this->opt_e_position->values.size() != this->num_extruders)
if (this->opt_e_position && this->opt_e_position->values.size() != MAXIMUM_EXTRUDER_NUMBER)
throw Slic3r::RuntimeError("\"e_position\" output variable must not be resized by the script.");
if (this->opt_e_retracted->values.size() != this->num_extruders)
if (this->opt_e_retracted->values.size() != MAXIMUM_EXTRUDER_NUMBER)
throw Slic3r::RuntimeError("\"e_retracted\" output variable must not be resized by the script.");
if (this->opt_e_restart_extra->values.size() != this->num_extruders)
if (this->opt_e_restart_extra->values.size() != MAXIMUM_EXTRUDER_NUMBER)
throw Slic3r::RuntimeError("\"e_restart_extra\" output variable must not be resized by the script.");
}
}

View file

@ -7310,9 +7310,9 @@ OtherSlicingStatesConfigDef::OtherSlicingStatesConfigDef()
// def->label = L("Initial filament type");
// def->tooltip = L("String containing filament type of the first used extruder.");
// def = this->add("has_single_extruder_multi_material_priming", coBool);
// def->label = L("Has single extruder MM priming");
// def->tooltip = L("Are the extra multi-material priming regions used in this print?");
def = this->add("has_single_extruder_multi_material_priming", coBool);
def->label = L("Has single extruder MM priming");
def->tooltip = L("Are the extra multi-material priming regions used in this print?");
new_def("initial_no_support_extruder", coInt, "Initial no support extruder", "Zero-based index of the first extruder used for printing without support. Same as initial_no_support_tool.");
new_def("in_head_wrap_detect_zone", coBool, "In head wrap detect zone", "Indicates if the first layer overlaps with the head wrap zone.");

View file

@ -61,6 +61,9 @@ static constexpr double SCALING_FACTOR_INTERNAL = 0.000001;
static constexpr double SCALING_FACTOR_INTERNAL_LARGE_PRINTER = 0.00001;
static constexpr double LARGE_BED_THRESHOLD = 2147;
// Orca: maximum number of extruders is 64. For SEMM printers, it defines maximum filament number.
static constexpr size_t MAXIMUM_EXTRUDER_NUMBER = 64;
extern double SCALING_FACTOR;
// for creating circles (for brim_ear)
#define POLY_SIDES 24

View file

@ -942,8 +942,8 @@ Sidebar::Sidebar(Plater *parent)
ScalableButton* add_btn = new ScalableButton(p->m_panel_filament_title, wxID_ANY, "add_filament");
add_btn->SetToolTip(_L("Add one filament"));
add_btn->Bind(wxEVT_BUTTON, [this, scrolled_sizer](wxCommandEvent& e){
// Orca: limit filament choices to 64
if (p->combos_filament.size() >= 64)
// Orca: limit filament choices to MAXIMUM_EXTRUDER_NUMBER
if (p->combos_filament.size() >= MAXIMUM_EXTRUDER_NUMBER)
return;
int filament_count = p->combos_filament.size() + 1;
@ -1642,8 +1642,7 @@ void Sidebar::on_filaments_change(size_t num_filaments)
}
void Sidebar::add_filament() {
// BBS: limit filament choices to 16
if (p->combos_filament.size() >= 16) return;
if (p->combos_filament.size() >= MAXIMUM_EXTRUDER_NUMBER) return;
wxColour new_col = Plater::get_next_color_for_filament();
add_custom_filament(new_col);
}
@ -1667,7 +1666,7 @@ void Sidebar::delete_filament() {
}
void Sidebar::add_custom_filament(wxColour new_col) {
if (p->combos_filament.size() >= 16) return;
if (p->combos_filament.size() >= MAXIMUM_EXTRUDER_NUMBER) return;
int filament_count = p->combos_filament.size() + 1;
std::string new_color = new_col.GetAsString(wxC2S_HTML_SYNTAX).ToStdString();
@ -3763,7 +3762,7 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
int size = extruderIds.size() == 0 ? 0 : *(extruderIds.rbegin());
int filament_size = sidebar->combos_filament().size();
while (filament_size < 16 && filament_size < size) {
while (filament_size < MAXIMUM_EXTRUDER_NUMBER && filament_size < size) {
int filament_count = filament_size + 1;
wxColour new_col = Plater::get_next_color_for_filament();
std::string new_color = new_col.GetAsString(wxC2S_HTML_SYNTAX).ToStdString();

View file

@ -4100,7 +4100,7 @@ if (is_marlin_flavor)
def.label = L("Extruders");
def.tooltip = L("Number of extruders of the printer.");
def.min = 1;
def.max = 256;
def.max = MAXIMUM_EXTRUDER_NUMBER;
def.mode = comAdvanced;
Option option(def, "extruders_count");
optgroup->append_single_option_line(option);