Change 4-digit after dot for fields to 8, useful for z-step

also a little refresh fix for z-step
This commit is contained in:
supermerill 2020-07-30 21:34:13 +02:00
parent 9aaf4e905c
commit 2c33dc9cc8
4 changed files with 12 additions and 11 deletions

View File

@ -649,7 +649,8 @@ bool PrintObject::invalidate_state_by_config_options(const std::vector<t_config_
|| opt_key == "support_material_contact_distance_bottom"
|| opt_key == "xy_size_compensation"
|| opt_key == "hole_size_compensation"
|| opt_key == "hole_to_polyhole") {
|| opt_key == "hole_to_polyhole"
|| opt_key == "z_step") {
steps.emplace_back(posSlice);
} else if (opt_key == "support_material") {
steps.emplace_back(posSupportMaterial);

View File

@ -23,16 +23,16 @@ namespace Slic3r
static const coordf_t MIN_LAYER_HEIGHT = 0.01;
static const coordf_t MIN_LAYER_HEIGHT_DEFAULT = 0.07;
inline coordf_t check_z_step(coordf_t val, coordf_t z_step) {
uint64_t valint = uint64_t(val * 100000. + 0.1);
uint64_t stepint = uint64_t(z_step * 100000. + 0.1);
return (((valint + (stepint/2)) / stepint) * stepint) / 100000.;
// fields are with 8-number precision after the dot
inline coordf_t check_z_step(const coordf_t val, const coordf_t z_step) {
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;
}
inline bool test_z_step(coordf_t val, coordf_t z_step) {
uint64_t valint = uint64_t(val * 100000. + 0.1);
uint64_t stepint = uint64_t(z_step * 100000. + 0.1);
inline bool test_z_step(const coordf_t val, const coordf_t z_step) {
uint64_t valint = uint64_t(val * 100000000. + 0.1);
uint64_t stepint = uint64_t(z_step * 100000000. + 0.1);
return valint % stepint == 0;
}

View File

@ -20,7 +20,7 @@ class PrintConfig;
class PrintObjectConfig;
class ModelObject;
coordf_t check_z_step(coordf_t val, coordf_t z_step);
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

View File

@ -36,7 +36,7 @@ using t_kill_focus = std::function<void(const std::string&)>;
using t_change = std::function<void(const t_config_option_key&, const boost::any&)>;
using t_back_to_init = std::function<void(const std::string&)>;
wxString double_to_string(double const value, const int max_precision = 4);
wxString double_to_string(double const value, const int max_precision = 8);
class RevertButton : public ScalableButton
{