ENH: CLI: add mk information support
JIRA: no jira Change-Id: Idd89b143d439de50d9f52eb8aec95b262d66875d
This commit is contained in:
parent
77339ffa1c
commit
4579623c18
|
@ -913,7 +913,7 @@ int CLI::run(int argc, char **argv)
|
|||
/*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 = 14;
|
||||
int debug_argc = 11;
|
||||
char *debug_argv[] = {
|
||||
"F:\work\projects\bambu_debug\bamboo_slicer\build_debug\src\Debug\bambu-studio.exe",
|
||||
"--debug=2",
|
||||
|
@ -924,11 +924,8 @@ int CLI::run(int argc, char **argv)
|
|||
"--export-3mf=output.3mf",
|
||||
"--filament-colour",
|
||||
"#FFFFFFFF;#0000FFFF;#00FF00FF;#FF0000FF;#00000000;#FFFF00FF",
|
||||
"--allow-multicolor-oneplate=1",
|
||||
"--allow-rotations=0",
|
||||
"--avoid-extrusion-cali-region=1",
|
||||
"--load-assemble-list",
|
||||
"assemble_list.json"
|
||||
"--slice=0",
|
||||
"1.3mf"
|
||||
};
|
||||
if (! this->setup(debug_argc, debug_argv))*/
|
||||
if (!this->setup(argc, argv))
|
||||
|
@ -1058,7 +1055,7 @@ int CLI::run(int argc, char **argv)
|
|||
std::vector<std::string> current_filaments_name, current_filaments_system_name, current_inherits_group;
|
||||
DynamicPrintConfig load_process_config, load_machine_config;
|
||||
bool new_process_config_is_system = true, new_printer_config_is_system = true;
|
||||
std::string pipe_name;
|
||||
std::string pipe_name, makerlab_name, makerlab_version;
|
||||
|
||||
// Read input file(s) if any.
|
||||
BOOST_LOG_TRIVIAL(info) << "Will start to read model file now, file count :" << m_input_files.size() << "\n";
|
||||
|
@ -1111,6 +1108,14 @@ int CLI::run(int argc, char **argv)
|
|||
}
|
||||
}
|
||||
|
||||
ConfigOptionString* makerlab_name_option = m_config.option<ConfigOptionString>("makerlab_name");
|
||||
if (makerlab_name_option)
|
||||
makerlab_name = makerlab_name_option->value;
|
||||
|
||||
ConfigOptionString* makerlab_version_option = m_config.option<ConfigOptionString>("makerlab_version");
|
||||
if (makerlab_version_option)
|
||||
makerlab_version = makerlab_version_option->value;
|
||||
|
||||
//skip model object map construct
|
||||
if (need_skip) {
|
||||
BOOST_LOG_TRIVIAL(info) << boost::format("need to skip objects, size %1%:")%skip_objects.size();
|
||||
|
@ -5234,6 +5239,13 @@ int CLI::run(int argc, char **argv)
|
|||
#endif
|
||||
|
||||
BOOST_LOG_TRIVIAL(info) << "will export 3mf to " << export_3mf_file << std::endl;
|
||||
if (!makerlab_name.empty()) {
|
||||
Model &model = m_models[0];
|
||||
|
||||
model.mk_name = makerlab_name;
|
||||
model.mk_version = makerlab_version;
|
||||
BOOST_LOG_TRIVIAL(info) << boost::format("mk_name %1%, mk_version %2%")%makerlab_name %makerlab_version;
|
||||
}
|
||||
if (! this->export_project(&m_models[0], export_3mf_file, plate_data_list, project_presets, thumbnails, top_thumbnails, pick_thumbnails,
|
||||
calibration_thumbnails, plate_bboxes, &m_print_config, minimum_save, plate_to_slice - 1))
|
||||
{
|
||||
|
|
|
@ -125,6 +125,9 @@ const std::string BBL_REGION_TAG = "Region";
|
|||
const std::string BBL_MODIFICATION_TAG = "ModificationDate";
|
||||
const std::string BBL_CREATION_DATE_TAG = "CreationDate";
|
||||
const std::string BBL_APPLICATION_TAG = "Application";
|
||||
const std::string BBL_MAKERLAB_TAG = "MakerLab";
|
||||
const std::string BBL_MAKERLAB_VERSION_TAG = "MakerLabVersion";
|
||||
|
||||
|
||||
const std::string BBL_PROFILE_TITLE_TAG = "ProfileTitle";
|
||||
const std::string BBL_PROFILE_COVER_TAG = "ProfileCover";
|
||||
|
@ -6175,6 +6178,15 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
|
|||
}
|
||||
metadata_item_map[BBS_3MF_VERSION] = std::to_string(VERSION_BBS_3MF);
|
||||
|
||||
if (!model.mk_name.empty()) {
|
||||
metadata_item_map[BBL_MAKERLAB_TAG] = xml_escape(model.mk_name);
|
||||
BOOST_LOG_TRIVIAL(info) << "saved mk_name " << model.mk_name;
|
||||
}
|
||||
if (!model.mk_version.empty()) {
|
||||
metadata_item_map[BBL_MAKERLAB_VERSION_TAG] = xml_escape(model.mk_version);
|
||||
BOOST_LOG_TRIVIAL(info) << "saved mk_version " << model.mk_version;
|
||||
}
|
||||
|
||||
// store metadata info
|
||||
for (auto item : metadata_item_map) {
|
||||
BOOST_LOG_TRIVIAL(info) << "bbs_3mf: save key= " << item.first << ", value = " << item.second;
|
||||
|
|
|
@ -89,6 +89,9 @@ Model& Model::assign_copy(const Model &rhs)
|
|||
this->stl_design_id = rhs.stl_design_id;
|
||||
this->profile_info = rhs.profile_info;
|
||||
|
||||
this->mk_name = rhs.mk_name;
|
||||
this->mk_version = rhs.mk_version;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -117,6 +120,8 @@ Model& Model::assign_copy(Model &&rhs)
|
|||
//BBS: add auxiliary path logic
|
||||
// BBS: backup, all in one temp dir
|
||||
this->stl_design_id = rhs.stl_design_id;
|
||||
this->mk_name = rhs.mk_name;
|
||||
this->mk_version = rhs.mk_version;
|
||||
this->backup_path = std::move(rhs.backup_path);
|
||||
this->object_backup_id_map = std::move(rhs.object_backup_id_map);
|
||||
this->next_object_backup_id = rhs.next_object_backup_id;
|
||||
|
@ -917,6 +922,8 @@ void Model::load_from(Model& model)
|
|||
stl_design_id = model.stl_design_id;
|
||||
model_info = model.model_info;
|
||||
profile_info = model.profile_info;
|
||||
mk_name = model.mk_name;
|
||||
mk_version = model.mk_version;
|
||||
model.design_info.reset();
|
||||
model.model_info.reset();
|
||||
model.profile_info.reset();
|
||||
|
@ -1723,7 +1730,7 @@ indexed_triangle_set ModelObject::get_connector_mesh(CutConnectorAttributes conn
|
|||
break;
|
||||
}
|
||||
|
||||
if (connector_attributes.type == CutConnectorType::Snap)
|
||||
if (connector_attributes.type == CutConnectorType::Snap)
|
||||
connector_mesh = its_make_snap(1.0, 1.0, para.snap_space_proportion, para.snap_bulge_proportion);
|
||||
else if(connector_attributes.style == CutConnectorStyle::Prizm)
|
||||
connector_mesh = its_make_cylinder(1.0, 1.0, (2 * PI / sectorCount));
|
||||
|
|
|
@ -1513,6 +1513,10 @@ public:
|
|||
std::shared_ptr<ModelInfo> model_info = nullptr;
|
||||
std::shared_ptr<ModelProfileInfo> profile_info = nullptr;
|
||||
|
||||
//makerlab information
|
||||
std::string mk_name;
|
||||
std::string mk_version;
|
||||
|
||||
void SetDesigner(std::string designer, std::string designer_user_id) {
|
||||
if (design_info == nullptr) {
|
||||
design_info = std::make_shared<ModelDesignInfo>();
|
||||
|
|
|
@ -5541,6 +5541,18 @@ CLIMiscConfigDef::CLIMiscConfigDef()
|
|||
def->tooltip = "Skip the modified gcodes in 3mf from Printer or filament Presets";
|
||||
def->cli_params = "option";
|
||||
def->set_default_value(new ConfigOptionBool(false));
|
||||
|
||||
def = this->add("makerlab_name", coString);
|
||||
def->label = "MakerLab name";
|
||||
def->tooltip = "MakerLab name to generate this 3mf";
|
||||
def->cli_params = "name";
|
||||
def->set_default_value(new ConfigOptionString());
|
||||
|
||||
def = this->add("makerlab_version", coString);
|
||||
def->label = "MakerLab version";
|
||||
def->tooltip = "MakerLab version to generate this 3mf";
|
||||
def->cli_params = "version";
|
||||
def->set_default_value(new ConfigOptionString());
|
||||
}
|
||||
|
||||
const CLIActionsConfigDef cli_actions_config_def;
|
||||
|
|
Loading…
Reference in New Issue