mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-14 06:05:53 +08:00
#239 0 to disable z_step
Also increase precision from 3 to 6 for z if using z_step, because it may matters now. also change default for min_width_top_surface
This commit is contained in:
parent
65f97a9092
commit
46f63cb7aa
@ -353,12 +353,15 @@ std::string GCodeWriter::travel_to_xyz(const Vec3d &point, const std::string &co
|
||||
the lift. */
|
||||
m_lifted = 0;
|
||||
m_pos = point;
|
||||
|
||||
std::ostringstream gcode;
|
||||
gcode << "G1 X" << XYZF_NUM(point.x())
|
||||
<< " Y" << XYZF_NUM(point.y())
|
||||
<< " Z" << XYZF_NUM(point.z())
|
||||
<< " F" << XYZF_NUM(this->config.travel_speed.value * 60.0);
|
||||
<< " Y" << XYZF_NUM(point.y());
|
||||
if (config.z_step > SCALING_FACTOR)
|
||||
gcode << " Z" << PRECISION(point.z(), 6);
|
||||
else
|
||||
gcode << " Z" << XYZF_NUM(point.z());
|
||||
gcode << " F" << XYZF_NUM(this->config.travel_speed.value * 60.0);
|
||||
|
||||
COMMENT(comment);
|
||||
gcode << "\n";
|
||||
return gcode.str();
|
||||
@ -388,8 +391,11 @@ std::string GCodeWriter::_travel_to_z(double z, const std::string &comment)
|
||||
m_pos.z() = z;
|
||||
|
||||
std::ostringstream gcode;
|
||||
gcode << "G1 Z" << XYZF_NUM(z)
|
||||
<< " F" << XYZF_NUM(this->config.travel_speed.value * 60.0);
|
||||
if (config.z_step > SCALING_FACTOR)
|
||||
gcode << "G1 Z" << PRECISION(z, 6);
|
||||
else
|
||||
gcode << "G1 Z" << XYZF_NUM(z);
|
||||
gcode << " F" << XYZF_NUM(this->config.travel_speed.value * 60.0);
|
||||
COMMENT(comment);
|
||||
gcode << "\n";
|
||||
return gcode.str();
|
||||
|
@ -2061,7 +2061,7 @@ void PrintConfigDef::init_fff_params()
|
||||
def->ratio_over = "perimeter_extrusion_width";
|
||||
def->min = 0;
|
||||
def->mode = comExpert;
|
||||
def->set_default_value(new ConfigOptionFloatOrPercent(100, true));
|
||||
def->set_default_value(new ConfigOptionFloatOrPercent(200, true));
|
||||
|
||||
def = this->add("min_print_speed", coFloats);
|
||||
def->label = L("Min print speed");
|
||||
@ -3530,7 +3530,9 @@ void PrintConfigDef::init_fff_params()
|
||||
def = this->add("z_step", coFloat);
|
||||
def->label = L("Z full step");
|
||||
def->tooltip = L("Set this to the height moved when your Z motor (or equivalent) turns one step."
|
||||
"If your motor needs 200 steps to move your head/plater by 1mm, this field have to be 1/200 = 0.005");
|
||||
"If your motor needs 200 steps to move your head/plater by 1mm, this field have to be 1/200 = 0.005."
|
||||
"\nNote that the gcode will write the z values with 6 digits after the dot if z_step is set (it's 3 digits if it's disabled)."
|
||||
"\nPut 0 to disable.");
|
||||
def->cli = "z-step=f";
|
||||
def->sidetext = L("mm");
|
||||
def->min = 0.0001;
|
||||
|
@ -25,12 +25,14 @@ 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) {
|
||||
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;
|
||||
}
|
||||
inline bool test_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);
|
||||
return valint % stepint == 0;
|
||||
|
@ -45,10 +45,13 @@ 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) {
|
||||
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.;
|
||||
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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user