update src

This commit is contained in:
wjyLearn
2025-12-20 20:19:00 +08:00
parent 1a5e691672
commit c23ce3c50a
3 changed files with 238 additions and 52 deletions

View File

@@ -270,16 +270,16 @@ else ()
COMMAND ln -sfn "${SLIC3R_RESOURCES_DIR}" "${BIN_RESOURCES_DIR}"
COMMENT "Symlinking the resources directory into the build tree"
VERBATIM)
if (UNIX AND NOT APPLE)
add_custom_command(TARGET QIDIStudio POST_BUILD
COMMAND ln -sfn "zh_cn" "${BIN_RESOURCES_DIR}/i18n/zh_CN"
COMMENT "Symlinking zh_CN language setting to zh_cn"
VERBATIM)
add_custom_command(TARGET QIDIStudio POST_BUILD
COMMAND ln -sfn "pt-BR" "${BIN_RESOURCES_DIR}/i18n/pt_BR"
COMMENT "Symlinking pt_BR language setting to pt_BR"
VERBATIM)
endif()
#if (UNIX AND NOT APPLE)
# add_custom_command(TARGET QIDIStudio POST_BUILD
# COMMAND ln -sfn "zh_cn" "${BIN_RESOURCES_DIR}/i18n/zh_CN"
# COMMENT "Symlinking zh_CN language setting to zh_cn"
# VERBATIM)
# add_custom_command(TARGET QIDIStudio POST_BUILD
# COMMAND ln -sfn "pt-BR" "${BIN_RESOURCES_DIR}/i18n/pt_BR"
# COMMENT "Symlinking pt_BR language setting to pt_BR"
# VERBATIM)
#endif()
endif ()
# Slic3r binary install target. Default build type is release in case no CMAKE_BUILD_TYPE is provided.

View File

@@ -188,6 +188,7 @@ typedef struct _sliced_plate_info{
float main_predication{0.f};
int filament_change_times {0};
int layer_filament_change {0};
int obj_cached_cnt {0};
std::vector<object_info_t> objects;
std::vector<filament_info_t> filaments;
@@ -486,6 +487,7 @@ void record_exit_reson(std::string outputdir, int code, int plate_id, std::strin
plate_json["main_predication"] = sliced_plate_info.main_predication;
plate_json["filament_change_times"] = sliced_plate_info.filament_change_times;
plate_json["layer_filament_change"] = sliced_plate_info.layer_filament_change;
plate_json["obj_cached_cnt"] = sliced_plate_info.obj_cached_cnt;
//object info
if (!sliced_plate_info.objects.empty())
@@ -894,7 +896,13 @@ void merge_or_add_object(assemble_plate_info_t& assemble_plate_info, Model &mode
}
}
bool convert_obj_cluster_colors(std::vector<Slic3r::RGBA>& input_colors, std::vector<RGBA>& all_colours, int max_filament_count, std::vector<unsigned char>& output_filament_ids, int& first_filament_id)
bool convert_obj_cluster_colors(std::vector<Slic3r::RGBA> & input_colors,
std::vector<RGBA> & all_colours,
int max_filament_count,
std::vector<unsigned char> &output_filament_ids,
int & first_filament_id,
bool first_time_using_makerlab = false,
std::vector<Slic3r::RGBA> mtl_colors = {})
{
using namespace Slic3r::GUI;
@@ -903,8 +911,27 @@ bool convert_obj_cluster_colors(std::vector<Slic3r::RGBA>& input_colors, std::ve
std::vector<Slic3r::RGBA> cluster_colors;
std::vector<int> cluster_labels;
char cluster_number = -1;
if (first_time_using_makerlab && mtl_colors.size() < (int) EnforcerBlockerType::ExtruderMax) {
first_time_using_makerlab = false;
cluster_colors = mtl_colors;
cluster_labels.clear();
cluster_labels.reserve(input_colors.size());
for (int i = 0; i < input_colors.size(); i++) {
bool can_find = false;
for (int j = 0; j < cluster_colors.size(); j++) {
if (Slic3r::color_is_equal(input_colors[i],cluster_colors[j])) {
cluster_labels.emplace_back(j);
can_find = true;
}
}
if (!can_find) {
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " error,not matched: " << i;
cluster_labels.emplace_back(0);
}
}
} else {
obj_color_deal_algo(input_colors, cluster_colors, cluster_labels, cluster_number, (int) EnforcerBlockerType::ExtruderMax);
}
std::vector<int> cluster_color_maps;
BOOST_LOG_TRIVIAL(info) << boost::format("%1%:%2%, after obj_color_deal_algo, cluster_colors size %3%, all_colours size %4%, max_filament_count=%5%")%__FUNCTION__ %__LINE__%cluster_colors.size() %all_colours.size() %max_filament_count;
@@ -1084,7 +1111,8 @@ static int construct_assemble_list(std::vector<assemble_plate_info_t> &assemble_
}
skip_filament = true;
} else if (obj_info.face_colors.size() > 0 && obj_info.has_uv_png == false) { // mtl file
convert_obj_cluster_colors(obj_info.face_colors, all_colours, max_filament_count, output_filament_ids, first_filament_id);
convert_obj_cluster_colors(obj_info.face_colors, all_colours, max_filament_count, output_filament_ids, first_filament_id, obj_info.first_time_using_makerlab,
obj_info.mtl_colors);
if (output_filament_ids.size() > 0) {
unsigned char first_eid = (unsigned char)first_filament_id;
result = Model::obj_import_face_color_deal(output_filament_ids, first_eid, & obj_temp_model);
@@ -1376,22 +1404,35 @@ int CLI::run(int argc, char **argv)
return CLI_ENVIRONMENT_ERROR;
}
/* BOOST_LOG_TRIVIAL(info) << "begin to setup params, argc=" << argc << std::endl;
#if 0
BOOST_LOG_TRIVIAL(info) << "begin to setup params, argc=" << argc << std::endl;
for (int index = 0; index < argc; index++)
BOOST_LOG_TRIVIAL(info) << "index=" << index << ", arg is " << argv[index] << std::endl;
int debug_argc = 8;
char* debug_argv[] = {
"F:\work\projects\qidi_debug\qidi_slicer\build_debug\src\Debug\qidi-studio.exe",
"F:\work\projects\qidi_debug\bamboo_slicer\build_debug\src\Debug\qidi-studio.exe",
"--debug=3",
"--export-3mf=output.3mf",
"--uptodate",
"--downward-check",
"--nozzle-volume-type",
"Standard,High Flow",
"--filament-map-mode",
"Nozzle Manual",
"--extruder-nozzle-count",
"1,6",
"--extruder-nozzle-volume-type",
"Standard,High Flow,High Flow,High Flow,High Flow,High Flow,High Flow",
"--filament-map",
"1,1,2,2,2,2,2,2",
"--filament-nozzle-map",
"0,0,3,4,1,5,2,6",
"--filament-volume-map",
"0,0,1,1,1,1,1,1",
"--slice=1",
"--min-save",
"cube_a1_switch.3mf"
"F:/cube_h2d.3mf"
};
if (!this->setup(debug_argc, debug_argv))*/
int debug_argc = sizeof(debug_argv) / sizeof(debug_argv[0]);
if (!this->setup(debug_argc, debug_argv))
#else
if (!this->setup(argc, argv))
#endif
{
boost::nowide::cerr << "setup params error" << std::endl;
return CLI_INVALID_PARAMS;
@@ -1687,7 +1728,7 @@ int CLI::run(int argc, char **argv)
std::vector<NozzleVolumeType> current_nozzle_volume_type, new_nozzle_volume_type;
std::string new_printer_name, current_printer_name, new_process_name, current_process_name, current_printer_system_name, current_process_system_name, new_process_system_name, new_printer_system_name, printer_model_id, current_printer_model, printer_model, new_default_process_name;
std::vector<std::string> upward_compatible_printers, new_print_compatible_printers, current_print_compatible_printers, current_different_settings;
std::vector<std::string> current_filaments_name, current_filaments_system_name, current_inherits_group, current_extruder_variants, new_extruder_variants, current_print_extruder_variants, new_printer_extruder_variants;
std::vector<std::string> current_filaments_name, current_filaments_system_name, converted_filaments_system_name, current_inherits_group, current_extruder_variants, new_extruder_variants, current_print_extruder_variants, new_printer_extruder_variants;
DynamicPrintConfig load_process_config, load_machine_config;
bool new_process_config_is_system = true, new_printer_config_is_system = true;
std::string pipe_name, makerlab_name, makerlab_version, different_process_setting;
@@ -2025,6 +2066,9 @@ int CLI::run(int argc, char **argv)
BOOST_LOG_TRIVIAL(info) << boost::format("no inherits_group: use system name the same as current name");
}
filament_count = current_filaments_name.size();
converted_filaments_system_name = current_filaments_system_name;
for (int f_index = 0; f_index < filament_count; f_index++)
convert_filament_preset_name(current_printer_system_name, converted_filaments_system_name[f_index]);
upward_compatible_printers = config.option<ConfigOptionStrings>("upward_compatible_machine", true)->values;
current_print_compatible_printers = config.option<ConfigOptionStrings>("print_compatible_printers", true)->values;
current_different_settings = config.option<ConfigOptionStrings>("different_settings_to_system", true)->values;
@@ -2466,6 +2510,27 @@ int CLI::run(int argc, char **argv)
std::string inherits;
if ((config_from == "User")||(config_from == "user")) {
inherits = config.option<ConfigOptionString>("inherits", true)->value;
if (!inherits.empty()) {
//process the default values for old configs
std::string parent_filament_path = resources_dir() + "/profiles/BBL/filament_full/"+inherits+".json";
if (boost::filesystem::exists(parent_filament_path)) {
DynamicPrintConfig parent_config;
std::string config_type, config_name, filament_id, config_from;
int ret = load_config_file(parent_filament_path, parent_config, config_type, config_name, filament_id, config_from);
if (!ret && (config_type == "filament")) {
for (auto& opt_key: filament_options_with_variant)
{
ConfigOption *opt = config.option(opt_key);
ConfigOption *parent_opt = parent_config.option(opt_key);
ConfigOptionVectorBase* opt_vec = static_cast<ConfigOptionVectorBase*>(opt);
const ConfigOptionVectorBase* opt_vec_parent = static_cast<const ConfigOptionVectorBase*>(parent_opt);
//set with default
if (opt && parent_opt)
opt_vec->set_with_default(opt_vec_parent);
}
}
}
}
}
load_filaments_inherit.push_back(inherits);
load_filaments_id.push_back(filament_id);
@@ -2737,7 +2802,7 @@ int CLI::run(int argc, char **argv)
flush_and_exit(CLI_CONFIG_FILE_ERROR);
}
if (config_name != current_filaments_system_name[index]) {
if ((config_name != current_filaments_system_name[index]) && (config_name != converted_filaments_system_name[index])) {
BOOST_LOG_TRIVIAL(error) << boost::format("wrong filament config file %1% loaded, current filament config name %2%, index %3%")%config_name %current_filaments_system_name[index] %index;
record_exit_reson(outfile_dir, CLI_CONFIG_FILE_ERROR, 0, cli_errors[CLI_CONFIG_FILE_ERROR], sliced_info);
flush_and_exit(CLI_CONFIG_FILE_ERROR);
@@ -2754,9 +2819,9 @@ int CLI::run(int argc, char **argv)
else
{
current_index = 0;
for (int index = 0; index < current_filaments_system_name.size(); index++)
for (int index = 0; index < converted_filaments_system_name.size(); index++)
{
std::string system_filament_path = resources_dir() + "/profiles/QDT/filament_full/"+current_filaments_system_name[index]+".json";
std::string system_filament_path = resources_dir() + "/profiles/QDT/filament_full/"+converted_filaments_system_name[index]+".json";
current_index++;
if (! boost::filesystem::exists(system_filament_path)) {
BOOST_LOG_TRIVIAL(warning) << __FUNCTION__<< boost::format(":%1%, can not find system preset file: %2% ")%__LINE__ %system_filament_path;
@@ -3220,12 +3285,6 @@ int CLI::run(int argc, char **argv)
flush_and_exit(ret);
}
}
if (m_print_config.option<ConfigOptionFloatsNullable>("nozzle_diameter")) {
new_extruder_count = m_print_config.option<ConfigOptionFloatsNullable>("nozzle_diameter")->values.size();
new_is_multi_extruder = new_extruder_count > 1;
new_printer_extruder_variants = m_print_config.option<ConfigOptionStrings>("printer_extruder_variant", true)->values;
new_printer_variant_count = new_printer_extruder_variants.size();
}
//set the process settings into print config
std::vector<std::string>& print_compatible_printers = m_print_config.option<ConfigOptionStrings>("print_compatible_printers", true)->values;
@@ -3296,6 +3355,14 @@ int CLI::run(int argc, char **argv)
}
//get nozzle_volume_type
bool different_extruder = m_print_config.support_different_extruders(new_extruder_count);
//new_extruder_count = m_print_config.option<ConfigOptionFloatsNullable>("nozzle_diameter")->values.size();
new_is_multi_extruder = new_extruder_count > 1;
new_printer_extruder_variants = m_print_config.option<ConfigOptionStrings>("printer_extruder_variant", true)->values;
new_printer_variant_count = new_printer_extruder_variants.size();
auto extruder_max_nozzle_count = m_print_config.option<ConfigOptionIntsNullable>("extruder_max_nozzle_count", true)->values;
bool support_multi_nozzle = std::any_of(extruder_max_nozzle_count.begin(),extruder_max_nozzle_count.end(),[](int val){return val>1;});
if(m_extra_config.has("nozzle_volume_type")) {
auto opt_nozzle_volume_type = dynamic_cast<const ConfigOptionEnumsGeneric*>(m_extra_config.option("nozzle_volume_type"));
if (opt_nozzle_volume_type) {
@@ -3309,6 +3376,13 @@ int CLI::run(int argc, char **argv)
}
else {
new_nozzle_volume_type.resize(new_extruder_count, nvtStandard);
if ((new_extruder_count > 1) || different_extruder) {
BOOST_LOG_TRIVIAL(error) << boost::format("%1%: nozzle_volume_type not found, when different_extruder or multiple extruder, new_printer_name %2%, extruder_count %3%")%__LINE__ %new_printer_name %new_extruder_count;
//record_exit_reson(outfile_dir, CLI_INVALID_PARAMS, 0, cli_errors[CLI_INVALID_PARAMS], sliced_info);
//flush_and_exit(CLI_INVALID_PARAMS);
}
else
BOOST_LOG_TRIVIAL(info) << boost::format("%1%: nozzle_volume_type not found, use standard by default, new_printer_name %2% extruder_count %3%")%__LINE__ %new_printer_name %new_extruder_count;
}
new_extruder_variants.resize(new_extruder_count, "");
const ConfigOptionEnumsGeneric *opt_extruder_type = dynamic_cast<const ConfigOptionEnumsGeneric *>(m_print_config.option("extruder_type"));
@@ -3578,7 +3652,7 @@ int CLI::run(int argc, char **argv)
if (filament_options_with_variant.find(opt_key) != filament_options_with_variant.end()) {
std::vector<int> temp_variant_indice;
temp_variant_indice.resize(new_variant_count, -1);
opt_vec_dst->set_with_restore_2(opt_key, opt_vec_src, temp_variant_indice, old_start_indice[filament_index - 1], old_variant_count);
opt_vec_dst->set_with_restore_2(opt_key, opt_vec_src, temp_variant_indice, old_start_indice[filament_index - 1], old_variant_count, true);
if (opt_key == "filament_extruder_variant")
new_variant_counts[filament_index - 1] = opt_vec_src->size();
@@ -4474,9 +4548,9 @@ int CLI::run(int argc, char **argv)
if (temp_extruder_height > temp_extruder_print_heights[temp_index])
temp_extruder_height = temp_extruder_print_heights[temp_index];
}
printer_plate.printable_width = current_bbox.size().x();
printer_plate.printable_depth = current_bbox.size().y();
printer_plate.printable_height = temp_extruder_height;
printer_plate.shared_width = current_bbox.size().x();
printer_plate.shared_depth = current_bbox.size().y();
printer_plate.shared_height = temp_extruder_height;
BOOST_LOG_TRIVIAL(info) << boost::format("downward_check: for multi-extruder printer, change printable size to bbox {%1%, %2%, 0} - {%3%, %4%, %5%}")
%current_bbox.min.x() %current_bbox.min.y() %current_bbox.max.x() %current_bbox.max.y() %temp_extruder_height;
@@ -4561,6 +4635,16 @@ int CLI::run(int argc, char **argv)
failed_count ++;
continue;
}
//single to multiple check
if ((shared_printable_width == 0) && (plate_info.shared_width > 0)&&(plate_info.shared_depth > 0)&&(plate_info.shared_height > 0)
&&((size.z() > plate_info.shared_height) || (size.y() > plate_info.shared_depth) || (size.x() > plate_info.shared_width))) {
BOOST_LOG_TRIVIAL(info) << boost::format("plate %1%, downward_check index %2%, name %3%, bbox {%4%, %5%, %6%} exceeds printer shared size {%7%, %8%, %9%}")
%(index+1) %(index2+1) %plate_info.printer_name
%size.x() % size.y() % size.z() %plate_info.shared_width %plate_info.shared_depth %plate_info.shared_height;
downward_check_status[index2] = true;
failed_count ++;
continue;
}
if (plate_info.exclude_width > 0) {
int real_width = plate_info.printable_width - plate_info.exclude_width;
int real_depth = plate_info.printable_depth - plate_info.exclude_depth;
@@ -5504,6 +5588,10 @@ int CLI::run(int argc, char **argv)
float w = dynamic_cast<const ConfigOptionFloat *>(m_print_config.option("prime_tower_width"))->value;
float a = dynamic_cast<const ConfigOptionFloat *>(m_print_config.option("wipe_tower_rotation_angle"))->value;
std::vector<double> v = dynamic_cast<const ConfigOptionFloats *>(m_print_config.option("filament_prime_volume"))->values;
if (m_print_config.option<ConfigOptionEnum<PrimeVolumeMode>>("prime_volume_mode", true)->value == pvmSaving) {
for (auto& val : v)
val = 15.f;
}
unsigned int filaments_cnt = plate_data_src[plate_to_slice-1]->slice_filaments_info.size();
if ((filaments_cnt == 0) || need_skip)
{
@@ -6059,12 +6147,13 @@ int CLI::run(int argc, char **argv)
} else if (opt_key == "load_slicedata") {
load_slicedata = true;
load_slice_data_dir = m_config.opt_string(opt_key);
if (export_slicedata) {
/*if (export_slicedata) {
BOOST_LOG_TRIVIAL(error) << "should not set load_slicedata and export_slicedata together." << std::endl;
record_exit_reson(outfile_dir, CLI_INVALID_PARAMS, 0, cli_errors[CLI_INVALID_PARAMS], sliced_info);
flush_and_exit(CLI_INVALID_PARAMS);
}
else if (duplicate_count > 0)
else*/
if (duplicate_count > 0)
{
BOOST_LOG_TRIVIAL(error) << "should not set load_slicedata when set repetitions." << std::endl;
record_exit_reson(outfile_dir, CLI_INVALID_PARAMS, 0, cli_errors[CLI_INVALID_PARAMS], sliced_info);
@@ -6145,11 +6234,11 @@ int CLI::run(int argc, char **argv)
} else if (opt_key == "export_slicedata") {
export_slicedata = true;
export_slice_data_dir = m_config.opt_string(opt_key);
if (load_slicedata) {
/*if (load_slicedata) {
BOOST_LOG_TRIVIAL(error) << "should not set load_slicedata and export_slicedata together." << std::endl;
record_exit_reson(outfile_dir, CLI_INVALID_PARAMS, 0, cli_errors[CLI_INVALID_PARAMS], sliced_info);
flush_and_exit(CLI_INVALID_PARAMS);
}
}*/
} else if (opt_key == "slice") {
//QDS: slice 0 means all plates, i means plate i;
plate_to_slice = m_config.option<ConfigOptionInt>("slice")->value;
@@ -6413,6 +6502,8 @@ int CLI::run(int argc, char **argv)
}
else {
std::vector<int> filament_maps;
std::vector<int> filament_nozzle_maps;
std::vector<int> filament_volume_maps; // TODO: print with multi volume types
if (m_extra_config.option<ConfigOptionInts>("filament_map")) {
filament_maps = m_extra_config.option<ConfigOptionInts>("filament_map")->values;
int default_value = -1;
@@ -6456,6 +6547,88 @@ int CLI::run(int argc, char **argv)
}
else
filament_maps = part_plate->get_real_filament_maps(m_print_config);
if (support_multi_nozzle && (mode == fmmManual || mode == fmmNozzleManual) && (plate_to_slice != 0)) {
if (mode == FilamentMapMode::fmmNozzleManual) {
if (!m_extra_config.option<ConfigOptionInts>("filament_volume_map") ||
!m_extra_config.option<ConfigOptionInts>("filament_nozzle_map") ||
!m_extra_config.option<ConfigOptionInts>("extruder_nozzle_count") ||
!m_extra_config.option<ConfigOptionEnumsGeneric>("extruder_nozzle_volume_type") ||
!m_extra_config.option<ConfigOptionInts>("filament_map")) {
BOOST_LOG_TRIVIAL(error)
<< boost::format(
"%1%, can not find filament_volume_map/filament_nozzle_map/extruder_nozzle_count/extruder_nozzle_volume_type/filament_map under "
"Nozzle Manual mode") %
__LINE__;
record_exit_reson(outfile_dir, CLI_INVALID_PARAMS, index + 1, cli_errors[CLI_INVALID_PARAMS], sliced_info);
flush_and_exit(CLI_INVALID_PARAMS);
}
filament_nozzle_maps = m_extra_config.option<ConfigOptionInts>("filament_nozzle_map")->values;
filament_volume_maps = m_extra_config.option<ConfigOptionInts>("filament_volume_map")->values;
part_plate->set_filament_nozzle_maps(filament_nozzle_maps);
part_plate->set_filament_volume_maps(filament_volume_maps);
} else if (mode == fmmManual) {
if (!m_extra_config.option<ConfigOptionInts>("extruder_nozzle_count") ||
!m_extra_config.option<ConfigOptionEnumsGeneric>("extruder_nozzle_volume_type") ||
!m_extra_config.option<ConfigOptionInts>("filament_map")) {
BOOST_LOG_TRIVIAL(error)
<< boost::format("%1%, can not find extruder_nozzle_volume_type or extruder_nozzle_count or filament_map under Manual mode") % __LINE__;
record_exit_reson(outfile_dir, CLI_INVALID_PARAMS, index + 1, cli_errors[CLI_INVALID_PARAMS], sliced_info);
flush_and_exit(CLI_INVALID_PARAMS);
}
}
//assemble extruder_nozzle_stats
std::vector<std::map<NozzleVolumeType,int>> extruder_nozzle_stats_maps(new_extruder_count, std::map<NozzleVolumeType,int>{});
std::vector<int> extruder_nozzle_counts = m_extra_config.option<ConfigOptionInts>("extruder_nozzle_count")->values;
std::vector<int> extruder_nozzle_volume_types = m_extra_config.option<ConfigOptionEnumsGeneric>("extruder_nozzle_volume_type")->values;
int nozzle_index = 0;
for(int e_index = 0; e_index < new_extruder_count; e_index++)
{
std::map<NozzleVolumeType,int> nozzle_volume_type_maps;
for (int sub_index = 0; sub_index < extruder_nozzle_counts[e_index]; sub_index++)
{
if (nozzle_volume_type_maps.find(NozzleVolumeType(extruder_nozzle_volume_types[nozzle_index])) != nozzle_volume_type_maps.end())
{
nozzle_volume_type_maps[NozzleVolumeType(extruder_nozzle_volume_types[nozzle_index])]++;
}
else
nozzle_volume_type_maps[NozzleVolumeType(extruder_nozzle_volume_types[nozzle_index])] = 1;
nozzle_index++;
}
extruder_nozzle_stats_maps[e_index] = std::move(nozzle_volume_type_maps);
}
m_print_config.option<ConfigOptionStrings>("extruder_nozzle_stats", true)->values = save_extruder_nozzle_stats_to_string(extruder_nozzle_stats_maps);
if (mode == fmmManual) {
//refine the values not passed
ConfigOptionEnumsGeneric* using_nozzle_volume_type_opt = m_extra_config.option<ConfigOptionEnumsGeneric>("nozzle_volume_type", true);
using_nozzle_volume_type_opt->values.resize(new_extruder_count, nvtStandard);
for (int e_index = 0; e_index < new_extruder_count; e_index++)
{
std::map<NozzleVolumeType,int>& nozzle_volume_type_maps = extruder_nozzle_stats_maps[e_index];
if (nozzle_volume_type_maps.size() > 1) {
using_nozzle_volume_type_opt->values[e_index] = nvtHybrid;
BOOST_LOG_TRIVIAL(info) << boost::format("%1% : extruder %2%, set nozzle_volume_type to hybrid ") % __LINE__ %(e_index+1);
}
}
std::vector<int>& filament_volume_maps = m_extra_config.option<ConfigOptionInts>("filament_volume_map", true)->values;
std::vector<int>& filament_maps = m_extra_config.option<ConfigOptionInts>("filament_map")->values;
filament_volume_maps.resize(filament_count, 0);
for (int f_index = 0; f_index < filament_count; f_index++)
{
int f_extruder_index = filament_maps[f_index] - 1;
if (using_nozzle_volume_type_opt->values[f_extruder_index] != nvtHybrid) {
filament_volume_maps[f_index] = int(using_nozzle_volume_type_opt->values[f_extruder_index]);
BOOST_LOG_TRIVIAL(info) << boost::format("%1% : filament %2% extruder %3%, set filament_volume_map to %4% ") % __LINE__ %(f_index+1) %(f_extruder_index+1) % filament_volume_maps[f_index];
}
}
}
}
else if (!support_multi_nozzle && (mode == fmmNozzleManual)) {
BOOST_LOG_TRIVIAL(error)
<< boost::format("%1%, Nozzle Manual mode not supported for %2%") % __LINE__ %new_printer_name;
record_exit_reson(outfile_dir, CLI_INVALID_PARAMS, index + 1, cli_errors[CLI_INVALID_PARAMS], sliced_info);
flush_and_exit(CLI_INVALID_PARAMS);
}
for (int index = 0; index < filament_maps.size(); index++)
{
@@ -6554,20 +6727,29 @@ int CLI::run(int argc, char **argv)
}
}
//set filament_map
std::vector<int>& final_filament_maps = new_print_config.option<ConfigOptionInts>("filament_map", true)->values;
if (final_filament_maps.size() < filament_count)
final_filament_maps.resize(filament_count, 1);
if (new_extruder_count == 1) {
for (int index = 0; index < filament_count; index++)
final_filament_maps[index] = 1;
}
if(!new_print_config.has("nozzle_volume_type")) {
//set default nozzle_volume_type
ConfigOptionEnumsGeneric* final_nozzle_volume_type_opt = new_print_config.option<ConfigOptionEnumsGeneric>("nozzle_volume_type", true);
final_nozzle_volume_type_opt->values.resize(new_extruder_count, nvtStandard);
}
//set filament_map
std::vector<int>& final_filament_maps = new_print_config.option<ConfigOptionInts>("filament_map", true)->values;
std::vector<int>& final_volume_maps = new_print_config.option<ConfigOptionInts>("filament_volume_map", true)->values;
int default_extruder_id = 1; // 1 based;
if (final_filament_maps.size() < filament_count)
final_filament_maps.resize(filament_count, default_extruder_id);
if (final_volume_maps.size() < filament_count)
final_volume_maps.resize(filament_count, new_print_config.option<ConfigOptionEnumsGeneric>("nozzle_volume_type")->values[default_extruder_id - 1]); // default use volume type for left extruder
if (new_extruder_count == 1) {
for (int index = 0; index < filament_count; index++) {
final_filament_maps[index] = default_extruder_id;
final_volume_maps[index] = new_print_config.option<ConfigOptionEnumsGeneric>("nozzle_volume_type")->values[default_extruder_id - 1];
}
part_plate->set_filament_maps(final_filament_maps);
part_plate->set_filament_volume_maps(final_volume_maps);
}
print->apply(model, new_print_config);
BOOST_LOG_TRIVIAL(info) << boost::format("set no_check to %1%:")%no_check;
print->set_no_check_flag(no_check);//QDS
@@ -6823,10 +7005,10 @@ int CLI::run(int argc, char **argv)
}
#endif
if (export_slicedata) {
BOOST_LOG_TRIVIAL(info) << "plate "<< index+1<< ":will export Slicing data to " << export_slice_data_dir;
BOOST_LOG_TRIVIAL(info) << boost::format("plate %1% will export Slicing data to %2%")%(index+1) %export_slice_data_dir;
std::string plate_dir = export_slice_data_dir+"/"+std::to_string(index+1);
bool with_space = (get_logging_level() >= 4)?true:false;
int ret = print->export_cached_data(plate_dir, with_space);
int ret = print->export_cached_data(plate_dir, sliced_plate_info.obj_cached_cnt, with_space);
if (ret) {
BOOST_LOG_TRIVIAL(error) << "plate "<< index+1<< ": export Slicing data error, ret=" << ret;
export_slicedata_error = true;
@@ -6835,6 +7017,7 @@ int CLI::run(int argc, char **argv)
record_exit_reson(outfile_dir, ret, index+1, cli_errors[ret], sliced_info);
flush_and_exit(ret);
}
BOOST_LOG_TRIVIAL(info) << boost::format("plate %1% exported %2% objects")%(index+1) %(sliced_plate_info.obj_cached_cnt);
}
end_time = (long long)Slic3r::Utils::get_current_milliseconds_time_utc();
sliced_plate_info.sliced_time = end_time - start_time;

View File

@@ -84,6 +84,9 @@ typedef struct _printer_plate_info {
int printable_width{0};
int printable_depth{0};
int printable_height{0};
int shared_width{0};
int shared_depth{0};
int shared_height{0};
int exclude_width{0};
int exclude_depth{0};