mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-19 06:41:14 -06:00
NEW: add plate name
referenced OrcaSlicer code and support for Chinese textures,chinese xml,limit plate_name length,Code decoupling,wxColour use Local Variables Change-Id: I6434b90efb2f90235527c7dfb3a7ed516ac2cf4b (cherry picked from commit 0ecfefb0e1cfccbe73b0fcc530e04e6405ecf68a)
This commit is contained in:
parent
21fbe91ca7
commit
2b9f3c9912
14 changed files with 227 additions and 86 deletions
|
@ -70,6 +70,17 @@ public:
|
|||
return ! (this->max(0) < other.min(0) || this->min(0) > other.max(0) ||
|
||||
this->max(1) < other.min(1) || this->min(1) > other.max(1));
|
||||
}
|
||||
PointClass operator[](size_t idx) const
|
||||
{
|
||||
switch (idx) {
|
||||
case 0: return min; break;
|
||||
case 1: return PointClass(max(0), min(1)); break;
|
||||
case 2: return max; break;
|
||||
case 3: return PointClass(min(0), max(1)); break;
|
||||
default: return PointClass(); break;
|
||||
}
|
||||
return PointClass();
|
||||
}
|
||||
bool operator==(const BoundingBoxBase<PointClass> &rhs) { return this->min == rhs.min && this->max == rhs.max; }
|
||||
bool operator!=(const BoundingBoxBase<PointClass> &rhs) { return ! (*this == rhs); }
|
||||
friend std::ostream &operator<<(std::ostream &os, const BoundingBoxBase &bbox)
|
||||
|
|
|
@ -277,6 +277,7 @@ static constexpr const char* OBJECT_ID_ATTR = "object_id";
|
|||
static constexpr const char* INSTANCEID_ATTR = "instance_id";
|
||||
static constexpr const char* IDENTIFYID_ATTR = "identify_id";
|
||||
static constexpr const char* PLATERID_ATTR = "plater_id";
|
||||
static constexpr const char* PLATER_NAME_ATTR = "plater_name";
|
||||
static constexpr const char* PLATE_IDX_ATTR = "index";
|
||||
static constexpr const char* SLICE_PREDICTION_ATTR = "prediction";
|
||||
static constexpr const char* SLICE_WEIGHT_ATTR = "weight";
|
||||
|
@ -2038,6 +2039,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
|
|||
}
|
||||
plate_data_list[it->first-1]->locked = it->second->locked;
|
||||
plate_data_list[it->first-1]->plate_index = it->second->plate_index-1;
|
||||
plate_data_list[it->first - 1]->plate_name = it->second->plate_name;
|
||||
plate_data_list[it->first-1]->obj_inst_map = it->second->obj_inst_map;
|
||||
plate_data_list[it->first-1]->gcode_file = (m_load_restore || it->second->gcode_file.empty()) ? it->second->gcode_file : m_backup_path + "/" + it->second->gcode_file;
|
||||
plate_data_list[it->first-1]->gcode_prediction = it->second->gcode_prediction;
|
||||
|
@ -3814,6 +3816,9 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
|
|||
if (key == PLATERID_ATTR)
|
||||
{
|
||||
m_curr_plater->plate_index = atoi(value.c_str());
|
||||
}
|
||||
else if (key == PLATER_NAME_ATTR) {
|
||||
m_curr_plater->plate_name = encode_path(value.c_str());
|
||||
}
|
||||
else if (key == LOCK_ATTR)
|
||||
{
|
||||
|
@ -6962,6 +6967,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
|
|||
stream << " <" << PLATE_TAG << ">\n";
|
||||
//plate index
|
||||
stream << " <" << METADATA_TAG << " " << KEY_ATTR << "=\"" << PLATERID_ATTR << "\" " << VALUE_ATTR << "=\"" << plate_data->plate_index + 1 << "\"/>\n";
|
||||
stream << " <" << METADATA_TAG << " " << KEY_ATTR << "=\"" << PLATER_NAME_ATTR << "\" " << VALUE_ATTR << "=\"" << decode_path(plate_data->plate_name.c_str()) << "\"/>\n";
|
||||
stream << " <" << METADATA_TAG << " " << KEY_ATTR << "=\"" << LOCK_ATTR << "\" " << VALUE_ATTR << "=\"" << std::boolalpha<< plate_data->locked<< "\"/>\n";
|
||||
ConfigOption* bed_type_opt = plate_data->config.option("curr_bed_type");
|
||||
t_config_enum_names bed_type_names = ConfigOptionEnum<BedType>::get_enum_names();
|
||||
|
|
|
@ -76,6 +76,7 @@ struct PlateData
|
|||
std::string pattern_bbox_file;
|
||||
std::string gcode_prediction;
|
||||
std::string gcode_weight;
|
||||
std::string plate_name;
|
||||
std::vector<FilamentInfo> slice_filaments_info;
|
||||
DynamicPrintConfig config;
|
||||
bool is_support_used {false};
|
||||
|
|
|
@ -1725,6 +1725,12 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
|
|||
m_placeholder_parser.set("bed_temperature_initial_layer_single", new ConfigOptionInt(first_bed_temp_opt->get_at(initial_extruder_id)));
|
||||
m_placeholder_parser.set("bed_temperature_initial_layer_vector", new ConfigOptionString(""));
|
||||
|
||||
//support variables `first_layer_temperature` and `first_layer_bed_temperature`
|
||||
m_placeholder_parser.set("first_layer_bed_temperature", new ConfigOptionInts(*first_bed_temp_opt));
|
||||
m_placeholder_parser.set("first_layer_temperature", new ConfigOptionInts(m_config.nozzle_temperature_initial_layer));
|
||||
m_placeholder_parser.set("max_print_height", new ConfigOptionInt(m_config.printable_height));
|
||||
m_placeholder_parser.set("z_offset", new ConfigOptionFloat(0.0f));
|
||||
m_placeholder_parser.set("plate_name", new ConfigOptionString(print.get_plate_name()));
|
||||
//BBS: calculate the volumetric speed of outer wall. Ignore pre-object setting and multi-filament, and just use the default setting
|
||||
{
|
||||
float filament_max_volumetric_speed = m_config.option<ConfigOptionFloats>("filament_max_volumetric_speed")->get_at(initial_non_support_extruder_id);
|
||||
|
|
|
@ -2167,6 +2167,8 @@ std::string Print::output_filename(const std::string &filename_base) const
|
|||
// These values will be just propagated into the output file name.
|
||||
DynamicConfig config = this->finished() ? this->print_statistics().config() : this->print_statistics().placeholders();
|
||||
config.set_key_value("num_filaments", new ConfigOptionInt((int)m_config.nozzle_diameter.size()));
|
||||
config.set_key_value("plate_name", new ConfigOptionString(get_plate_name()));
|
||||
|
||||
return this->PrintBase::output_filename(m_config.filename_format.value, ".gcode", filename_base, &config);
|
||||
}
|
||||
|
||||
|
|
|
@ -513,6 +513,9 @@ public:
|
|||
bool get_no_check_flag() const { return m_no_check; }
|
||||
void set_no_check_flag(bool no_check) { m_no_check = no_check; }
|
||||
|
||||
std::string get_plate_name() const { return m_plate_name; }
|
||||
void set_plate_name(const std::string &name) { m_plate_name = name; }
|
||||
|
||||
protected:
|
||||
friend class PrintObjectBase;
|
||||
friend class BackgroundSlicingProcess;
|
||||
|
@ -548,6 +551,8 @@ protected:
|
|||
int m_plate_index{ 0 };
|
||||
bool m_no_check = false;
|
||||
|
||||
// current plate name
|
||||
std::string m_plate_name;
|
||||
// Callback to be evoked regularly to update state of the UI thread.
|
||||
status_callback_type m_status_callback;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue