Add Ellis' pattern method for pressure advance calibration (#1547)
* Add pattern method to Pressure Advance dialog * Convert calib_pressure_advance to more unique calib_pressure_advance_line * Share move_to function with PA lines and patterns * Add PA pattern to calib.hpp * Implement move_to(Vec3d). Combine with Vec2d version * Add call to PA pattern in GCode.cpp * Add helper functions * Add directionality to draw_digit * Extract shared number drawing variables * Extract convert_number_to_string function * Use in-class initializers for pattern variables * Add max_numbering_height function * Add helper functions * Extract shared delta helper functions * Add pattern generate_test() and associated helpers * Clarify use of math functions * Remove unused move_to overload, accept move_to comments * Add get_distance() and draw_line() * Extract set_nozzle_diameter() * Clean up and simplify * Rearrange and clean up * Start work on print_pa_pattern * Complete basic draw_box function * Add more helper functions * Add struct for pattern config, more helpers * Rearrange * Add encroachment member variable * Add structs to manage optional arguments * Simplify optional arguments structs * Update opt args usage. Finish draw_box function * Complete print_pa_pattern function * Reuse PA Line STL * Fix forward declaration error * Fix invalid comparison * Fixing complier errors * Make DrawDigitMode options more clear * More compilation error fixes * Yet more compile error fixes * Fix incorrect default step value * Handle top-level dialog changes, consolidate params definitions * Add layer change G-code, set more print variables * Simplify optArgs constructors * Fix pattern drawing, minor misc. clean up * Make draw_box() G-code comments more helpful * Make more of draw_line() const * Fix sequential number draw direction * Extract shared e_per_mm function * Fix misplaced decimal in PA Line * Move short constructor into .hpp * Fix inverted Y direction in pattern digit drawing * Use placeholder STL to create needed layers * Rearrange and clean up * Proof of concept: Adding custom G-Code at layer * Use new scaling method * Reorganize Plater::calib_pa() * Restructure calib * New strategy for adding custom G-code * Remove redundant invocation * Use cube primitive as positioning handle * Move logic to Plater Modifications to model in GCode cancelled _do_export from within itself * Consolidate m_starting_point and pattern_start functions * Replace bed_center() with m_starting_point * Fix and consolidate number tab creation * Fix off by one layer bug * Use correct bounding box * Use Vec3d instead of Vec2d for m_starting_point and m_last_pos * Add translate_starting_point function * Vec3d fix * Store CalibPressureAdvancePattern with model * Formatting adjustments * Move pattern when handle moves * Improve const correctness * Improve/fix pattern writer and config * Fix speed setting bug * Pass model into generate_gcodes to improve consistency * Re-generate pattern on reslice * Make pattern actually move with handle * Fix overzealous m_last_pos initialization * Use clearer function names * Use correct model * Remove unused member variable * Don't hard-code print config settings * Remove unused lines, formatting clean up * Make sure set_key_value operates on existing keys * Remove asserts which limited life of key/value set * Update Calibration.md * Update licensing info * Actually use speed in draw_line * Don't speed_adjust twice * doc: Make width and speed settings used more clear * Bugfix: Shouldn't need to move handle to see pattern * Clean up * Move mp_gcodegen into line method alone * Fix wrong number thickness in PA Line * Remove unnecessary middleman PatternSettings * Give value of config to const m_initial_config, not ref * Fix incorrect DrawBoxOptArg default * Use line_width_anchor() for all of initial layer * Use clearer function name * Replace "anchor" with "first_layer" for better consistency * Update Calibration.md * Update Calibration.md * Make number tab infill explanation more clear * (Hopefully) fix missing origin * Add GCodeProcessor tags * Fully refresh config * Don't store is_bbl_printer * Move set_starting_point to private * Don't constantly recreate GCodeWriter * Use different step value for pattern test * Remove redundant processor tags * Label glyph G-code * Fix comparison typo * Set number print speed * Fix mixed up draw_number parameter * Don't use line_width_first_layer for pattern * (Hopefully) fix temp tower generating PA pattern * Start with pattern centered on plate * Add gap between pattern and handle * Fix overly persistent pattern * Revert "(Hopefully) fix temp tower generating PA pattern" This reverts commit 0aa1206886d57820799beaf62dc28b9b8e02545b. --------- Co-authored-by: SoftFever <softfeverever@gmail.com>
This commit is contained in:
parent
87f6c43784
commit
777c7c68f9
12 changed files with 1396 additions and 296 deletions
|
@ -86,5 +86,7 @@ Slic3r is licensed under the GNU Affero General Public License, version 3. Slic3
|
|||
|
||||
The GNU Affero General Public License, version 3 ensures that if you use any part of this software in any way (even behind a web server), your software must be released under the same license.
|
||||
|
||||
Orca Slicer includes a pressure advance calibration pattern test adapted from Andrew Ellis' generator, which is licensed under GNU General Public License, version 3. Ellis' generator is itself adapted from a generator developed by Sineos for Marlin, which is licensed under GNU General Public License, version 3.
|
||||
|
||||
The bambu networking plugin is based on non-free libraries. It is optional to the Orca Slicer and provides extended functionalities for users.
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
- [Flow rate](#Flow-rate)
|
||||
- [Pressure Advance](#Pressure-Advance)
|
||||
1. [Line method](#Line-method)
|
||||
2. [Tower method](#Tower-method)
|
||||
2. [Pattern method](#Pattern-method)
|
||||
3. [Tower method](#Tower-method)
|
||||
- [Temp tower](#Temp-tower)
|
||||
- [Retraction test](#Retraction-test)
|
||||
- [Orca Tolerance Test](#Orca-Tolerance-Test)
|
||||
|
@ -32,10 +33,13 @@ Steps
|
|||

|
||||
|
||||
# Pressure Advance
|
||||
I will present two approaches for calibrating the pressure advance value. Both methods have their own advantages and disadvantages. It is important to note that each method has two versions: one for a direct drive extruder and one for a Bowden extruder. Make sure to select the appropriate version for your test.
|
||||
##### *NOTE: For Bambulab X1/X1C users, make sure you do not select the 'Flow calibration' option.*
|
||||
|
||||
Orca Slicer includes three approaches for calibrating the pressure advance value. Each method has its own advantages and disadvantages. It is important to note that each method has two versions: one for a direct drive extruder and one for a Bowden extruder. Make sure to select the appropriate version for your test.
|
||||
##### *NOTE: For Bambulab X1/X1C users, make sure you do not select the 'Flow calibration' option when printings.*
|
||||

|
||||
|
||||
### Line method
|
||||
|
||||
The line method is quick and straightforward to test. However, its accuracy highly depends on your first layer quality. It is suggested to turn on the bed mesh leveling for this test.
|
||||
Steps:
|
||||
1. Select the printer, filament, and process you would like to use for the test.
|
||||
|
@ -48,7 +52,27 @@ Steps:
|
|||

|
||||

|
||||
|
||||
### Pattern method
|
||||
|
||||
The pattern method is adapted from [Andrew Ellis' pattern method generator](https://ellis3dp.com/Pressure_Linear_Advance_Tool/), which was itself derived from the [Marlin pattern method](https://marlinfw.org/tools/lin_advance/k-factor.html) developed by [Sineos](https://github.com/Sineos/k-factorjs).
|
||||
|
||||
[Instructions for using and reading the pattern method](https://ellis3dp.com/Print-Tuning-Guide/articles/pressure_linear_advance/pattern_method.html) are provided in [Ellis' Print Tuning Guide](https://ellis3dp.com/Print-Tuning-Guide/), with only a few Orca Slicer differences to note.
|
||||
|
||||
First and foremost, when you initiate the test, you'll only see a small rectangular prism on the plate. This object serves a few purposes:
|
||||
|
||||
1. The test pattern itself is added in as custom G-Code at each layer, same as you could do by hand actually. The rectangular prism gives us the layers in which to insert that G-Code. This also means that **you'll see the full test pattern when you move to the Preview pane**
|
||||
2. The prism acts as a handle, enabling you to move the test pattern wherever you'd like on the plate by moving the prism
|
||||
3. The filament selected for the prism is also used for the test pattern
|
||||
|
||||
Next, Ellis' generator provided the ability to adjust specific printer, filament, and print profile settings. You can make these same changes in Orca Slicer by adjusting the settings in the Prepare pane as you would with any other print. When you initiate the calibration test, Ellis' default settings are applied. A few things to note about these settings:
|
||||
|
||||
1. Ellis specified line widths as a percent of filament diameter. The Orca pattern method does the same to provide its suggested defaults, making use of Ellis' percentages in combination with your specified nozzle diameter
|
||||
2. In terms of line width, the pattern only makes use of the `Default` and `First layer` widths
|
||||
3. In terms of speed, the pattern only uses the `First layer speed -> First layer` and `Other layers speed -> Outer wall` speeds
|
||||
4. The infill pattern beneath the numbers cannot be changed becuase it's not actually an infill pattern pulled from the settings. All of the pattern G-Code is custom written, so that "infill" is, effectively, hand-drawn and so not processed through the usual channels that would enable Orca to recognize it as infill
|
||||
|
||||
### Tower method
|
||||
|
||||
The tower method may take a bit more time to complete, but it does not rely on the quality of the first layer.
|
||||
The PA value for this test will be increased by 0.002 for every 1 mm increase in height. (**NOTE** 0.02 for Bowden)
|
||||
Steps:
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include "Print.hpp"
|
||||
#include "Utils.hpp"
|
||||
#include "ClipperUtils.hpp"
|
||||
#include "libslic3r.h"
|
||||
#include "LocalesUtils.hpp"
|
||||
#include "libslic3r/format.hpp"
|
||||
#include "Time.hpp"
|
||||
|
@ -1056,7 +1055,6 @@ void GCode::do_export(Print* print, const char* path, GCodeProcessorResult* resu
|
|||
GCodeProcessor::s_IsBBLPrinter = print->is_BBL_printer();
|
||||
print->set_started(psGCodeExport);
|
||||
|
||||
|
||||
// check if any custom gcode contains keywords used by the gcode processor to
|
||||
// produce time estimation and gcode toolpaths
|
||||
std::vector<std::pair<std::string, std::string>> validation_res = DoExport::validate_custom_gcode(*print);
|
||||
|
@ -1886,14 +1884,18 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
|
|||
gcode += m_writer.set_jerk_xy(jerk);
|
||||
}
|
||||
|
||||
calib_pressure_advance pa_test(this);
|
||||
auto params = print.calib_params();
|
||||
|
||||
CalibPressureAdvanceLine pa_test(this);
|
||||
|
||||
double filament_max_volumetric_speed = m_config.option<ConfigOptionFloats>("filament_max_volumetric_speed")->get_at(initial_extruder_id);
|
||||
Flow pattern_line = Flow(pa_test.line_width(), 0.2, m_config.nozzle_diameter.get_at(0));
|
||||
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);
|
||||
pa_test.draw_numbers() = print.calib_params().print_numbers;
|
||||
auto params = print.calib_params();
|
||||
|
||||
gcode += pa_test.generate_test(params.start, params.step, std::llround(std::ceil((params.end - params.start) / params.step)));
|
||||
|
||||
file.write(gcode);
|
||||
|
|
|
@ -72,6 +72,12 @@ Model& Model::assign_copy(const Model &rhs)
|
|||
this->plates_custom_gcodes = rhs.plates_custom_gcodes;
|
||||
this->curr_plate_index = rhs.curr_plate_index;
|
||||
|
||||
if (rhs.calib_pa_pattern) {
|
||||
this->calib_pa_pattern = std::make_unique<CalibPressureAdvancePattern>(
|
||||
CalibPressureAdvancePattern(*rhs.calib_pa_pattern)
|
||||
);
|
||||
}
|
||||
|
||||
// BBS: for design info
|
||||
this->design_info = rhs.design_info;
|
||||
this->model_info = rhs.model_info;
|
||||
|
@ -100,6 +106,7 @@ Model& Model::assign_copy(Model &&rhs)
|
|||
// BBS
|
||||
this->plates_custom_gcodes = std::move(rhs.plates_custom_gcodes);
|
||||
this->curr_plate_index = rhs.curr_plate_index;
|
||||
this->calib_pa_pattern = std::move(rhs.calib_pa_pattern);
|
||||
|
||||
//BBS: add auxiliary path logic
|
||||
// BBS: backup, all in one temp dir
|
||||
|
@ -893,6 +900,7 @@ void Model::load_from(Model& model)
|
|||
model.design_info.reset();
|
||||
model.model_info.reset();
|
||||
model.profile_info.reset();
|
||||
model.calib_pa_pattern.reset();
|
||||
}
|
||||
|
||||
// BBS: backup
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "SLA/Hollowing.hpp"
|
||||
#include "TriangleMesh.hpp"
|
||||
#include "CustomGCode.hpp"
|
||||
#include "calib.hpp"
|
||||
#include "enum_bitmask.hpp"
|
||||
|
||||
//BBS: add bbs 3mf
|
||||
|
@ -1608,6 +1609,8 @@ public:
|
|||
// Checks if any of objects is painted using the multi-material painting gizmo.
|
||||
bool is_mm_painted() const;
|
||||
|
||||
std::unique_ptr<CalibPressureAdvancePattern> calib_pa_pattern;
|
||||
|
||||
private:
|
||||
explicit Model(int) : ObjectBase(-1)
|
||||
{
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,55 +1,274 @@
|
|||
#pragma once
|
||||
#define calib_pressure_advance_dd
|
||||
|
||||
#include <string>
|
||||
#include "Point.hpp"
|
||||
namespace Slic3r {
|
||||
#include "GCode.hpp"
|
||||
#include "GCodeWriter.hpp"
|
||||
#include "PrintConfig.hpp"
|
||||
|
||||
class GCode;
|
||||
namespace Slic3r {
|
||||
|
||||
enum class CalibMode : int {
|
||||
Calib_None = 0,
|
||||
Calib_PA_Line,
|
||||
Calib_PA_Pattern,
|
||||
Calib_PA_Tower,
|
||||
Calib_Temp_Tower,
|
||||
Calib_Vol_speed_Tower,
|
||||
Calib_VFA_Tower,
|
||||
Calib_Retraction_tower
|
||||
|
||||
};
|
||||
struct Calib_Params
|
||||
{
|
||||
Calib_Params();
|
||||
|
||||
struct Calib_Params {
|
||||
Calib_Params() : mode(CalibMode::Calib_None) { };
|
||||
double start, end, step;
|
||||
bool print_numbers;
|
||||
CalibMode mode;
|
||||
};
|
||||
|
||||
class calib_pressure_advance
|
||||
{
|
||||
class CalibPressureAdvance {
|
||||
protected:
|
||||
CalibPressureAdvance() =default;
|
||||
~CalibPressureAdvance() =default;
|
||||
|
||||
enum class DrawDigitMode {
|
||||
Left_To_Right,
|
||||
Bottom_To_Top
|
||||
};
|
||||
|
||||
void delta_scale_bed_ext(BoundingBoxf& bed_ext) const { bed_ext.scale(1.0f / 1.41421f); }
|
||||
|
||||
std::string move_to(Vec2d pt, GCodeWriter& writer, std::string comment = std::string());
|
||||
double e_per_mm(
|
||||
double line_width,
|
||||
double layer_height,
|
||||
float nozzle_diameter,
|
||||
float filament_diameter,
|
||||
float print_flow_ratio
|
||||
) const;
|
||||
double speed_adjust(int speed) const { return speed * 60; };
|
||||
|
||||
std::string convert_number_to_string(double num) const;
|
||||
double number_spacing() const { return m_digit_segment_len + m_digit_gap_len; };
|
||||
std::string draw_digit(
|
||||
double startx,
|
||||
double starty,
|
||||
char c,
|
||||
CalibPressureAdvance::DrawDigitMode mode,
|
||||
double line_width,
|
||||
double e_per_mm,
|
||||
GCodeWriter& writer
|
||||
);
|
||||
std::string draw_number(
|
||||
double startx,
|
||||
double starty,
|
||||
double value,
|
||||
CalibPressureAdvance::DrawDigitMode mode,
|
||||
double line_width,
|
||||
double e_per_mm,
|
||||
double speed,
|
||||
GCodeWriter& writer
|
||||
);
|
||||
|
||||
Vec3d m_last_pos;
|
||||
|
||||
DrawDigitMode m_draw_digit_mode {DrawDigitMode::Left_To_Right};
|
||||
const double m_digit_segment_len {2};
|
||||
const double m_digit_gap_len {1};
|
||||
const std::string::size_type m_max_number_len {5};
|
||||
};
|
||||
|
||||
class CalibPressureAdvanceLine : public CalibPressureAdvance {
|
||||
public:
|
||||
calib_pressure_advance(GCode* gcodegen);
|
||||
~calib_pressure_advance() {}
|
||||
CalibPressureAdvanceLine(GCode* gcodegen) :
|
||||
mp_gcodegen(gcodegen),
|
||||
m_nozzle_diameter(gcodegen->config().nozzle_diameter.get_at(0))
|
||||
{ };
|
||||
~CalibPressureAdvanceLine() { };
|
||||
|
||||
std::string generate_test(double start_pa = 0, double step_pa = 0.002, int count = 50);
|
||||
void set_speed(double fast = 100.0,double slow = 20.0) {
|
||||
|
||||
void set_speed(double fast = 100.0, double slow = 20.0) {
|
||||
m_slow_speed = slow;
|
||||
m_fast_speed = fast;
|
||||
}
|
||||
double& line_width() { return m_line_width; };
|
||||
bool& draw_numbers() { return m_draw_numbers; }
|
||||
|
||||
const double& line_width() { return m_line_width; };
|
||||
bool is_delta() const;
|
||||
bool& draw_numbers() { return m_draw_numbers; }
|
||||
|
||||
private:
|
||||
std::string move_to(Vec2d pt);
|
||||
std::string print_pa_lines(double start_x, double start_y, double start_pa, double step_pa, int num);
|
||||
std::string draw_digit(double startx, double starty, char c);
|
||||
std::string draw_number(double startx, double starty, double value);
|
||||
private:
|
||||
|
||||
void delta_modify_start(double& startx, double& starty, int count);
|
||||
|
||||
GCode* mp_gcodegen;
|
||||
double m_length_short, m_length_long;
|
||||
double m_space_y;
|
||||
|
||||
double m_nozzle_diameter;
|
||||
double m_slow_speed, m_fast_speed;
|
||||
double m_line_width;
|
||||
bool m_draw_numbers;
|
||||
|
||||
const double m_height_layer {0.2};
|
||||
const double m_line_width {0.6};
|
||||
const double m_thin_line_width {0.44};
|
||||
const double m_number_line_width {0.48};
|
||||
const double m_space_y {3.5};
|
||||
|
||||
double m_length_short {20.0}, m_length_long {40.0};
|
||||
bool m_draw_numbers {true};
|
||||
};
|
||||
|
||||
struct SuggestedCalibPressureAdvancePatternConfig {
|
||||
const std::vector<std::pair<std::string, double>> float_pairs {
|
||||
{"initial_layer_print_height", 0.25},
|
||||
{"layer_height", 0.2},
|
||||
{"initial_layer_speed", 30},
|
||||
{"outer_wall_speed", 100}
|
||||
};
|
||||
|
||||
const std::vector<std::pair<std::string, double>> nozzle_ratio_pairs {
|
||||
{"line_width", 112.5},
|
||||
{"initial_layer_line_width", 140}
|
||||
};
|
||||
|
||||
const std::vector<std::pair<std::string, int>> int_pairs {
|
||||
{"wall_loops", 3}
|
||||
};
|
||||
};
|
||||
|
||||
class CalibPressureAdvancePattern : public CalibPressureAdvance {
|
||||
friend struct DrawLineOptArgs;
|
||||
friend struct DrawBoxOptArgs;
|
||||
|
||||
public:
|
||||
CalibPressureAdvancePattern(
|
||||
const Calib_Params& params,
|
||||
const DynamicPrintConfig& config,
|
||||
bool is_bbl_machine,
|
||||
Model& model,
|
||||
const Vec3d& origin
|
||||
);
|
||||
|
||||
double handle_xy_size() const { return m_handle_xy_size; };
|
||||
double handle_spacing() const { return m_handle_spacing; };
|
||||
double print_size_x() const { return object_size_x() + pattern_shift(); };
|
||||
double print_size_y() const { return object_size_y(); };
|
||||
double max_layer_z() const { return height_first_layer() + ((m_num_layers - 1) * height_layer()); };
|
||||
|
||||
void generate_custom_gcodes(
|
||||
const DynamicPrintConfig& config,
|
||||
bool is_bbl_machine,
|
||||
Model& model,
|
||||
const Vec3d& origin
|
||||
);
|
||||
|
||||
protected:
|
||||
double speed_first_layer() const { return m_config.option<ConfigOptionFloat>("initial_layer_speed")->value; };
|
||||
double speed_perimeter() const { return m_config.option<ConfigOptionFloat>("outer_wall_speed")->value; };
|
||||
double line_width_first_layer() const { return m_config.option<ConfigOptionFloat>("initial_layer_line_width")->value; };
|
||||
double line_width() const { return m_config.option<ConfigOptionFloat>("line_width")->value; };
|
||||
int wall_count() const { return m_config.option<ConfigOptionInt>("wall_loops")->value; };
|
||||
|
||||
private:
|
||||
struct DrawLineOptArgs {
|
||||
DrawLineOptArgs(const CalibPressureAdvancePattern& p) :
|
||||
height {p.height_layer()},
|
||||
line_width {p.line_width()},
|
||||
speed {p.speed_adjust(p.speed_perimeter())}
|
||||
{ };
|
||||
|
||||
double height;
|
||||
double line_width;
|
||||
double speed;
|
||||
std::string comment {"Print line"};
|
||||
};
|
||||
|
||||
struct DrawBoxOptArgs {
|
||||
DrawBoxOptArgs(const CalibPressureAdvancePattern& p) :
|
||||
num_perimeters {p.wall_count()},
|
||||
height {p.height_first_layer()},
|
||||
line_width {p.line_width_first_layer()},
|
||||
speed {p.speed_adjust(p.speed_first_layer())}
|
||||
{ };
|
||||
|
||||
bool is_filled {false};
|
||||
int num_perimeters;
|
||||
double height;
|
||||
double line_width;
|
||||
double speed;
|
||||
};
|
||||
|
||||
void refresh_setup(
|
||||
const DynamicPrintConfig& config,
|
||||
bool is_bbl_machine,
|
||||
const Model& model,
|
||||
const Vec3d& origin
|
||||
);
|
||||
void _refresh_starting_point(const Model& model);
|
||||
void _refresh_writer(
|
||||
bool is_bbl_machine,
|
||||
const Model& model,
|
||||
const Vec3d& origin
|
||||
);
|
||||
|
||||
double height_first_layer() const { return m_config.option<ConfigOptionFloat>("initial_layer_print_height")->value; };
|
||||
double height_layer() const { return m_config.option<ConfigOptionFloat>("layer_height")->value; };
|
||||
const int get_num_patterns() const
|
||||
{
|
||||
return std::ceil((m_params.end - m_params.start) / m_params.step + 1);
|
||||
}
|
||||
|
||||
std::string draw_line(
|
||||
Vec2d to_pt,
|
||||
DrawLineOptArgs opt_args
|
||||
);
|
||||
std::string draw_box(
|
||||
double min_x,
|
||||
double min_y,
|
||||
double size_x,
|
||||
double size_y,
|
||||
DrawBoxOptArgs opt_args
|
||||
);
|
||||
|
||||
double to_radians(double degrees) const { return degrees * M_PI / 180; };
|
||||
double get_distance(Vec2d from, Vec2d to) const;
|
||||
|
||||
/*
|
||||
from slic3r documentation: spacing = extrusion_width - layer_height * (1 - PI/4)
|
||||
"spacing" = center-to-center distance of adjacent extrusions, which partially overlap
|
||||
https://manual.slic3r.org/advanced/flow-math
|
||||
https://ellis3dp.com/Print-Tuning-Guide/articles/misconceptions.html#two-04mm-perimeters--08mm
|
||||
*/
|
||||
double line_spacing() const { return line_width() - height_layer() * (1 - M_PI / 4); };
|
||||
double line_spacing_first_layer() const { return line_width_first_layer() - height_first_layer() * (1 - M_PI / 4); };
|
||||
double line_spacing_angle() const { return line_spacing() / std::sin(to_radians(m_corner_angle) / 2); };
|
||||
|
||||
double object_size_x() const;
|
||||
double object_size_y() const;
|
||||
double frame_size_y() const { return std::sin(to_radians(double(m_corner_angle) / 2)) * m_wall_side_length * 2; };
|
||||
|
||||
double glyph_start_x(int pattern_i = 0) const;
|
||||
double glyph_length_x() const;
|
||||
double glyph_tab_max_x() const;
|
||||
double max_numbering_height() const;
|
||||
|
||||
double pattern_shift() const;
|
||||
|
||||
const Calib_Params& m_params;
|
||||
|
||||
DynamicPrintConfig m_config;
|
||||
GCodeWriter m_writer;
|
||||
bool m_is_delta;
|
||||
Vec3d m_starting_point;
|
||||
|
||||
const double m_handle_xy_size {5};
|
||||
const double m_handle_spacing {2};
|
||||
const int m_num_layers {4};
|
||||
|
||||
const double m_wall_side_length {30.0};
|
||||
const int m_corner_angle {90};
|
||||
const int m_pattern_spacing {2};
|
||||
const double m_encroachment {1. / 3.};
|
||||
|
||||
const double m_glyph_padding_horizontal {1};
|
||||
const double m_glyph_padding_vertical {1};
|
||||
};
|
||||
} // namespace Slic3r
|
||||
|
|
|
@ -738,7 +738,7 @@ void Preview::load_print_as_fff(bool keep_z_range, bool only_gcode)
|
|||
unsigned int number_extruders = wxGetApp().is_editor() ?
|
||||
(unsigned int)print->extruders().size() :
|
||||
m_canvas->get_gcode_extruders_count();
|
||||
std::vector<Item> gcodes = wxGetApp().is_editor() ?
|
||||
std::vector<CustomGCode::Item> gcodes = wxGetApp().is_editor() ?
|
||||
//BBS
|
||||
wxGetApp().plater()->model().get_curr_plate_custom_gcodes().gcodes :
|
||||
m_canvas->get_custom_gcode_per_print_z();
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "Plater.hpp"
|
||||
|
||||
#include <cstddef>
|
||||
#include <algorithm>
|
||||
#include <numeric>
|
||||
|
@ -100,6 +101,7 @@
|
|||
#include "MsgDialog.hpp"
|
||||
#include "ProjectDirtyStateManager.hpp"
|
||||
#include "Gizmos/GLGizmoSimplify.hpp" // create suggestion notification
|
||||
#include "Gizmos/GizmoObjectManipulation.hpp"
|
||||
|
||||
// BBS
|
||||
#include "Widgets/ProgressDialog.hpp"
|
||||
|
@ -8100,60 +8102,165 @@ std::array<Vec3d, 4> get_cut_plane(const BoundingBoxf3& bbox, const double& cut_
|
|||
return plane_pts;
|
||||
}
|
||||
|
||||
void Plater::calib_pa(const Calib_Params& params) {
|
||||
|
||||
void Plater::calib_pa(const Calib_Params& params)
|
||||
{
|
||||
const auto calib_pa_name = wxString::Format(L"Pressure Advance Test");
|
||||
new_project(false, false, calib_pa_name);
|
||||
wxGetApp().mainframe->select_tab(size_t(MainFrame::tp3DEditor));
|
||||
if (params.mode == CalibMode::Calib_PA_Line) {
|
||||
add_model(false, Slic3r::resources_dir() + "/calib/PressureAdvance/pressure_advance_test.stl");
|
||||
|
||||
switch (params.mode) {
|
||||
case CalibMode::Calib_PA_Line:
|
||||
add_model(false, Slic3r::resources_dir() + "/calib/PressureAdvance/pressure_advance_test.stl");
|
||||
break;
|
||||
case CalibMode::Calib_PA_Pattern:
|
||||
_calib_pa_pattern(params);
|
||||
break;
|
||||
case CalibMode::Calib_PA_Tower:
|
||||
_calib_pa_tower(params);
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
else {
|
||||
add_model(false, Slic3r::resources_dir() + "/calib/PressureAdvance/tower_with_seam.stl");
|
||||
auto print_config = &wxGetApp().preset_bundle->prints.get_edited_preset().config;
|
||||
auto printer_config = &wxGetApp().preset_bundle->printers.get_edited_preset().config;
|
||||
auto filament_config = &wxGetApp().preset_bundle->filaments.get_edited_preset().config;
|
||||
filament_config->set_key_value("slow_down_layer_time", new ConfigOptionFloats{ 1.0f });
|
||||
print_config->set_key_value("default_jerk", new ConfigOptionFloat(1.0f));
|
||||
print_config->set_key_value("outer_wall_jerk", new ConfigOptionFloat(1.0f));
|
||||
print_config->set_key_value("inner_wall_jerk", new ConfigOptionFloat(1.0f));
|
||||
if(print_config->option<ConfigOptionEnum<PerimeterGeneratorType>>("wall_generator")->value == PerimeterGeneratorType::Arachne)
|
||||
print_config->set_key_value("wall_transition_angle", new ConfigOptionFloat(25));
|
||||
model().objects[0]->config.set_key_value("seam_position", new ConfigOptionEnum<SeamPosition>(spRear));
|
||||
|
||||
changed_objects({ 0 });
|
||||
wxGetApp().get_tab(Preset::TYPE_PRINT)->update_dirty();
|
||||
wxGetApp().get_tab(Preset::TYPE_FILAMENT)->update_dirty();
|
||||
wxGetApp().get_tab(Preset::TYPE_PRINTER)->update_dirty();
|
||||
wxGetApp().get_tab(Preset::TYPE_PRINT)->reload_config();
|
||||
wxGetApp().get_tab(Preset::TYPE_FILAMENT)->reload_config();
|
||||
wxGetApp().get_tab(Preset::TYPE_PRINTER)->reload_config();
|
||||
|
||||
auto new_height = std::ceil((params.end - params.start) / params.step) + 1;
|
||||
auto obj_bb = model().objects[0]->bounding_box();
|
||||
if (new_height < obj_bb.size().z()) {
|
||||
std::array<Vec3d, 4> plane_pts = get_cut_plane(obj_bb, new_height);
|
||||
cut(0, 0, plane_pts, ModelObjectCutAttribute::KeepLower);
|
||||
}
|
||||
|
||||
// automatic selection of added objects
|
||||
// update printable state for new volumes on canvas3D
|
||||
wxGetApp().plater()->canvas3D()->update_instance_printable_state_for_objects({0});
|
||||
|
||||
Selection& selection = p->view3D->get_canvas3d()->get_selection();
|
||||
selection.clear();
|
||||
selection.add_object(0, false);
|
||||
|
||||
// BBS: update object list selection
|
||||
p->sidebar->obj_list()->update_selections();
|
||||
selection.notify_instance_update(-1, -1);
|
||||
if (p->view3D->get_canvas3d()->get_gizmos_manager().is_enabled())
|
||||
// this is required because the selected object changed and the flatten on face an sla support gizmos need to be updated accordingly
|
||||
p->view3D->get_canvas3d()->update_gizmos_on_off_state();
|
||||
}
|
||||
p->background_process.fff_print()->set_calib_params(params);
|
||||
}
|
||||
|
||||
void Plater::_calib_pa_pattern(const Calib_Params& params)
|
||||
{
|
||||
// add "handle" cube
|
||||
sidebar().obj_list()->load_generic_subobject("Cube", ModelVolumeType::INVALID);
|
||||
orient();
|
||||
changed_objects({ 0 });
|
||||
_calib_pa_select_added_objects();
|
||||
|
||||
const DynamicPrintConfig& printer_config = wxGetApp().preset_bundle->printers.get_edited_preset().config;
|
||||
DynamicPrintConfig& print_config = wxGetApp().preset_bundle->prints.get_edited_preset().config;
|
||||
|
||||
for (const auto opt : SuggestedCalibPressureAdvancePatternConfig().float_pairs) {
|
||||
print_config.set_key_value(
|
||||
opt.first,
|
||||
new ConfigOptionFloat(opt.second)
|
||||
);
|
||||
}
|
||||
|
||||
for (const auto opt : SuggestedCalibPressureAdvancePatternConfig().nozzle_ratio_pairs) {
|
||||
double nozzle_diameter = printer_config.option<ConfigOptionFloats>("nozzle_diameter")->get_at(0);
|
||||
print_config.set_key_value(
|
||||
opt.first,
|
||||
new ConfigOptionFloat(nozzle_diameter * opt.second / 100)
|
||||
);
|
||||
}
|
||||
|
||||
for (const auto opt : SuggestedCalibPressureAdvancePatternConfig().int_pairs) {
|
||||
print_config.set_key_value(
|
||||
opt.first,
|
||||
new ConfigOptionInt(opt.second)
|
||||
);
|
||||
}
|
||||
|
||||
wxGetApp().get_tab(Preset::TYPE_PRINT)->update_dirty();
|
||||
wxGetApp().get_tab(Preset::TYPE_PRINT)->reload_config();
|
||||
|
||||
const DynamicPrintConfig full_config = wxGetApp().preset_bundle->full_config();
|
||||
PresetBundle* preset_bundle = wxGetApp().preset_bundle;
|
||||
const bool is_bbl_machine = preset_bundle->printers.get_edited_preset().is_bbl_vendor_preset(preset_bundle);
|
||||
const Vec3d plate_origin = get_partplate_list().get_current_plate_origin();
|
||||
CalibPressureAdvancePattern pa_pattern(
|
||||
params,
|
||||
full_config,
|
||||
is_bbl_machine,
|
||||
model(),
|
||||
plate_origin
|
||||
);
|
||||
|
||||
// scale cube to suit test
|
||||
GizmoObjectManipulation& giz_obj_manip = p->view3D->get_canvas3d()->
|
||||
get_gizmos_manager().get_object_manipulation();
|
||||
giz_obj_manip.set_uniform_scaling(true);
|
||||
giz_obj_manip.on_change(
|
||||
"size",
|
||||
0,
|
||||
pa_pattern.handle_xy_size()
|
||||
);
|
||||
giz_obj_manip.set_uniform_scaling(false);
|
||||
giz_obj_manip.on_change(
|
||||
"size",
|
||||
2,
|
||||
pa_pattern.max_layer_z()
|
||||
);
|
||||
// start with pattern centered on plate
|
||||
center_selection();
|
||||
const Vec3d plate_center = get_partplate_list().get_curr_plate()->get_center_origin();
|
||||
giz_obj_manip.on_change(
|
||||
"position",
|
||||
0,
|
||||
plate_center.x() - (pa_pattern.print_size_x() / 2)
|
||||
);
|
||||
giz_obj_manip.on_change(
|
||||
"position",
|
||||
1,
|
||||
plate_center.y() -
|
||||
(pa_pattern.print_size_y() / 2) -
|
||||
pa_pattern.handle_spacing()
|
||||
);
|
||||
|
||||
pa_pattern.generate_custom_gcodes(
|
||||
full_config,
|
||||
is_bbl_machine,
|
||||
model(),
|
||||
plate_origin
|
||||
);
|
||||
model().calib_pa_pattern = std::make_unique<CalibPressureAdvancePattern>(pa_pattern);
|
||||
changed_objects({ 0 });
|
||||
}
|
||||
|
||||
void Plater::_calib_pa_tower(const Calib_Params& params) {
|
||||
add_model(false, Slic3r::resources_dir() + "/calib/PressureAdvance/tower_with_seam.stl");
|
||||
|
||||
auto print_config = &wxGetApp().preset_bundle->prints.get_edited_preset().config;
|
||||
auto printer_config = &wxGetApp().preset_bundle->printers.get_edited_preset().config;
|
||||
auto filament_config = &wxGetApp().preset_bundle->filaments.get_edited_preset().config;
|
||||
|
||||
filament_config->set_key_value("slow_down_layer_time", new ConfigOptionFloats{ 1.0f });
|
||||
print_config->set_key_value("default_jerk", new ConfigOptionFloat(1.0f));
|
||||
print_config->set_key_value("outer_wall_jerk", new ConfigOptionFloat(1.0f));
|
||||
print_config->set_key_value("inner_wall_jerk", new ConfigOptionFloat(1.0f));
|
||||
if(print_config->option<ConfigOptionEnum<PerimeterGeneratorType>>("wall_generator")->value == PerimeterGeneratorType::Arachne)
|
||||
print_config->set_key_value("wall_transition_angle", new ConfigOptionFloat(25));
|
||||
model().objects[0]->config.set_key_value("seam_position", new ConfigOptionEnum<SeamPosition>(spRear));
|
||||
|
||||
changed_objects({ 0 });
|
||||
wxGetApp().get_tab(Preset::TYPE_PRINT)->update_dirty();
|
||||
wxGetApp().get_tab(Preset::TYPE_FILAMENT)->update_dirty();
|
||||
wxGetApp().get_tab(Preset::TYPE_PRINTER)->update_dirty();
|
||||
wxGetApp().get_tab(Preset::TYPE_PRINT)->reload_config();
|
||||
wxGetApp().get_tab(Preset::TYPE_FILAMENT)->reload_config();
|
||||
wxGetApp().get_tab(Preset::TYPE_PRINTER)->reload_config();
|
||||
|
||||
auto new_height = std::ceil((params.end - params.start) / params.step) + 1;
|
||||
auto obj_bb = model().objects[0]->bounding_box();
|
||||
if (new_height < obj_bb.size().z()) {
|
||||
std::array<Vec3d, 4> plane_pts = get_cut_plane(obj_bb, new_height);
|
||||
cut(0, 0, plane_pts, ModelObjectCutAttribute::KeepLower);
|
||||
}
|
||||
|
||||
_calib_pa_select_added_objects();
|
||||
}
|
||||
|
||||
void Plater::_calib_pa_select_added_objects() {
|
||||
// update printable state for new volumes on canvas3D
|
||||
wxGetApp().plater()->canvas3D()->update_instance_printable_state_for_objects({0});
|
||||
|
||||
Selection& selection = p->view3D->get_canvas3d()->get_selection();
|
||||
selection.clear();
|
||||
selection.add_object(0, false);
|
||||
|
||||
// BBS: update object list selection
|
||||
p->sidebar->obj_list()->update_selections();
|
||||
selection.notify_instance_update(-1, -1);
|
||||
if (p->view3D->get_canvas3d()->get_gizmos_manager().is_enabled()) {
|
||||
// this is required because the selected object changed and the flatten on face an sla support gizmos need to be updated accordingly
|
||||
p->view3D->get_canvas3d()->update_gizmos_on_off_state();
|
||||
}
|
||||
}
|
||||
|
||||
void Plater::calib_flowrate(int pass) {
|
||||
|
@ -8243,7 +8350,6 @@ void Plater::calib_flowrate(int pass) {
|
|||
wxGetApp().get_tab(Preset::TYPE_PRINT)->reload_config();
|
||||
wxGetApp().get_tab(Preset::TYPE_FILAMENT)->reload_config();
|
||||
wxGetApp().get_tab(Preset::TYPE_PRINTER)->reload_config();
|
||||
|
||||
}
|
||||
|
||||
void Plater::calib_temp(const Calib_Params& params) {
|
||||
|
@ -10260,6 +10366,18 @@ void Plater::reslice()
|
|||
// Stop arrange and (or) optimize rotation tasks.
|
||||
this->stop_jobs();
|
||||
|
||||
// regenerate CalibPressureAdvancePattern custom G-code to apply changes
|
||||
if (model().calib_pa_pattern) {
|
||||
PresetBundle* preset_bundle = wxGetApp().preset_bundle;
|
||||
|
||||
model().calib_pa_pattern->generate_custom_gcodes(
|
||||
wxGetApp().preset_bundle->full_config(),
|
||||
preset_bundle->printers.get_edited_preset().is_bbl_vendor_preset(preset_bundle),
|
||||
model(),
|
||||
get_partplate_list().get_current_plate_origin()
|
||||
);
|
||||
}
|
||||
|
||||
if (printer_technology() == ptSLA) {
|
||||
for (auto& object : model().objects)
|
||||
if (object->sla_points_status == sla::PointsStatus::NoPoints)
|
||||
|
|
|
@ -727,6 +727,10 @@ private:
|
|||
// BBS: add project slice related functions
|
||||
int start_next_slice();
|
||||
|
||||
void _calib_pa_pattern(const Calib_Params& params);
|
||||
void _calib_pa_tower(const Calib_Params& params);
|
||||
void _calib_pa_select_added_objects();
|
||||
|
||||
friend class SuppressBackgroundProcessingUpdate;
|
||||
};
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ PA_Calibration_Dlg::PA_Calibration_Dlg(wxWindow* parent, wxWindowID id, Plater*
|
|||
m_rbExtruderType->SetSelection(0);
|
||||
choice_sizer->Add(m_rbExtruderType, 0, wxALL, 5);
|
||||
choice_sizer->Add(FromDIP(5), 0, 0, wxEXPAND, 5);
|
||||
wxString m_rbMethodChoices[] = { _L("PA Tower"), _L("PA Line") };
|
||||
wxString m_rbMethodChoices[] = { _L("PA Tower"), _L("PA Line"), _L("PA Pattern") };
|
||||
int m_rbMethodNChoices = sizeof(m_rbMethodChoices) / sizeof(wxString);
|
||||
m_rbMethod = new wxRadioBox(this, wxID_ANY, _L("Method"), wxDefaultPosition, wxDefaultSize, m_rbMethodNChoices, m_rbMethodChoices, 2, wxRA_SPECIFY_COLS);
|
||||
m_rbMethod->SetSelection(0);
|
||||
|
@ -70,7 +70,7 @@ PA_Calibration_Dlg::PA_Calibration_Dlg(wxWindow* parent, wxWindowID id, Plater*
|
|||
// start PA
|
||||
auto start_PA_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
auto start_pa_text = new wxStaticText(this, wxID_ANY, start_pa_str, wxDefaultPosition, st_size, wxALIGN_LEFT);
|
||||
m_tiStartPA = new TextInput(this, wxString::FromDouble(0.0), "", "", wxDefaultPosition, ti_size, wxTE_CENTRE | wxTE_PROCESS_ENTER);
|
||||
m_tiStartPA = new TextInput(this, "", "", "", wxDefaultPosition, ti_size, wxTE_CENTRE | wxTE_PROCESS_ENTER);
|
||||
m_tiStartPA->GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
|
||||
|
||||
start_PA_sizer->Add(start_pa_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
|
||||
|
@ -80,7 +80,7 @@ PA_Calibration_Dlg::PA_Calibration_Dlg(wxWindow* parent, wxWindowID id, Plater*
|
|||
// end PA
|
||||
auto end_PA_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
auto end_pa_text = new wxStaticText(this, wxID_ANY, end_pa_str, wxDefaultPosition, st_size, wxALIGN_LEFT);
|
||||
m_tiEndPA = new TextInput(this, wxString::FromDouble(0.1), "", "", wxDefaultPosition, ti_size, wxTE_CENTRE | wxTE_PROCESS_ENTER);
|
||||
m_tiEndPA = new TextInput(this, "", "", "", wxDefaultPosition, ti_size, wxTE_CENTRE | wxTE_PROCESS_ENTER);
|
||||
m_tiStartPA->GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
|
||||
end_PA_sizer->Add(end_pa_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
|
||||
end_PA_sizer->Add(m_tiEndPA, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
|
||||
|
@ -89,7 +89,7 @@ PA_Calibration_Dlg::PA_Calibration_Dlg(wxWindow* parent, wxWindowID id, Plater*
|
|||
// PA step
|
||||
auto PA_step_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
auto PA_step_text = new wxStaticText(this, wxID_ANY, PA_step_str, wxDefaultPosition, st_size, wxALIGN_LEFT);
|
||||
m_tiPAStep = new TextInput(this, wxString::FromDouble(0.002), "", "", wxDefaultPosition, ti_size, wxTE_CENTRE | wxTE_PROCESS_ENTER);
|
||||
m_tiPAStep = new TextInput(this, "", "", "", wxDefaultPosition, ti_size, wxTE_CENTRE | wxTE_PROCESS_ENTER);
|
||||
m_tiStartPA->GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
|
||||
PA_step_sizer->Add(PA_step_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
|
||||
PA_step_sizer->Add(m_tiPAStep, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
|
||||
|
@ -114,6 +114,8 @@ PA_Calibration_Dlg::PA_Calibration_Dlg(wxWindow* parent, wxWindowID id, Plater*
|
|||
m_btnStart->Bind(wxEVT_BUTTON, &PA_Calibration_Dlg::on_start, this);
|
||||
v_sizer->Add(m_btnStart, 0, wxALL | wxALIGN_RIGHT, FromDIP(5));
|
||||
|
||||
PA_Calibration_Dlg::reset_params();
|
||||
|
||||
// Connect Events
|
||||
m_rbExtruderType->Connect(wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler(PA_Calibration_Dlg::on_extruder_type_changed), NULL, this);
|
||||
m_rbMethod->Connect(wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler(PA_Calibration_Dlg::on_method_changed), NULL, this);
|
||||
|
@ -131,6 +133,47 @@ PA_Calibration_Dlg::~PA_Calibration_Dlg() {
|
|||
m_btnStart->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(PA_Calibration_Dlg::on_start), NULL, this);
|
||||
}
|
||||
|
||||
void PA_Calibration_Dlg::reset_params() {
|
||||
bool isDDE = m_rbExtruderType->GetSelection() == 0 ? true : false;
|
||||
int method = m_rbMethod->GetSelection();
|
||||
|
||||
m_tiStartPA->GetTextCtrl()->SetValue(wxString::FromDouble(0.0));
|
||||
|
||||
switch (method) {
|
||||
case 1:
|
||||
m_params.mode = CalibMode::Calib_PA_Line;
|
||||
m_tiEndPA->GetTextCtrl()->SetValue(wxString::FromDouble(0.1));
|
||||
m_tiPAStep->GetTextCtrl()->SetValue(wxString::FromDouble(0.002));
|
||||
m_cbPrintNum->SetValue(true);
|
||||
m_cbPrintNum->Enable(true);
|
||||
break;
|
||||
case 2:
|
||||
m_params.mode = CalibMode::Calib_PA_Pattern;
|
||||
m_tiEndPA->GetTextCtrl()->SetValue(wxString::FromDouble(0.08));
|
||||
m_tiPAStep->GetTextCtrl()->SetValue(wxString::FromDouble(0.005));
|
||||
m_cbPrintNum->SetValue(true);
|
||||
m_cbPrintNum->Enable(false);
|
||||
break;
|
||||
default:
|
||||
m_params.mode = CalibMode::Calib_PA_Tower;
|
||||
m_tiEndPA->GetTextCtrl()->SetValue(wxString::FromDouble(0.1));
|
||||
m_tiPAStep->GetTextCtrl()->SetValue(wxString::FromDouble(0.002));
|
||||
m_cbPrintNum->SetValue(false);
|
||||
m_cbPrintNum->Enable(false);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!isDDE) {
|
||||
m_tiEndPA->GetTextCtrl()->SetValue(wxString::FromDouble(1.0));
|
||||
|
||||
if (m_params.mode == CalibMode::Calib_PA_Pattern) {
|
||||
m_tiPAStep->GetTextCtrl()->SetValue(wxString::FromDouble(0.05));
|
||||
} else {
|
||||
m_tiPAStep->GetTextCtrl()->SetValue(wxString::FromDouble(0.02));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PA_Calibration_Dlg::on_start(wxCommandEvent& event) {
|
||||
bool read_double = false;
|
||||
read_double = m_tiStartPA->GetTextCtrl()->GetValue().ToDouble(&m_params.start);
|
||||
|
@ -141,7 +184,18 @@ void PA_Calibration_Dlg::on_start(wxCommandEvent& event) {
|
|||
msg_dlg.ShowModal();
|
||||
return;
|
||||
}
|
||||
m_params.mode = m_rbMethod->GetSelection() == 0 ? CalibMode::Calib_PA_Tower : CalibMode::Calib_PA_Line;
|
||||
|
||||
switch (m_rbMethod->GetSelection()) {
|
||||
case 1:
|
||||
m_params.mode = CalibMode::Calib_PA_Line;
|
||||
break;
|
||||
case 2:
|
||||
m_params.mode = CalibMode::Calib_PA_Pattern;
|
||||
break;
|
||||
default:
|
||||
m_params.mode = CalibMode::Calib_PA_Tower;
|
||||
}
|
||||
|
||||
m_params.print_numbers = m_cbPrintNum->GetValue();
|
||||
|
||||
m_plater->calib_pa(m_params);
|
||||
|
@ -149,41 +203,21 @@ void PA_Calibration_Dlg::on_start(wxCommandEvent& event) {
|
|||
|
||||
}
|
||||
void PA_Calibration_Dlg::on_extruder_type_changed(wxCommandEvent& event) {
|
||||
int selection = event.GetSelection();
|
||||
m_bDDE = selection == 0 ? true : false;
|
||||
m_tiEndPA->GetTextCtrl()->SetValue(wxString::FromDouble(m_bDDE ? 0.1 : 1.0));
|
||||
m_tiStartPA->GetTextCtrl()->SetValue(wxString::FromDouble(0.0));
|
||||
m_tiPAStep->GetTextCtrl()->SetValue(wxString::FromDouble(m_bDDE ? 0.002 : 0.02));
|
||||
PA_Calibration_Dlg::reset_params();
|
||||
event.Skip();
|
||||
}
|
||||
void PA_Calibration_Dlg::on_method_changed(wxCommandEvent& event) {
|
||||
int selection = event.GetSelection();
|
||||
m_params.mode = selection == 0 ? CalibMode::Calib_PA_Tower : CalibMode::Calib_PA_Line;
|
||||
if (selection == 0) {
|
||||
m_cbPrintNum->SetValue(false);
|
||||
m_cbPrintNum->Enable(false);
|
||||
}
|
||||
else {
|
||||
m_cbPrintNum->SetValue(true);
|
||||
m_cbPrintNum->Enable(true);
|
||||
}
|
||||
|
||||
PA_Calibration_Dlg::reset_params();
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
|
||||
void PA_Calibration_Dlg::on_dpi_changed(const wxRect& suggested_rect) {
|
||||
this->Refresh();
|
||||
Fit();
|
||||
|
||||
}
|
||||
|
||||
void PA_Calibration_Dlg::on_show(wxShowEvent& event) {
|
||||
|
||||
if (m_rbMethod->GetSelection() == 0)
|
||||
m_cbPrintNum->Enable(false);
|
||||
else
|
||||
m_cbPrintNum->Enable(true);
|
||||
PA_Calibration_Dlg::reset_params();
|
||||
}
|
||||
|
||||
// Temp Calib dlg
|
||||
|
|
|
@ -25,6 +25,7 @@ public:
|
|||
void on_dpi_changed(const wxRect& suggested_rect) override;
|
||||
void on_show(wxShowEvent& event);
|
||||
protected:
|
||||
void reset_params();
|
||||
virtual void on_start(wxCommandEvent& event);
|
||||
virtual void on_extruder_type_changed(wxCommandEvent& event);
|
||||
virtual void on_method_changed(wxCommandEvent& event);
|
||||
|
|
Loading…
Reference in a new issue