feat: add model_name and plate_number placeholders (#5401)

This uses the BBS project name from the `Project` tab which could be
susceptible to upstream changes removing this feature.

The project_name template only works when you open a 3MF file. If you
create a new project and set the project name `Model.model_info` is
always null whether you save the project or not. If you save the current
project, switch to a new project/different project, then re-load it then
the template works as expected.

The plate number is assumed to always be <100 which matches the
formatting of the plate number in the UI.

Relates-To: https://github.com/SoftFever/OrcaSlicer/issues/3816
This commit is contained in:
William 2024-05-25 00:52:35 +12:00 committed by GitHub
parent 966c18cbad
commit 194ec6b1cd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 25 additions and 0 deletions

View file

@ -2399,6 +2399,8 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
this->placeholder_parser().set("first_layer_temperature", new ConfigOptionInts(m_config.nozzle_temperature_initial_layer));
this->placeholder_parser().set("max_print_height",new ConfigOptionInt(m_config.printable_height));
this->placeholder_parser().set("z_offset", new ConfigOptionFloat(m_config.z_offset));
this->placeholder_parser().set("model_name", new ConfigOptionString(print.get_model_name()));
this->placeholder_parser().set("plate_number", new ConfigOptionString(print.get_plate_number_formatted()));
this->placeholder_parser().set("plate_name", new ConfigOptionString(print.get_plate_name()));
this->placeholder_parser().set("first_layer_height", new ConfigOptionFloat(m_config.initial_layer_print_height.value));