Store / retrieve layer height profile from the AMF file.

Reset the layer height profile when changing a print profile to an incompatible one.
Reset button on the layer height bar.
Fixed an update issue on zooming by a scroll wheel.
Fixed an issue when loading an AMF file: Object names are now retained.
This commit is contained in:
bubnikv 2017-02-09 14:56:13 +01:00
parent 61c0ae4e94
commit 88e34ff5de
14 changed files with 379 additions and 154 deletions

View file

@ -170,6 +170,10 @@ ModelMaterial::attributes()
void set_layer_height_ranges(t_layer_height_ranges ranges)
%code%{ THIS->layer_height_ranges = ranges; %};
std::vector<double> layer_height_profile()
%code%{ RETVAL = THIS->layer_height_profile_valid ? THIS->layer_height_profile : std::vector<double>(); %};
void set_layer_height_profile(std::vector<double> profile)
%code%{ THIS->layer_height_profile = profile; THIS->layer_height_profile_valid = true; %};
Ref<Pointf3> origin_translation()
%code%{ RETVAL = &THIS->origin_translation; %};

View file

@ -120,23 +120,39 @@ _constant()
void _infill();
void _generate_support_material();
bool update_layer_height_profile();
std::vector<double> get_layer_height_min_max()
%code%{
SlicingParameters slicing_params = THIS->slicing_parameters();
RETVAL.push_back(slicing_params.min_layer_height);
RETVAL.push_back(slicing_params.max_layer_height);
RETVAL.push_back(slicing_params.first_print_layer_height);
RETVAL.push_back(slicing_params.first_object_layer_height);
RETVAL.push_back(slicing_params.layer_height);
%};
void adjust_layer_height_profile(coordf_t z, coordf_t layer_thickness_delta, coordf_t band_width, int action)
%code%{
THIS->update_layer_height_profile();
%code%{
THIS->update_layer_height_profile(THIS->model_object()->layer_height_profile);
adjust_layer_height_profile(
THIS->slicing_parameters(), THIS->layer_height_profile, z, layer_thickness_delta, band_width, LayerHeightEditActionType(action));
THIS->slicing_parameters(), THIS->model_object()->layer_height_profile, z, layer_thickness_delta, band_width, LayerHeightEditActionType(action));
THIS->model_object()->layer_height_profile_valid = true;
THIS->layer_height_profile_valid = false;
%};
void reset_layer_height_profile();
int generate_layer_height_texture(void *data, int rows, int cols, bool level_of_detail_2nd_level = true)
int generate_layer_height_texture(void *data, int rows, int cols, bool force = true)
%code%{
THIS->update_layer_height_profile();
SlicingParameters slicing_params = THIS->slicing_parameters();
RETVAL = generate_layer_height_texture(
slicing_params,
generate_object_layers(slicing_params, THIS->layer_height_profile),
data, rows, cols, level_of_detail_2nd_level);
force |= THIS->update_layer_height_profile(THIS->model_object()->layer_height_profile);
if (force) {
SlicingParameters slicing_params = THIS->slicing_parameters();
bool level_of_detail_2nd_level = true;
RETVAL = generate_layer_height_texture(
slicing_params,
generate_object_layers(slicing_params, THIS->model_object()->layer_height_profile),
data, rows, cols, level_of_detail_2nd_level);
} else
RETVAL = 0;
%};
int ptr()