mirror of
https://git.mirrors.martin98.com/https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-09 00:11:49 +08:00
draft version
This commit is contained in:
parent
1df89650e9
commit
a3bae2f9a5
@ -1633,7 +1633,7 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
|
|||||||
this->m_objSupportsWithBrim.insert(iter->first);
|
this->m_objSupportsWithBrim.insert(iter->first);
|
||||||
}
|
}
|
||||||
if (this->m_objsWithBrim.empty() && this->m_objSupportsWithBrim.empty()) m_brim_done = true;
|
if (this->m_objsWithBrim.empty() && this->m_objSupportsWithBrim.empty()) m_brim_done = true;
|
||||||
if (print.is_calib_mode()) {
|
if (print.is_calib_mode() == Calib_PA_DDE || print.is_calib_mode() == Calib_PA_Bowden) {
|
||||||
std::string gcode;
|
std::string gcode;
|
||||||
auto s = m_config.inner_wall_speed.value;
|
auto s = m_config.inner_wall_speed.value;
|
||||||
gcode += m_writer.set_acceleration((unsigned int)floor(m_config.outer_wall_acceleration.value + 0.5));
|
gcode += m_writer.set_acceleration((unsigned int)floor(m_config.outer_wall_acceleration.value + 0.5));
|
||||||
@ -1645,9 +1645,13 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
|
|||||||
m_config.outer_wall_speed = print.default_region_config().outer_wall_speed;
|
m_config.outer_wall_speed = print.default_region_config().outer_wall_speed;
|
||||||
m_config.inner_wall_speed = print.default_region_config().inner_wall_speed;
|
m_config.inner_wall_speed = print.default_region_config().inner_wall_speed;
|
||||||
calib_pressure_advance pa_test(this);
|
calib_pressure_advance pa_test(this);
|
||||||
|
if(print.is_calib_mode() == Calib_PA_DDE)
|
||||||
gcode = pa_test.generate_test();
|
gcode = pa_test.generate_test();
|
||||||
|
else
|
||||||
|
gcode = pa_test.generate_test(0.0,0.02);
|
||||||
|
|
||||||
file.write(gcode);
|
file.write(gcode);
|
||||||
print.is_calib_mode() = false;
|
print.is_calib_mode() = Calib_None;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//BBS: open spaghetti detector
|
//BBS: open spaghetti detector
|
||||||
|
@ -88,6 +88,12 @@ enum PrintObjectStep {
|
|||||||
posInfill, posIroning, posSupportMaterial, posSimplifyPath, posSimplifySupportPath, posCount,
|
posInfill, posIroning, posSupportMaterial, posSimplifyPath, posSimplifySupportPath, posCount,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum CalibMode {
|
||||||
|
Calib_None = 0,
|
||||||
|
Calib_PA_DDE,
|
||||||
|
Calib_PA_Bowden
|
||||||
|
};
|
||||||
|
|
||||||
// A PrintRegion object represents a group of volumes to print
|
// A PrintRegion object represents a group of volumes to print
|
||||||
// sharing the same config (including the same assigned extruder(s))
|
// sharing the same config (including the same assigned extruder(s))
|
||||||
class PrintRegion
|
class PrintRegion
|
||||||
@ -735,8 +741,8 @@ public:
|
|||||||
//SoftFever
|
//SoftFever
|
||||||
bool &is_BBL_printer() { return m_isBBLPrinter; }
|
bool &is_BBL_printer() { return m_isBBLPrinter; }
|
||||||
const bool is_BBL_printer() const { return m_isBBLPrinter; }
|
const bool is_BBL_printer() const { return m_isBBLPrinter; }
|
||||||
bool &is_calib_mode() { return m_calib_mode; }
|
CalibMode& is_calib_mode() { return m_calib_mode; }
|
||||||
const bool is_calib_mode() const { return m_calib_mode; }
|
const CalibMode is_calib_mode() const { return m_calib_mode; }
|
||||||
protected:
|
protected:
|
||||||
// Invalidates the step, and its depending steps in Print.
|
// Invalidates the step, and its depending steps in Print.
|
||||||
bool invalidate_step(PrintStep step);
|
bool invalidate_step(PrintStep step);
|
||||||
@ -790,7 +796,7 @@ private:
|
|||||||
int m_modified_count {0};
|
int m_modified_count {0};
|
||||||
|
|
||||||
//SoftFever: calibration mode, change to enum later
|
//SoftFever: calibration mode, change to enum later
|
||||||
bool m_calib_mode;
|
CalibMode m_calib_mode;
|
||||||
|
|
||||||
// To allow GCode to set the Print's GCodeExport step status.
|
// To allow GCode to set the Print's GCodeExport step status.
|
||||||
friend class GCode;
|
friend class GCode;
|
||||||
|
@ -7,14 +7,16 @@
|
|||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
|
|
||||||
calib_pressure_advance::calib_pressure_advance(GCode* gcodegen) :mp_gcodegen(gcodegen), m_length_short(20.0), m_length_long(40.0) {}
|
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){}
|
||||||
|
|
||||||
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.005*/, int count/*= 10*/) {
|
||||||
auto bed_sizes = mp_gcodegen->config().printable_area.values;
|
auto bed_sizes = mp_gcodegen->config().printable_area.values;
|
||||||
auto w = bed_sizes[2].x() - bed_sizes[0].x();
|
auto w = bed_sizes[2].x() - bed_sizes[0].x();
|
||||||
auto h = bed_sizes[2].y() - bed_sizes[0].y();
|
auto h = bed_sizes[2].y() - bed_sizes[0].y();
|
||||||
|
count = std::min(count,int((h - 10) / m_space_y));
|
||||||
|
|
||||||
auto startx = (w - 100) / 2;
|
auto startx = (w - 100) / 2;
|
||||||
auto starty = (h - count * 5) / 2;
|
auto starty = (h - count * m_space_y) / 2;
|
||||||
return print_pa_lines(startx, starty, start_pa, step_pa, count);
|
return print_pa_lines(startx, starty, start_pa, step_pa, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -30,7 +32,6 @@ namespace Slic3r {
|
|||||||
|
|
||||||
auto& writer = mp_gcodegen->writer();
|
auto& writer = mp_gcodegen->writer();
|
||||||
const double e = 0.04; // filament_mm/extrusion_mm
|
const double e = 0.04; // filament_mm/extrusion_mm
|
||||||
const double y_offset = 5;
|
|
||||||
|
|
||||||
const double fast = mp_gcodegen->config().get_abs_value("outer_wall_speed") * 60.0;
|
const double fast = mp_gcodegen->config().get_abs_value("outer_wall_speed") * 60.0;
|
||||||
const double slow = std::max(1200.0, fast * 0.1);
|
const double slow = std::max(1200.0, fast * 0.1);
|
||||||
@ -41,27 +42,27 @@ namespace Slic3r {
|
|||||||
for (int i = 0; i < num; ++i) {
|
for (int i = 0; i < num; ++i) {
|
||||||
|
|
||||||
gcode << writer.set_pressure_advance(start_pa + i * step_pa);
|
gcode << writer.set_pressure_advance(start_pa + i * step_pa);
|
||||||
gcode << move_to(Vec2d(start_x, y_pos + i * y_offset));
|
gcode << move_to(Vec2d(start_x, y_pos + i * m_space_y));
|
||||||
gcode << writer.set_speed(slow);
|
gcode << writer.set_speed(slow);
|
||||||
gcode << writer.extrude_to_xy(Vec2d(start_x + m_length_short, y_pos + i * y_offset), e * m_length_short);
|
gcode << writer.extrude_to_xy(Vec2d(start_x + m_length_short, y_pos + i * m_space_y), e * m_length_short);
|
||||||
gcode << writer.set_speed(fast);
|
gcode << writer.set_speed(fast);
|
||||||
gcode << writer.extrude_to_xy(Vec2d(start_x + m_length_short + m_length_long, y_pos + i * y_offset), e * m_length_long);
|
gcode << writer.extrude_to_xy(Vec2d(start_x + m_length_short + m_length_long, y_pos + i * m_space_y), e * m_length_long);
|
||||||
gcode << writer.set_speed(slow);
|
gcode << writer.set_speed(slow);
|
||||||
gcode << writer.extrude_to_xy(Vec2d(start_x + m_length_short + m_length_long + m_length_short, y_pos + i * y_offset), e * m_length_short);
|
gcode << writer.extrude_to_xy(Vec2d(start_x + m_length_short + m_length_long + m_length_short, y_pos + i * m_space_y), e * m_length_short);
|
||||||
|
|
||||||
}
|
}
|
||||||
gcode << writer.set_pressure_advance(0.0);
|
gcode << writer.set_pressure_advance(0.0);
|
||||||
|
|
||||||
// draw indicator lines
|
// draw indicator lines
|
||||||
gcode << writer.set_speed(fast);
|
gcode << writer.set_speed(fast);
|
||||||
gcode << move_to(Vec2d(start_x + m_length_short, y_pos + (num - 1) * y_offset + 2));
|
gcode << move_to(Vec2d(start_x + m_length_short, y_pos + (num - 1) * m_space_y + 2));
|
||||||
gcode << writer.extrude_to_xy(Vec2d(start_x + m_length_short, y_pos + (num - 1) * y_offset + 7), e * 7);
|
gcode << writer.extrude_to_xy(Vec2d(start_x + m_length_short, y_pos + (num - 1) * m_space_y + 7), e * 7);
|
||||||
gcode << move_to(Vec2d(start_x + m_length_short + m_length_long, y_pos + (num - 1) * y_offset + 7));
|
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) * y_offset + 2), e * 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) {
|
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 * y_offset + y_offset / 2, start_pa + i * step_pa);
|
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();
|
return gcode.str();
|
||||||
|
@ -11,7 +11,7 @@ public:
|
|||||||
calib_pressure_advance(GCode* gcodegen);
|
calib_pressure_advance(GCode* gcodegen);
|
||||||
~calib_pressure_advance() {}
|
~calib_pressure_advance() {}
|
||||||
|
|
||||||
std::string generate_test(double start_pa = 0, double step_pa = 0.005, int count = 20);
|
std::string generate_test(double start_pa = 0, double step_pa = 0.002, int count = 50);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string move_to(Vec2d pt);
|
std::string move_to(Vec2d pt);
|
||||||
@ -21,5 +21,6 @@ private:
|
|||||||
private:
|
private:
|
||||||
GCode* mp_gcodegen;
|
GCode* mp_gcodegen;
|
||||||
double m_length_short, m_length_long;
|
double m_length_short, m_length_long;
|
||||||
|
double m_space_y;
|
||||||
};
|
};
|
||||||
} // namespace Slic3r
|
} // namespace Slic3r
|
@ -2459,8 +2459,13 @@ void MainFrame::init_menubar_as_editor()
|
|||||||
//m_topbar->AddDropDownMenuItem(language_item);
|
//m_topbar->AddDropDownMenuItem(language_item);
|
||||||
//m_topbar->AddDropDownMenuItem(config_item);
|
//m_topbar->AddDropDownMenuItem(config_item);
|
||||||
m_topbar->AddDropDownSubMenu(helpMenu, _L("Help"));
|
m_topbar->AddDropDownSubMenu(helpMenu, _L("Help"));
|
||||||
append_menu_item(m_topbar->GetCalibMenu(), wxID_ANY, _L("Pressure advance"), _L("Calibrate PA"),
|
|
||||||
[this](wxCommandEvent&) { if (m_plater) m_plater->calib_pa(); }, "", nullptr,
|
// SoftFever calibrations
|
||||||
|
append_menu_item(m_topbar->GetCalibMenu(), wxID_ANY, _L("PA - DDE"), _L("Calibrate PA - DDE"),
|
||||||
|
[this](wxCommandEvent&) { if (m_plater) m_plater->calib_pa(false); }, "", nullptr,
|
||||||
|
[this]() {return m_plater->is_view3D_shown();; }, this);
|
||||||
|
append_menu_item(m_topbar->GetCalibMenu(), wxID_ANY, _L("PA - Bowden"), _L("Calibrate PA - Bowden"),
|
||||||
|
[this](wxCommandEvent&) { if (m_plater) m_plater->calib_pa(true); }, "", nullptr,
|
||||||
[this]() {return m_plater->is_view3D_shown();; }, this);
|
[this]() {return m_plater->is_view3D_shown();; }, this);
|
||||||
#else
|
#else
|
||||||
m_menubar->Append(fileMenu, wxString::Format("&%s", _L("File")));
|
m_menubar->Append(fileMenu, wxString::Format("&%s", _L("File")));
|
||||||
|
@ -7865,24 +7865,20 @@ void Plater::add_model(bool imperial_units/* = false*/, std::string fname/* = "
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Plater::calib_pa() {
|
void Plater::calib_pa(bool bowden) {
|
||||||
const auto calib_pa_name = "PressureAdvanceTest-SF";
|
const auto calib_pa_name = "PressureAdvanceTest";
|
||||||
if (get_project_name() != calib_pa_name) {
|
|
||||||
new_project(false, false, calib_pa_name);
|
new_project(false, false, calib_pa_name);
|
||||||
add_model(false, Slic3r::resources_dir() + "/calib/sf_placeholder.stl");
|
add_model(false, Slic3r::resources_dir() + "/calib/sf_placeholder.stl");
|
||||||
wxGetApp().mainframe->select_tab(size_t(MainFrame::tp3DEditor));
|
wxGetApp().mainframe->select_tab(size_t(MainFrame::tp3DEditor));
|
||||||
|
|
||||||
//select_view_3D("3D");
|
p->background_process.fff_print()->is_calib_mode() = bowden ? Calib_PA_Bowden : Calib_PA_DDE;
|
||||||
}
|
|
||||||
|
|
||||||
p->background_process.fff_print()->is_calib_mode() = true;
|
|
||||||
//BBS update extruder params and speed table before slicing
|
//BBS update extruder params and speed table before slicing
|
||||||
Plater::setExtruderParams(Slic3r::Model::extruderParamsMap);
|
Plater::setExtruderParams(Slic3r::Model::extruderParamsMap);
|
||||||
Plater::setPrintSpeedTable(Slic3r::Model::printSpeedMap);
|
Plater::setPrintSpeedTable(Slic3r::Model::printSpeedMap);
|
||||||
p->m_slice_all = false;
|
p->m_slice_all = false;
|
||||||
reslice();
|
reslice();
|
||||||
wxGetApp().mainframe->select_tab(size_t(MainFrame::tp3DEditor));
|
wxGetApp().mainframe->select_tab(size_t(MainFrame::tpPreview));
|
||||||
select_view_3D("Preview");
|
//select_view_3D("Preview");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Plater::import_sl1_archive()
|
void Plater::import_sl1_archive()
|
||||||
|
@ -226,7 +226,7 @@ public:
|
|||||||
void refresh_print();
|
void refresh_print();
|
||||||
|
|
||||||
// SoftFever
|
// SoftFever
|
||||||
void calib_pa();
|
void calib_pa(bool bowden = false);
|
||||||
|
|
||||||
//BBS: add only gcode mode
|
//BBS: add only gcode mode
|
||||||
bool only_gcode_mode() { return m_only_gcode; }
|
bool only_gcode_mode() { return m_only_gcode; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user