mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-07 23:17:35 -06:00
ENH: some change to support layer height edit
1 delete adaptive layer height config 2 support load and save layer heights profile with 3MF Signed-off-by: salt.wei <salt.wei@bambulab.com> Change-Id: I109b3b791c3130b5ab2df445e8ae5cb55a78cec1
This commit is contained in:
parent
c1599aa138
commit
13ca93adc8
7 changed files with 26 additions and 45 deletions
|
@ -142,8 +142,8 @@ const std::string BBS_PROJECT_CONFIG_FILE = "Metadata/project_settings.config";
|
|||
const std::string BBS_MODEL_CONFIG_FILE = "Metadata/model_settings.config";
|
||||
const std::string BBS_MODEL_CONFIG_RELS_FILE = "Metadata/_rels/model_settings.config.rels";
|
||||
const std::string SLICE_INFO_CONFIG_FILE = "Metadata/slice_info.config";
|
||||
/*const std::string LAYER_HEIGHTS_PROFILE_FILE = "Metadata/Slic3r_PE_layer_heights_profile.txt";
|
||||
const std::string LAYER_CONFIG_RANGES_FILE = "Metadata/Prusa_Slicer_layer_config_ranges.xml";
|
||||
const std::string BBS_LAYER_HEIGHTS_PROFILE_FILE = "Metadata/layer_heights_profile.txt";
|
||||
/*const std::string LAYER_CONFIG_RANGES_FILE = "Metadata/Prusa_Slicer_layer_config_ranges.xml";
|
||||
const std::string SLA_SUPPORT_POINTS_FILE = "Metadata/Slic3r_PE_sla_support_points.txt";
|
||||
const std::string SLA_DRAIN_HOLES_FILE = "Metadata/Slic3r_PE_sla_drain_holes.txt";*/
|
||||
const std::string CUSTOM_GCODE_PER_PRINT_Z_FILE = "Metadata/custom_gcode_per_layer.xml";
|
||||
|
@ -671,8 +671,8 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
|
|||
typedef std::vector<Instance> InstancesList;
|
||||
typedef std::map<int, ObjectMetadata> IdToMetadataMap;
|
||||
//typedef std::map<Id, Geometry> IdToGeometryMap;
|
||||
/*typedef std::map<int, std::vector<coordf_t>> IdToLayerHeightsProfileMap;
|
||||
typedef std::map<int, t_layer_config_ranges> IdToLayerConfigRangesMap;
|
||||
typedef std::map<int, std::vector<coordf_t>> IdToLayerHeightsProfileMap;
|
||||
/*typedef std::map<int, t_layer_config_ranges> IdToLayerConfigRangesMap;
|
||||
typedef std::map<int, std::vector<sla::SupportPoint>> IdToSlaSupportPointsMap;
|
||||
typedef std::map<int, std::vector<sla::DrainHole>> IdToSlaDrainHolesMap;*/
|
||||
|
||||
|
@ -715,8 +715,8 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
|
|||
//IdToGeometryMap m_orig_geometries; // backup & restore
|
||||
CurrentConfig m_curr_config;
|
||||
IdToMetadataMap m_objects_metadata;
|
||||
/*IdToLayerHeightsProfileMap m_layer_heights_profiles;
|
||||
IdToLayerConfigRangesMap m_layer_config_ranges;
|
||||
IdToLayerHeightsProfileMap m_layer_heights_profiles;
|
||||
/*IdToLayerConfigRangesMap m_layer_config_ranges;
|
||||
IdToSlaSupportPointsMap m_sla_support_points;
|
||||
IdToSlaDrainHolesMap m_sla_drain_holes;*/
|
||||
std::string m_curr_metadata_name;
|
||||
|
@ -965,7 +965,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
|
|||
m_curr_config.object_id = -1;
|
||||
m_curr_config.volume_id = -1;
|
||||
m_objects_metadata.clear();
|
||||
//m_layer_heights_profiles.clear();
|
||||
m_layer_heights_profiles.clear();
|
||||
//m_layer_config_ranges.clear();
|
||||
//m_sla_support_points.clear();
|
||||
m_curr_metadata_name.clear();
|
||||
|
@ -1222,13 +1222,12 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
|
|||
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ":" << __LINE__ << boost::format("extract file %1%\n")%name;
|
||||
|
||||
//BBS: disable adaptive layer height related file in 3MF
|
||||
/* if (boost::algorithm::iequals(name, LAYER_HEIGHTS_PROFILE_FILE)) {
|
||||
if (boost::algorithm::iequals(name, BBS_LAYER_HEIGHTS_PROFILE_FILE)) {
|
||||
// extract slic3r layer heights profile file
|
||||
_extract_layer_heights_profile_config_from_archive(archive, stat);
|
||||
}
|
||||
else
|
||||
if (boost::algorithm::iequals(name, LAYER_CONFIG_RANGES_FILE)) {
|
||||
/*if (boost::algorithm::iequals(name, LAYER_CONFIG_RANGES_FILE)) {
|
||||
// extract slic3r layer config ranges file
|
||||
_extract_layer_config_ranges_from_archive(archive, stat, config_substitutions);
|
||||
}*/
|
||||
|
@ -1377,12 +1376,12 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
|
|||
}*/
|
||||
|
||||
// m_layer_heights_profiles are indexed by a 1 based model object index.
|
||||
/*IdToLayerHeightsProfileMap::iterator obj_layer_heights_profile = m_layer_heights_profiles.find(object.second + 1);
|
||||
IdToLayerHeightsProfileMap::iterator obj_layer_heights_profile = m_layer_heights_profiles.find(object.second + 1);
|
||||
if (obj_layer_heights_profile != m_layer_heights_profiles.end())
|
||||
model_object->layer_height_profile.set(std::move(obj_layer_heights_profile->second));
|
||||
|
||||
// m_layer_config_ranges are indexed by a 1 based model object index.
|
||||
IdToLayerConfigRangesMap::iterator obj_layer_config_ranges = m_layer_config_ranges.find(object.second + 1);
|
||||
/*IdToLayerConfigRangesMap::iterator obj_layer_config_ranges = m_layer_config_ranges.find(object.second + 1);
|
||||
if (obj_layer_config_ranges != m_layer_config_ranges.end())
|
||||
model_object->layer_config_ranges = std::move(obj_layer_config_ranges->second);
|
||||
|
||||
|
@ -1916,7 +1915,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
|
|||
return;
|
||||
}
|
||||
|
||||
/*void _BBS_3MF_Importer::_extract_layer_heights_profile_config_from_archive(mz_zip_archive& archive, const mz_zip_archive_file_stat& stat)
|
||||
void _BBS_3MF_Importer::_extract_layer_heights_profile_config_from_archive(mz_zip_archive& archive, const mz_zip_archive_file_stat& stat)
|
||||
{
|
||||
if (stat.m_uncomp_size > 0) {
|
||||
std::string buffer((size_t)stat.m_uncomp_size, 0);
|
||||
|
@ -1977,7 +1976,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
void _BBS_3MF_Importer::_extract_layer_config_ranges_from_archive(mz_zip_archive& archive, const mz_zip_archive_file_stat& stat, ConfigSubstitutionContext& config_substitutions)
|
||||
{
|
||||
if (stat.m_uncomp_size > 0) {
|
||||
|
@ -4162,11 +4161,11 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
|
|||
// Adds layer height profile file ("Metadata/Slic3r_PE_layer_heights_profile.txt").
|
||||
// All layer height profiles of all ModelObjects are stored here, indexed by 1 based index of the ModelObject in Model.
|
||||
// The index differes from the index of an object ID of an object instance of a 3MF file!
|
||||
// BBS: don't need to save layer_height_profile because we calculate when slicing every time.
|
||||
/*
|
||||
if (!_add_layer_height_profile_file_to_archive(archive, model)) {
|
||||
close_zip_writer(&archive);
|
||||
boost::filesystem::remove(filename);
|
||||
return false;
|
||||
}*/
|
||||
}
|
||||
|
||||
// BBS progress point
|
||||
/*BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ":" <<__LINE__ << boost::format("export 3mf EXPORT_STAGE_ADD_LAYER_RANGE\n");
|
||||
|
@ -5178,7 +5177,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
|
|||
return true;
|
||||
}
|
||||
|
||||
/*bool _BBS_3MF_Exporter::_add_layer_height_profile_file_to_archive(mz_zip_archive& archive, Model& model)
|
||||
bool _BBS_3MF_Exporter::_add_layer_height_profile_file_to_archive(mz_zip_archive& archive, Model& model)
|
||||
{
|
||||
assert(is_decimal_separator_point());
|
||||
std::string out = "";
|
||||
|
@ -5203,7 +5202,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
|
|||
}
|
||||
|
||||
if (!out.empty()) {
|
||||
if (!mz_zip_writer_add_mem(&archive, LAYER_HEIGHTS_PROFILE_FILE.c_str(), (const void*)out.data(), out.length(), MZ_DEFAULT_COMPRESSION)) {
|
||||
if (!mz_zip_writer_add_mem(&archive, BBS_LAYER_HEIGHTS_PROFILE_FILE.c_str(), (const void*)out.data(), out.length(), MZ_DEFAULT_COMPRESSION)) {
|
||||
add_error("Unable to add layer heights profile file to archive");
|
||||
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << ":" << __LINE__ << boost::format("Unable to add layer heights profile file to archive\n");
|
||||
return false;
|
||||
|
@ -5212,7 +5211,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
bool _BBS_3MF_Exporter::_add_layer_config_ranges_file_to_archive(mz_zip_archive& archive, Model& model)
|
||||
{
|
||||
std::string out = "";
|
||||
|
|
|
@ -3720,7 +3720,7 @@ void PrintConfigDef::handle_legacy(t_config_option_key &opt_key, std::string &va
|
|||
"support_bottom_z_distance", "support_closing_radius",
|
||||
"remove_freq_sweep", "remove_bed_leveling", "remove_extrusion_calibration",
|
||||
"support_transition_line_width", "support_transition_speed", "bed_temperature", "bed_temperature_initial_layer",
|
||||
"can_switch_nozzle_type", "can_add_auxiliary_fan", "extra_flush_volume", "spaghetti_detector"
|
||||
"can_switch_nozzle_type", "can_add_auxiliary_fan", "extra_flush_volume", "spaghetti_detector", "adaptive_layer_height"
|
||||
};
|
||||
|
||||
if (ignore.find(opt_key) != ignore.end()) {
|
||||
|
|
|
@ -699,8 +699,6 @@ bool PrintObject::invalidate_state_by_config_options(
|
|||
steps.emplace_back(posPerimeters);
|
||||
} else if (
|
||||
opt_key == "layer_height"
|
||||
//BBS
|
||||
|| opt_key == "adaptive_layer_height"
|
||||
|| opt_key == "raft_layers"
|
||||
|| opt_key == "raft_contact_distance"
|
||||
|| opt_key == "slice_closing_radius"
|
||||
|
@ -1893,7 +1891,7 @@ std::vector<unsigned int> PrintObject::object_extruders() const
|
|||
bool PrintObject::update_layer_height_profile(const ModelObject &model_object, const SlicingParameters &slicing_parameters, std::vector<coordf_t> &layer_height_profile)
|
||||
{
|
||||
bool updated = false;
|
||||
//BBS:annotate these part and will do adaptive layer height below
|
||||
|
||||
if (layer_height_profile.empty()) {
|
||||
// use the constructor because the assignement is crashing on ASAN OsX
|
||||
layer_height_profile = std::vector<coordf_t>(model_object.layer_height_profile.get());
|
||||
|
@ -1915,17 +1913,6 @@ bool PrintObject::update_layer_height_profile(const ModelObject &model_object, c
|
|||
updated = true;
|
||||
}
|
||||
|
||||
//BBS
|
||||
//if (slicing_parameters.adaptive_layer_height) {
|
||||
// layer_height_profile = layer_height_profile_adaptive(slicing_parameters, model_object, 0.5);
|
||||
// HeightProfileSmoothingParams smoothing_params(5, true);
|
||||
// layer_height_profile = smooth_height_profile(layer_height_profile, slicing_parameters, smoothing_params);
|
||||
//}
|
||||
//else {
|
||||
// layer_height_profile = layer_height_profile_from_ranges(slicing_parameters, model_object.layer_config_ranges);
|
||||
//}
|
||||
//updated = true;
|
||||
|
||||
return updated;
|
||||
}
|
||||
|
||||
|
|
|
@ -84,8 +84,6 @@ SlicingParameters SlicingParameters::create_from_config(
|
|||
params.object_print_z_max = object_height;
|
||||
params.base_raft_layers = object_config.raft_layers.value;
|
||||
params.soluble_interface = soluble_interface;
|
||||
//BBS
|
||||
params.adaptive_layer_height = print_config.enable_prime_tower ? false : object_config.adaptive_layer_height;
|
||||
|
||||
// Miniumum/maximum of the minimum layer height over all extruders.
|
||||
params.min_layer_height = MIN_LAYER_HEIGHT;
|
||||
|
|
|
@ -96,8 +96,6 @@ struct SlicingParameters
|
|||
// In case of a soluble interface, object_print_z_min == raft_contact_top_z, otherwise there is a gap between the raft and the 1st object layer.
|
||||
coordf_t object_print_z_min { 0 };
|
||||
coordf_t object_print_z_max { 0 };
|
||||
//BBS
|
||||
bool adaptive_layer_height{ false };
|
||||
};
|
||||
static_assert(IsTriviallyCopyable<SlicingParameters>::value, "SlicingParameters class is not POD (and it should be - see constructor).");
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ static bool is_improper_category(const std::string& category, const int filament
|
|||
static SettingsFactory::Bundle FREQ_SETTINGS_BUNDLE_FFF =
|
||||
{
|
||||
//BBS
|
||||
{ L("Quality"), { "layer_height" , "adaptive_layer_height" } },
|
||||
{ L("Quality"), { "layer_height" } },
|
||||
{ L("Shell"), { "wall_loops", "top_shell_layers", "bottom_shell_layers"} },
|
||||
{ L("Infill") , { "sparse_infill_density", "sparse_infill_pattern" } },
|
||||
// BBS
|
||||
|
@ -72,9 +72,9 @@ std::map<std::string, std::vector<SimpleSettingData>> SettingsFactory::OBJECT_C
|
|||
{
|
||||
{ L("Quality"), {{"layer_height", "",1},
|
||||
//{"initial_layer_print_height", "",2},
|
||||
{"adaptive_layer_height", "",2},{"seam_position", "",3},
|
||||
{"slice_closing_radius", "",4}, {"resolution", "",5},
|
||||
{"xy_hole_compensation", "",6}, {"xy_contour_compensation", "",7}, {"elefant_foot_compensation", "",8}
|
||||
{"seam_position", "",2},
|
||||
{"slice_closing_radius", "",3}, {"resolution", "",4},
|
||||
{"xy_hole_compensation", "",5}, {"xy_contour_compensation", "",6}, {"elefant_foot_compensation", "",7}
|
||||
}},
|
||||
{ L("Support"), {{"brim_type", "",1},{"brim_width", "",2},{"brim_object_gap", "",3},
|
||||
{"enable_support", "",4},{"support_type", "",5},{"support_threshold_angle", "",6},{"support_on_build_plate_only", "",7},
|
||||
|
@ -90,7 +90,7 @@ std::map<std::string, std::vector<SimpleSettingData>> SettingsFactory::OBJECT_C
|
|||
|
||||
std::map<std::string, std::vector<SimpleSettingData>> SettingsFactory::PART_CATEGORY_SETTINGS=
|
||||
{
|
||||
{ L("Quality"), {{"ironing_type", "",9},{"ironing_flow", "",10},{"ironing_spacing", "",11},{"bridge_flow", "",12}
|
||||
{ L("Quality"), {{"ironing_type", "",8},{"ironing_flow", "",9},{"ironing_spacing", "",10},{"bridge_flow", "",11}
|
||||
}},
|
||||
{ L("Strength"), {{"wall_loops", "",1},{"top_shell_layers", L("Top Solid Layers"),1},{"top_shell_thickness", L("Top Minimum Shell Thickness"),1},
|
||||
{"bottom_shell_layers", L("Bottom Solid Layers"),1}, {"bottom_shell_thickness", L("Bottom Minimum Shell Thickness"),1},
|
||||
|
|
|
@ -1747,7 +1747,6 @@ void TabPrint::build()
|
|||
auto optgroup = page->new_optgroup(L("Layer height"), L"param_layer_height");
|
||||
optgroup->append_single_option_line("layer_height");
|
||||
optgroup->append_single_option_line("initial_layer_print_height");
|
||||
optgroup->append_single_option_line("adaptive_layer_height", "adaptive-layer-height");
|
||||
|
||||
optgroup = page->new_optgroup(L("Line width"), L"param_line_width");
|
||||
optgroup->append_single_option_line("line_width");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue