mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-14 02:55:55 +08:00
fix adjust_layer_height_profile for high z_step GLCanvas3D.cpp
from a work by @Pavulon87
This commit is contained in:
parent
9e05483431
commit
0e4d49452f
@ -24,7 +24,7 @@ namespace Slic3r
|
||||
static const coordf_t MIN_LAYER_HEIGHT = 0.01;
|
||||
static const coordf_t MIN_LAYER_HEIGHT_DEFAULT = 0.07;
|
||||
// fields are with 8-number precision after the dot
|
||||
inline coordf_t check_z_step(const coordf_t val, const coordf_t z_step) {
|
||||
coordf_t check_z_step(const coordf_t val, const coordf_t z_step) {
|
||||
if (z_step <= EPSILON) return val;
|
||||
uint64_t valint = uint64_t(val * 100000000. + 0.1);
|
||||
uint64_t stepint = uint64_t(z_step * 100000000. + 0.1);
|
||||
|
@ -20,7 +20,8 @@ class PrintConfig;
|
||||
class PrintObjectConfig;
|
||||
class ModelObject;
|
||||
|
||||
coordf_t check_z_step(const coordf_t val,const coordf_t z_step);
|
||||
// little function that return val as a multiple of z_step if z_step is not == 0
|
||||
extern coordf_t check_z_step(const coordf_t val,const coordf_t z_step);
|
||||
|
||||
// Parameters to guide object slicing and support generation.
|
||||
// The slicing parameters account for a raft and whether the 1st object layer is printed with a normal or a bridging flow
|
||||
|
@ -141,7 +141,6 @@ GLCanvas3D::LayersEditing::LayersEditing()
|
||||
, m_adaptive_quality(0.5f)
|
||||
, state(Unknown)
|
||||
, band_width(2.0f)
|
||||
, strength(0.005f)
|
||||
, last_object_id(-1)
|
||||
, last_z(0.0f)
|
||||
, last_action(LAYER_HEIGHT_EDIT_ACTION_INCREASE)
|
||||
@ -534,7 +533,10 @@ void GLCanvas3D::LayersEditing::adjust_layer_height_profile()
|
||||
{
|
||||
this->update_slicing_parameters();
|
||||
PrintObject::update_layer_height_profile(*m_model_object, *m_slicing_parameters, m_layer_height_profile);
|
||||
Slic3r::adjust_layer_height_profile(*m_slicing_parameters, m_layer_height_profile, this->last_z, this->strength, this->band_width, this->last_action);
|
||||
//update strength
|
||||
float strength = 0.005f;
|
||||
if (m_slicing_parameters->z_step > EPSILON) strength = (float)Slic3r::check_z_step(std::max(0.005, m_slicing_parameters->z_step), m_slicing_parameters->z_step);
|
||||
Slic3r::adjust_layer_height_profile(*m_slicing_parameters, m_layer_height_profile, this->last_z, strength, this->band_width, this->last_action);
|
||||
m_layer_height_profile_modified = true;
|
||||
m_layers_texture.valid = false;
|
||||
}
|
||||
|
@ -204,7 +204,7 @@ private:
|
||||
public:
|
||||
EState state;
|
||||
float band_width;
|
||||
float strength;
|
||||
//float strength;
|
||||
int last_object_id;
|
||||
float last_z;
|
||||
LayerHeightEditActionType last_action;
|
||||
|
@ -45,16 +45,6 @@ namespace GUI {
|
||||
wxDEFINE_EVENT(EVT_TAB_VALUE_CHANGED, wxCommandEvent);
|
||||
wxDEFINE_EVENT(EVT_TAB_PRESETS_CHANGED, SimpleEvent);
|
||||
|
||||
//same as the slicing.cpp method, but it's easier to redefine it here
|
||||
// maybe i should have written it in the header.
|
||||
inline coordf_t check_z_step_temp(coordf_t val, coordf_t z_step) {
|
||||
if (z_step <= EPSILON) return val;
|
||||
uint64_t valint = uint64_t(val * 100000000. + 0.1);
|
||||
uint64_t stepint = uint64_t(z_step * 100000000. + 0.1);
|
||||
return (((valint + (stepint / 2)) / stepint) * stepint) / 100000000.;
|
||||
//return int((val + z_step * 0.5) / z_step) * z_step;
|
||||
}
|
||||
|
||||
Tab::Tab(wxNotebook* parent, const wxString& title, Preset::Type type) :
|
||||
m_parent(parent), m_title(title), m_type(type)
|
||||
{
|
||||
@ -2600,7 +2590,7 @@ void TabPrinter::update_fff()
|
||||
if (min_layer_height[i] / z_step != 0) {
|
||||
if(!has_changed )
|
||||
new_conf = *m_config;
|
||||
new_conf.option<ConfigOptionFloats>("min_layer_height")->values[i] = std::max(z_step, check_z_step_temp(new_conf.option<ConfigOptionFloats>("min_layer_height")->values[i], z_step));
|
||||
new_conf.option<ConfigOptionFloats>("min_layer_height")->values[i] = std::max(z_step, Slic3r::check_z_step(new_conf.option<ConfigOptionFloats>("min_layer_height")->values[i], z_step));
|
||||
has_changed = true;
|
||||
}
|
||||
const std::vector<double>& max_layer_height = m_config->option<ConfigOptionFloats>("max_layer_height")->values;
|
||||
@ -2608,7 +2598,7 @@ void TabPrinter::update_fff()
|
||||
if (max_layer_height[i] / z_step != 0) {
|
||||
if (!has_changed)
|
||||
new_conf = *m_config;
|
||||
new_conf.option<ConfigOptionFloats>("max_layer_height")->values[i] = std::max(z_step, check_z_step_temp(new_conf.option<ConfigOptionFloats>("max_layer_height")->values[i], z_step));
|
||||
new_conf.option<ConfigOptionFloats>("max_layer_height")->values[i] = std::max(z_step, Slic3r::check_z_step(new_conf.option<ConfigOptionFloats>("max_layer_height")->values[i], z_step));
|
||||
has_changed = true;
|
||||
}
|
||||
if (has_changed) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user