mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-19 06:41:14 -06:00
PA Calib dialog (#232)
* fix colors Signed-off-by: SoftFever <softfeverever@gmail.com> * calib dlg WIP 1/2 Signed-off-by: SoftFever <softfeverever@gmail.com> * cut tower based on range Signed-off-by: SoftFever <softfeverever@gmail.com> * mac menu change Signed-off-by: SoftFever <softfeverever@gmail.com> * minor fix Signed-off-by: SoftFever <103989404+SoftFever@users.noreply.github.com> Signed-off-by: SoftFever <softfeverever@gmail.com> Signed-off-by: SoftFever <103989404+SoftFever@users.noreply.github.com>
This commit is contained in:
parent
2cdece2b14
commit
0c2309e3a2
15 changed files with 332 additions and 76 deletions
|
@ -1650,7 +1650,7 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
|
|||
if (this->m_objsWithBrim.empty() && this->m_objSupportsWithBrim.empty()) m_brim_done = true;
|
||||
|
||||
// SoftFever: calib
|
||||
if (print.calib_mode() == Calib_PA_DDE || print.calib_mode() == Calib_PA_Bowden) {
|
||||
if (print.calib_params().mode == CalibMode::Calib_PA_Line) {
|
||||
std::string gcode;
|
||||
gcode += m_writer.set_acceleration((unsigned int)floor(m_config.outer_wall_acceleration.value + 0.5));
|
||||
|
||||
|
@ -1665,11 +1665,9 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
|
|||
auto fast_speed = std::min(print.default_region_config().outer_wall_speed.value, filament_max_volumetric_speed / pattern_line.mm3_per_mm());
|
||||
auto slow_speed = std::max(20.0, fast_speed / 10.0);
|
||||
pa_test.set_speed(fast_speed, slow_speed);
|
||||
|
||||
if(print.calib_mode() == Calib_PA_DDE)
|
||||
gcode += pa_test.generate_test();
|
||||
else
|
||||
gcode +=pa_test.generate_test(0.0,0.02);
|
||||
pa_test.draw_numbers() = print.calib_params().print_numbers;
|
||||
auto params = print.calib_params();
|
||||
gcode += pa_test.generate_test(params.pa_start, params.pa_step, std::llround(std::ceil((params.pa_end - params.pa_start) / params.pa_step)));
|
||||
|
||||
file.write(gcode);
|
||||
}
|
||||
|
@ -2606,12 +2604,10 @@ GCode::LayerResult GCode::process_layer(
|
|||
config.set_key_value("max_layer_z", new ConfigOptionFloat(m_max_layer_z));
|
||||
}
|
||||
|
||||
if (print.calib_mode() == Calib_PA_Tower_DDE) {
|
||||
gcode += writer().set_pressure_advance(static_cast<int>(print_z) * 0.002);
|
||||
}
|
||||
else if(print.calib_mode() == Calib_PA_Tower_Bowden) {
|
||||
gcode += writer().set_pressure_advance(static_cast<int>(print_z) * 0.02);
|
||||
if (print.calib_mode() == CalibMode::Calib_PA_Tower) {
|
||||
gcode += writer().set_pressure_advance(print.calib_params().pa_start + static_cast<int>(print_z) * print.calib_params().pa_step);
|
||||
}
|
||||
|
||||
//BBS
|
||||
if (first_layer) {
|
||||
//BBS: set first layer global acceleration
|
||||
|
|
|
@ -260,6 +260,11 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n
|
|||
return invalidated;
|
||||
}
|
||||
|
||||
void Print::set_calib_params(const Calib_Params& params) {
|
||||
m_calib_params = params;
|
||||
m_calib_params.mode = params.mode;
|
||||
}
|
||||
|
||||
bool Print::invalidate_step(PrintStep step)
|
||||
{
|
||||
bool invalidated = Inherited::invalidate_step(step);
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include "GCode/ThumbnailData.hpp"
|
||||
#include "GCode/GCodeProcessor.hpp"
|
||||
#include "MultiMaterialSegmentation.hpp"
|
||||
|
||||
#include "libslic3r.h"
|
||||
|
||||
#include <Eigen/Geometry>
|
||||
|
@ -22,6 +21,8 @@
|
|||
#include <functional>
|
||||
#include <set>
|
||||
|
||||
#include "calib.hpp"
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
class GCode;
|
||||
|
@ -88,14 +89,6 @@ enum PrintObjectStep {
|
|||
posInfill, posIroning, posSupportMaterial, posSimplifyPath, posSimplifySupportPath, posCount,
|
||||
};
|
||||
|
||||
enum CalibMode {
|
||||
Calib_None = 0,
|
||||
Calib_PA_DDE,
|
||||
Calib_PA_Bowden,
|
||||
Calib_PA_Tower_DDE,
|
||||
Calib_PA_Tower_Bowden
|
||||
};
|
||||
|
||||
// A PrintRegion object represents a group of volumes to print
|
||||
// sharing the same config (including the same assigned extruder(s))
|
||||
class PrintRegion
|
||||
|
@ -744,8 +737,10 @@ public:
|
|||
//SoftFever
|
||||
bool &is_BBL_printer() { return m_isBBLPrinter; }
|
||||
const bool is_BBL_printer() const { return m_isBBLPrinter; }
|
||||
CalibMode& calib_mode() { return m_calib_mode; }
|
||||
const CalibMode calib_mode() const { return m_calib_mode; }
|
||||
CalibMode& calib_mode() { return m_calib_params.mode; }
|
||||
const CalibMode calib_mode() const { return m_calib_params.mode; }
|
||||
void set_calib_params(const Calib_Params& params);
|
||||
const Calib_Params& calib_params() const { return m_calib_params; }
|
||||
protected:
|
||||
// Invalidates the step, and its depending steps in Print.
|
||||
bool invalidate_step(PrintStep step);
|
||||
|
@ -798,8 +793,8 @@ private:
|
|||
//BBS: modified_count
|
||||
int m_modified_count {0};
|
||||
|
||||
//SoftFever: calibration mode, change to enum later
|
||||
CalibMode m_calib_mode;
|
||||
//SoftFever: calibration
|
||||
Calib_Params m_calib_params;
|
||||
|
||||
// To allow GCode to set the Print's GCodeExport step status.
|
||||
friend class GCode;
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
|
||||
namespace Slic3r {
|
||||
|
||||
calib_pressure_advance::calib_pressure_advance(GCode* gcodegen) :mp_gcodegen(gcodegen), m_length_short(20.0), m_length_long(40.0), m_space_y(3.5), m_line_width(0.6) {}
|
||||
calib_pressure_advance::calib_pressure_advance(GCode* gcodegen) :mp_gcodegen(gcodegen), m_length_short(20.0), m_length_long(40.0), m_space_y(3.5), m_line_width(0.6), m_draw_numbers(true) {}
|
||||
|
||||
std::string calib_pressure_advance::generate_test(double start_pa/*= 0*/, double step_pa /*= 0.005*/, int count/*= 10*/) {
|
||||
std::string calib_pressure_advance::generate_test(double start_pa/*= 0*/, double step_pa /*= 0.002*/, int count/*= 10*/) {
|
||||
auto bed_sizes = mp_gcodegen->config().printable_area.values;
|
||||
auto w = bed_sizes[2].x() - bed_sizes[0].x();
|
||||
auto h = bed_sizes[2].y() - bed_sizes[0].y();
|
||||
|
@ -71,10 +71,10 @@ namespace Slic3r {
|
|||
gcode << move_to(Vec2d(start_x + m_length_short + m_length_long, y_pos + (num - 1) * m_space_y + 7));
|
||||
gcode << writer.extrude_to_xy(Vec2d(start_x + m_length_short + m_length_long, y_pos + (num - 1) * m_space_y + 2), e * 7);
|
||||
|
||||
|
||||
for (int i = 0; i < num; i += 2) {
|
||||
gcode << draw_number(start_x + m_length_short + m_length_long + m_length_short + 3, y_pos + i * m_space_y + m_space_y / 2, start_pa + i * step_pa);
|
||||
|
||||
if (m_draw_numbers) {
|
||||
for (int i = 0; i < num; i += 2) {
|
||||
gcode << draw_number(start_x + m_length_short + m_length_long + m_length_short + 3, y_pos + i * m_space_y + m_space_y / 2, start_pa + i * step_pa);
|
||||
}
|
||||
}
|
||||
return gcode.str();
|
||||
}
|
||||
|
@ -203,4 +203,21 @@ namespace Slic3r {
|
|||
|
||||
return gcode.str();
|
||||
}
|
||||
Calib_Params::Calib_Params() :pa_start(0.0), pa_end(0.1), pa_step(0.002), print_numbers(true), mode(CalibMode::Calib_None) {}
|
||||
Calib_Params::Calib_Params(const Calib_Params& p) {
|
||||
pa_start = p.pa_start;
|
||||
pa_end = p.pa_end;
|
||||
pa_step = p.pa_step;
|
||||
print_numbers = p.print_numbers;
|
||||
mode = p.mode;
|
||||
}
|
||||
Calib_Params& Calib_Params::operator =(const Calib_Params& p)
|
||||
{
|
||||
pa_start = p.pa_start;
|
||||
pa_end = p.pa_end;
|
||||
pa_step = p.pa_step;
|
||||
print_numbers = p.print_numbers;
|
||||
mode = p.mode;
|
||||
return *this;
|
||||
}
|
||||
} // namespace Slic3r
|
|
@ -1,10 +1,27 @@
|
|||
#pragma once
|
||||
#define calib_pressure_advance_dd
|
||||
|
||||
#include <string>
|
||||
#include "Point.hpp"
|
||||
namespace Slic3r {
|
||||
|
||||
class GCode;
|
||||
|
||||
enum class CalibMode : int {
|
||||
Calib_None = 0,
|
||||
Calib_PA_Line,
|
||||
Calib_PA_Tower,
|
||||
};
|
||||
struct Calib_Params
|
||||
{
|
||||
Calib_Params();
|
||||
Calib_Params(const Calib_Params& p);
|
||||
Calib_Params& operator =(const Calib_Params& p);
|
||||
double pa_start, pa_end, pa_step;
|
||||
bool print_numbers;
|
||||
CalibMode mode;
|
||||
};
|
||||
|
||||
class calib_pressure_advance
|
||||
{
|
||||
public:
|
||||
|
@ -17,6 +34,7 @@ public:
|
|||
m_fast_speed = fast;
|
||||
}
|
||||
double& line_width() { return m_line_width; };
|
||||
bool& draw_numbers() { return m_draw_numbers; }
|
||||
|
||||
private:
|
||||
std::string move_to(Vec2d pt);
|
||||
|
@ -29,5 +47,6 @@ private:
|
|||
double m_space_y;
|
||||
double m_slow_speed, m_fast_speed;
|
||||
double m_line_width;
|
||||
bool m_draw_numbers;
|
||||
};
|
||||
} // namespace Slic3r
|
Loading…
Add table
Add a link
Reference in a new issue