Experiments with updating layer_config_ranges from UI
+ Fixed OSX build
This commit is contained in:
parent
4b3df010ab
commit
1090105b68
8 changed files with 38 additions and 19 deletions
|
@ -600,6 +600,7 @@ ModelObject& ModelObject::assign_copy(const ModelObject &rhs)
|
||||||
this->sla_support_points = rhs.sla_support_points;
|
this->sla_support_points = rhs.sla_support_points;
|
||||||
this->sla_points_status = rhs.sla_points_status;
|
this->sla_points_status = rhs.sla_points_status;
|
||||||
this->layer_height_ranges = rhs.layer_height_ranges;
|
this->layer_height_ranges = rhs.layer_height_ranges;
|
||||||
|
this->layer_config_ranges = rhs.layer_config_ranges; // #ys_FIXME_experiment
|
||||||
this->layer_height_profile = rhs.layer_height_profile;
|
this->layer_height_profile = rhs.layer_height_profile;
|
||||||
this->origin_translation = rhs.origin_translation;
|
this->origin_translation = rhs.origin_translation;
|
||||||
m_bounding_box = rhs.m_bounding_box;
|
m_bounding_box = rhs.m_bounding_box;
|
||||||
|
@ -636,6 +637,7 @@ ModelObject& ModelObject::assign_copy(ModelObject &&rhs)
|
||||||
this->sla_support_points = std::move(rhs.sla_support_points);
|
this->sla_support_points = std::move(rhs.sla_support_points);
|
||||||
this->sla_points_status = std::move(rhs.sla_points_status);
|
this->sla_points_status = std::move(rhs.sla_points_status);
|
||||||
this->layer_height_ranges = std::move(rhs.layer_height_ranges);
|
this->layer_height_ranges = std::move(rhs.layer_height_ranges);
|
||||||
|
this->layer_config_ranges = std::move(rhs.layer_config_ranges); // #ys_FIXME_experiment
|
||||||
this->layer_height_profile = std::move(rhs.layer_height_profile);
|
this->layer_height_profile = std::move(rhs.layer_height_profile);
|
||||||
this->origin_translation = std::move(rhs.origin_translation);
|
this->origin_translation = std::move(rhs.origin_translation);
|
||||||
m_bounding_box = std::move(rhs.m_bounding_box);
|
m_bounding_box = std::move(rhs.m_bounding_box);
|
||||||
|
|
|
@ -874,7 +874,8 @@ Print::ApplyStatus Print::apply(const Model &model, const DynamicPrintConfig &co
|
||||||
bool support_enforcers_differ = model_volume_list_changed(model_object, model_object_new, ModelVolumeType::SUPPORT_ENFORCER);
|
bool support_enforcers_differ = model_volume_list_changed(model_object, model_object_new, ModelVolumeType::SUPPORT_ENFORCER);
|
||||||
if (model_parts_differ || modifiers_differ ||
|
if (model_parts_differ || modifiers_differ ||
|
||||||
model_object.origin_translation != model_object_new.origin_translation ||
|
model_object.origin_translation != model_object_new.origin_translation ||
|
||||||
model_object.layer_height_ranges != model_object_new.layer_height_ranges ||
|
// model_object.layer_height_ranges != model_object_new.layer_height_ranges ||
|
||||||
|
model_object.layer_config_ranges != model_object_new.layer_config_ranges || // #ys_FIXME_experiment
|
||||||
model_object.layer_height_profile != model_object_new.layer_height_profile) {
|
model_object.layer_height_profile != model_object_new.layer_height_profile) {
|
||||||
// The very first step (the slicing step) is invalidated. One may freely remove all associated PrintObjects.
|
// The very first step (the slicing step) is invalidated. One may freely remove all associated PrintObjects.
|
||||||
auto range = print_object_status.equal_range(PrintObjectStatus(model_object.id()));
|
auto range = print_object_status.equal_range(PrintObjectStatus(model_object.id()));
|
||||||
|
@ -1227,7 +1228,8 @@ std::string Print::validate() const
|
||||||
bool has_custom_layering = false;
|
bool has_custom_layering = false;
|
||||||
std::vector<std::vector<coordf_t>> layer_height_profiles;
|
std::vector<std::vector<coordf_t>> layer_height_profiles;
|
||||||
for (const PrintObject *object : m_objects) {
|
for (const PrintObject *object : m_objects) {
|
||||||
has_custom_layering = ! object->model_object()->layer_height_ranges.empty() || ! object->model_object()->layer_height_profile.empty();
|
// has_custom_layering = ! object->model_object()->layer_height_ranges.empty() || ! object->model_object()->layer_height_profile.empty();
|
||||||
|
has_custom_layering = ! object->model_object()->layer_config_ranges.empty() || ! object->model_object()->layer_height_profile.empty(); // #ys_FIXME_experiment
|
||||||
if (has_custom_layering) {
|
if (has_custom_layering) {
|
||||||
layer_height_profiles.assign(m_objects.size(), std::vector<coordf_t>());
|
layer_height_profiles.assign(m_objects.size(), std::vector<coordf_t>());
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1434,8 +1434,9 @@ bool PrintObject::update_layer_height_profile(const ModelObject &model_object, c
|
||||||
// if (this->layer_height_profile.empty())
|
// if (this->layer_height_profile.empty())
|
||||||
layer_height_profile = layer_height_profile_adaptive(slicing_parameters, model_object.layer_height_ranges, model_object.volumes);
|
layer_height_profile = layer_height_profile_adaptive(slicing_parameters, model_object.layer_height_ranges, model_object.volumes);
|
||||||
else
|
else
|
||||||
layer_height_profile = layer_height_profile_from_ranges(slicing_parameters, model_object.layer_height_ranges);
|
// layer_height_profile = layer_height_profile_from_ranges(slicing_parameters, model_object.layer_height_ranges);
|
||||||
updated = true;
|
layer_height_profile = layer_height_profile_from_ranges(slicing_parameters, model_object.layer_config_ranges); // #ys_FIXME_experiment
|
||||||
|
updated = true;
|
||||||
}
|
}
|
||||||
return updated;
|
return updated;
|
||||||
}
|
}
|
||||||
|
|
|
@ -157,20 +157,25 @@ SlicingParameters SlicingParameters::create_from_config(
|
||||||
// in the height profile and the printed object may be lifted by the raft thickness at the time of the G-code generation.
|
// in the height profile and the printed object may be lifted by the raft thickness at the time of the G-code generation.
|
||||||
std::vector<coordf_t> layer_height_profile_from_ranges(
|
std::vector<coordf_t> layer_height_profile_from_ranges(
|
||||||
const SlicingParameters &slicing_params,
|
const SlicingParameters &slicing_params,
|
||||||
const t_layer_height_ranges &layer_height_ranges)
|
// const t_layer_height_ranges &layer_height_ranges)
|
||||||
|
const t_layer_config_ranges &layer_config_ranges) // #ys_FIXME_experiment
|
||||||
{
|
{
|
||||||
// 1) If there are any height ranges, trim one by the other to make them non-overlapping. Insert the 1st layer if fixed.
|
// 1) If there are any height ranges, trim one by the other to make them non-overlapping. Insert the 1st layer if fixed.
|
||||||
std::vector<std::pair<t_layer_height_range,coordf_t>> ranges_non_overlapping;
|
std::vector<std::pair<t_layer_height_range,coordf_t>> ranges_non_overlapping;
|
||||||
ranges_non_overlapping.reserve(layer_height_ranges.size() * 4);
|
// ranges_non_overlapping.reserve(layer_height_ranges.size() * 4);
|
||||||
|
ranges_non_overlapping.reserve(layer_config_ranges.size() * 4); // #ys_FIXME_experiment
|
||||||
if (slicing_params.first_object_layer_height_fixed())
|
if (slicing_params.first_object_layer_height_fixed())
|
||||||
ranges_non_overlapping.push_back(std::pair<t_layer_height_range,coordf_t>(
|
ranges_non_overlapping.push_back(std::pair<t_layer_height_range,coordf_t>(
|
||||||
t_layer_height_range(0., slicing_params.first_object_layer_height),
|
t_layer_height_range(0., slicing_params.first_object_layer_height),
|
||||||
slicing_params.first_object_layer_height));
|
slicing_params.first_object_layer_height));
|
||||||
// The height ranges are sorted lexicographically by low / high layer boundaries.
|
// The height ranges are sorted lexicographically by low / high layer boundaries.
|
||||||
for (t_layer_height_ranges::const_iterator it_range = layer_height_ranges.begin(); it_range != layer_height_ranges.end(); ++ it_range) {
|
// for (t_layer_height_ranges::const_iterator it_range = layer_height_ranges.begin(); it_range != layer_height_ranges.end(); ++ it_range) {
|
||||||
|
for (t_layer_config_ranges::const_iterator it_range = layer_config_ranges.begin();
|
||||||
|
it_range != layer_config_ranges.end(); ++ it_range) { // #ys_FIXME_experiment
|
||||||
coordf_t lo = it_range->first.first;
|
coordf_t lo = it_range->first.first;
|
||||||
coordf_t hi = std::min(it_range->first.second, slicing_params.object_print_z_height());
|
coordf_t hi = std::min(it_range->first.second, slicing_params.object_print_z_height());
|
||||||
coordf_t height = it_range->second;
|
// coordf_t height = it_range->second;
|
||||||
|
coordf_t height = it_range->second.option("layer_height")->getFloat(); // #ys_FIXME_experiment
|
||||||
if (! ranges_non_overlapping.empty())
|
if (! ranges_non_overlapping.empty())
|
||||||
// Trim current low with the last high.
|
// Trim current low with the last high.
|
||||||
lo = std::max(lo, ranges_non_overlapping.back().first.second);
|
lo = std::max(lo, ranges_non_overlapping.back().first.second);
|
||||||
|
|
|
@ -135,7 +135,8 @@ typedef std::map<t_layer_height_range, DynamicPrintConfig> t_layer_config_ranges
|
||||||
|
|
||||||
extern std::vector<coordf_t> layer_height_profile_from_ranges(
|
extern std::vector<coordf_t> layer_height_profile_from_ranges(
|
||||||
const SlicingParameters &slicing_params,
|
const SlicingParameters &slicing_params,
|
||||||
const t_layer_height_ranges &layer_height_ranges);
|
// const t_layer_height_ranges &layer_height_ranges);
|
||||||
|
const t_layer_config_ranges &layer_config_ranges);
|
||||||
|
|
||||||
extern std::vector<coordf_t> layer_height_profile_adaptive(
|
extern std::vector<coordf_t> layer_height_profile_adaptive(
|
||||||
const SlicingParameters &slicing_params,
|
const SlicingParameters &slicing_params,
|
||||||
|
|
|
@ -12,6 +12,10 @@ class ModelObject;
|
||||||
namespace GUI {
|
namespace GUI {
|
||||||
class ConfigOptionsGroup;
|
class ConfigOptionsGroup;
|
||||||
|
|
||||||
|
typedef double coordf_t;
|
||||||
|
typedef std::pair<coordf_t, coordf_t> t_layer_height_range;
|
||||||
|
typedef std::map<t_layer_height_range, DynamicPrintConfig> t_layer_config_ranges;
|
||||||
|
|
||||||
class LayerRangeEditor : public wxTextCtrl
|
class LayerRangeEditor : public wxTextCtrl
|
||||||
{
|
{
|
||||||
bool m_enter_pressed { false };
|
bool m_enter_pressed { false };
|
||||||
|
@ -34,8 +38,8 @@ class ObjectLayers : public OG_Settings
|
||||||
ScalableBitmap m_bmp_add;
|
ScalableBitmap m_bmp_add;
|
||||||
ModelObject* m_object {nullptr};
|
ModelObject* m_object {nullptr};
|
||||||
|
|
||||||
wxFlexGridSizer* m_grid_sizer;
|
wxFlexGridSizer* m_grid_sizer;
|
||||||
std::pair<coordf_t, coordf_t> m_last_edited_range;
|
t_layer_height_range m_last_edited_range;
|
||||||
|
|
||||||
enum SelectedItemType
|
enum SelectedItemType
|
||||||
{
|
{
|
||||||
|
@ -49,7 +53,7 @@ public:
|
||||||
ObjectLayers(wxWindow* parent);
|
ObjectLayers(wxWindow* parent);
|
||||||
~ObjectLayers() {}
|
~ObjectLayers() {}
|
||||||
|
|
||||||
wxSizer* create_layer_without_buttons(const std::map<std::pair<coordf_t, coordf_t>, DynamicPrintConfig>::value_type& layer);
|
wxSizer* create_layer_without_buttons(const t_layer_config_ranges::value_type& layer);
|
||||||
void create_layer(int id);
|
void create_layer(int id);
|
||||||
void create_layers_list();
|
void create_layers_list();
|
||||||
void update_layers_list();
|
void update_layers_list();
|
||||||
|
|
|
@ -33,6 +33,9 @@ typedef std::map< std::string, std::vector< std::pair<std::string, std::string>
|
||||||
|
|
||||||
typedef std::vector<ModelVolume*> ModelVolumePtrs;
|
typedef std::vector<ModelVolume*> ModelVolumePtrs;
|
||||||
|
|
||||||
|
typedef double coordf_t;
|
||||||
|
typedef std::pair<coordf_t, coordf_t> t_layer_height_range;
|
||||||
|
|
||||||
namespace GUI {
|
namespace GUI {
|
||||||
|
|
||||||
wxDECLARE_EVENT(EVT_OBJ_LIST_OBJECT_SELECT, SimpleEvent);
|
wxDECLARE_EVENT(EVT_OBJ_LIST_OBJECT_SELECT, SimpleEvent);
|
||||||
|
@ -271,14 +274,14 @@ public:
|
||||||
|
|
||||||
// Remove objects/sub-object from the list
|
// Remove objects/sub-object from the list
|
||||||
void remove();
|
void remove();
|
||||||
void del_layer_range(const std::pair<coordf_t, coordf_t>& range);
|
void del_layer_range(const t_layer_height_range& range);
|
||||||
void add_layer_range(const std::pair<coordf_t, coordf_t>& range);
|
void add_layer_range(const t_layer_height_range& range);
|
||||||
void add_layer_item (const std::pair<coordf_t, coordf_t>& range,
|
void add_layer_item (const t_layer_height_range& range,
|
||||||
const wxDataViewItem layers_item,
|
const wxDataViewItem layers_item,
|
||||||
const int layer_idx = -1);
|
const int layer_idx = -1);
|
||||||
void edit_layer_range(const std::pair<coordf_t, coordf_t>& range, coordf_t layer_height);
|
void edit_layer_range(const t_layer_height_range& range, coordf_t layer_height);
|
||||||
void edit_layer_range(const std::pair<coordf_t, coordf_t>& range,
|
void edit_layer_range(const t_layer_height_range& range,
|
||||||
const std::pair<coordf_t, coordf_t>& new_range);
|
const t_layer_height_range& new_range);
|
||||||
|
|
||||||
void init_objects();
|
void init_objects();
|
||||||
bool multiple_selection() const ;
|
bool multiple_selection() const ;
|
||||||
|
|
|
@ -1126,7 +1126,8 @@ void Selection::copy_to_clipboard()
|
||||||
dst_object->config = src_object->config;
|
dst_object->config = src_object->config;
|
||||||
dst_object->sla_support_points = src_object->sla_support_points;
|
dst_object->sla_support_points = src_object->sla_support_points;
|
||||||
dst_object->sla_points_status = src_object->sla_points_status;
|
dst_object->sla_points_status = src_object->sla_points_status;
|
||||||
dst_object->layer_height_ranges = src_object->layer_height_ranges;
|
// dst_object->layer_height_ranges = src_object->layer_height_ranges;
|
||||||
|
dst_object->layer_config_ranges = src_object->layer_config_ranges; // #ys_FIXME_experiment
|
||||||
dst_object->layer_height_profile = src_object->layer_height_profile;
|
dst_object->layer_height_profile = src_object->layer_height_profile;
|
||||||
dst_object->origin_translation = src_object->origin_translation;
|
dst_object->origin_translation = src_object->origin_translation;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue