mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-08-30 05:17:19 +00:00
Improve/fix pattern writer and config
This commit is contained in:
@@ -1,8 +1,5 @@
|
|||||||
#include "calib.hpp"
|
#include "calib.hpp"
|
||||||
#include "PrintConfig.hpp"
|
#include "Model.hpp"
|
||||||
#include "GCodeWriter.hpp"
|
|
||||||
#include "GCode.hpp"
|
|
||||||
#include <map>
|
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
CalibPressureAdvance::CalibPressureAdvance(GCode* gcodegen) :
|
CalibPressureAdvance::CalibPressureAdvance(GCode* gcodegen) :
|
||||||
@@ -10,7 +7,7 @@ CalibPressureAdvance::CalibPressureAdvance(GCode* gcodegen) :
|
|||||||
m_nozzle_diameter(gcodegen->config().nozzle_diameter.get_at(0))
|
m_nozzle_diameter(gcodegen->config().nozzle_diameter.get_at(0))
|
||||||
{ };
|
{ };
|
||||||
|
|
||||||
std::string CalibPressureAdvance::move_to(Vec2d pt, GCodeWriter& writer, std::string comment)
|
std::string CalibPressureAdvance::move_to(Vec2d pt, GCodeWriter writer, std::string comment)
|
||||||
{
|
{
|
||||||
std::stringstream gcode;
|
std::stringstream gcode;
|
||||||
|
|
||||||
@@ -210,10 +207,26 @@ std::string CalibPressureAdvance::draw_number(
|
|||||||
}
|
}
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case DrawDigitMode::Bottom_To_Top:
|
case DrawDigitMode::Bottom_To_Top:
|
||||||
gcode << draw_digit(startx, starty + i * number_spacing(), sNumber[i], mode, line_width, e_per_mm, writer);
|
gcode << draw_digit(
|
||||||
|
startx,
|
||||||
|
starty + i * number_spacing(),
|
||||||
|
sNumber[i],
|
||||||
|
mode,
|
||||||
|
line_width,
|
||||||
|
e_per_mm,
|
||||||
|
writer
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
gcode << draw_digit(startx + i * number_spacing(), starty, sNumber[i], mode, line_width, e_per_mm, writer);
|
gcode << draw_digit(
|
||||||
|
startx + i * number_spacing(),
|
||||||
|
starty,
|
||||||
|
sNumber[i],
|
||||||
|
mode,
|
||||||
|
line_width,
|
||||||
|
e_per_mm,
|
||||||
|
writer
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -336,17 +349,39 @@ void CalibPressureAdvanceLine::delta_modify_start(double& startx, double& starty
|
|||||||
starty = -(count * m_space_y) / 2;
|
starty = -(count * m_space_y) / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
PatternSettings::PatternSettings(const CalibPressureAdvancePattern* cpap) :
|
PatternSettings::PatternSettings(const CalibPressureAdvancePattern& cpap) :
|
||||||
anchor_line_width(cpap->line_width_anchor()),
|
anchor_line_width(cpap.line_width_anchor()),
|
||||||
anchor_perimeters(cpap->anchor_perimeters()),
|
anchor_perimeters(cpap.anchor_perimeters()),
|
||||||
encroachment(cpap->encroachment()),
|
encroachment(cpap.encroachment()),
|
||||||
first_layer_height(cpap->height_first_layer()),
|
first_layer_height(cpap.height_first_layer()),
|
||||||
first_layer_speed(cpap->speed_adjust(cpap->speed_first_layer())),
|
first_layer_speed(cpap.speed_adjust(cpap.speed_first_layer())),
|
||||||
layer_height(cpap->height_layer()),
|
layer_height(cpap.height_layer()),
|
||||||
line_width(cpap->line_width()),
|
line_width(cpap.line_width()),
|
||||||
perim_speed(cpap->speed_adjust(cpap->speed_perimeter()))
|
perim_speed(cpap.speed_adjust(cpap.speed_perimeter()))
|
||||||
{ };
|
{ };
|
||||||
|
|
||||||
|
CalibPressureAdvancePattern::CalibPressureAdvancePattern(
|
||||||
|
const Calib_Params& params,
|
||||||
|
Model& model,
|
||||||
|
DynamicPrintConfig& config,
|
||||||
|
const bool& is_bbl_machine,
|
||||||
|
const Vec3d& origin
|
||||||
|
) :
|
||||||
|
CalibPressureAdvance(),
|
||||||
|
m_params(params),
|
||||||
|
m_model(model),
|
||||||
|
m_initial_config(config),
|
||||||
|
m_is_bbl_machine(is_bbl_machine),
|
||||||
|
m_origin(origin)
|
||||||
|
{
|
||||||
|
this->m_nozzle_diameter = pattern_config().option<ConfigOptionFloats>("nozzle_diameter")->values[0];
|
||||||
|
this->m_height_layer = 0.2;
|
||||||
|
this->m_draw_digit_mode = DrawDigitMode::Bottom_To_Top;
|
||||||
|
this->m_line_width = line_width();
|
||||||
|
|
||||||
|
this->m_pattern_settings = PatternSettings(*this);
|
||||||
|
};
|
||||||
|
|
||||||
void CalibPressureAdvancePattern::starting_point(Vec3d pt)
|
void CalibPressureAdvancePattern::starting_point(Vec3d pt)
|
||||||
{
|
{
|
||||||
m_starting_point = pt;
|
m_starting_point = pt;
|
||||||
@@ -371,9 +406,11 @@ CustomGCode::Info CalibPressureAdvancePattern::generate_gcodes()
|
|||||||
|
|
||||||
gcode << "; start pressure advance pattern for layer\n";
|
gcode << "; start pressure advance pattern for layer\n";
|
||||||
|
|
||||||
gcode << move_to(Vec2d(m_starting_point.x(), m_starting_point.y()), m_writer, "Move to start XY position");
|
GCodeWriter writer = pattern_writer();
|
||||||
gcode << m_writer.travel_to_z(m_height_first_layer, "Move to start Z position");
|
|
||||||
gcode << m_writer.set_pressure_advance(m_params.start);
|
gcode << move_to(Vec2d(m_starting_point.x(), m_starting_point.y()), writer, "Move to start XY position");
|
||||||
|
gcode << writer.travel_to_z(m_height_first_layer, "Move to start Z position");
|
||||||
|
gcode << writer.set_pressure_advance(m_params.start);
|
||||||
|
|
||||||
const DrawBoxOptArgs default_box_opt_args(m_pattern_settings);
|
const DrawBoxOptArgs default_box_opt_args(m_pattern_settings);
|
||||||
|
|
||||||
@@ -416,12 +453,12 @@ CustomGCode::Info CalibPressureAdvancePattern::generate_gcodes()
|
|||||||
gcode << "; start pressure advance pattern for layer\n";
|
gcode << "; start pressure advance pattern for layer\n";
|
||||||
|
|
||||||
double layer_height = m_height_first_layer + (i * m_height_layer);
|
double layer_height = m_height_first_layer + (i * m_height_layer);
|
||||||
gcode << m_writer.travel_to_z(layer_height, "Move to layer height");
|
gcode << writer.travel_to_z(layer_height, "Move to layer height");
|
||||||
}
|
}
|
||||||
|
|
||||||
// // line numbering
|
// // line numbering
|
||||||
if (i == 1) {
|
if (i == 1) {
|
||||||
gcode << m_writer.set_pressure_advance(m_params.start);
|
gcode << writer.set_pressure_advance(m_params.start);
|
||||||
|
|
||||||
// glyph on every other line
|
// glyph on every other line
|
||||||
for (int j = 0; j < num_patterns; j += 2) {
|
for (int j = 0; j < num_patterns; j += 2) {
|
||||||
@@ -432,7 +469,7 @@ CustomGCode::Info CalibPressureAdvancePattern::generate_gcodes()
|
|||||||
m_draw_digit_mode,
|
m_draw_digit_mode,
|
||||||
m_line_width,
|
m_line_width,
|
||||||
m_height_layer,
|
m_height_layer,
|
||||||
m_writer
|
writer
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -462,11 +499,11 @@ CustomGCode::Info CalibPressureAdvancePattern::generate_gcodes()
|
|||||||
double initial_x = to_x;
|
double initial_x = to_x;
|
||||||
double initial_y = to_y;
|
double initial_y = to_y;
|
||||||
|
|
||||||
gcode << move_to(Vec2d(to_x, to_y), m_writer, "Move to pattern start");
|
gcode << move_to(Vec2d(to_x, to_y), writer, "Move to pattern start");
|
||||||
|
|
||||||
for (int j = 0; j < num_patterns; ++j) {
|
for (int j = 0; j < num_patterns; ++j) {
|
||||||
// increment pressure advance
|
// increment pressure advance
|
||||||
gcode << m_writer.set_pressure_advance(m_params.start + (j * m_params.step));
|
gcode << writer.set_pressure_advance(m_params.start + (j * m_params.step));
|
||||||
|
|
||||||
for (int k = 0; k < m_wall_count; ++k) {
|
for (int k = 0; k < m_wall_count; ++k) {
|
||||||
to_x += std::cos(to_radians(m_corner_angle) / 2) * side_length;
|
to_x += std::cos(to_radians(m_corner_angle) / 2) * side_length;
|
||||||
@@ -487,15 +524,15 @@ CustomGCode::Info CalibPressureAdvancePattern::generate_gcodes()
|
|||||||
if (k != m_wall_count - 1) {
|
if (k != m_wall_count - 1) {
|
||||||
// perimeters not done yet. move to next perimeter
|
// perimeters not done yet. move to next perimeter
|
||||||
to_x += line_spacing_angle();
|
to_x += line_spacing_angle();
|
||||||
gcode << move_to(Vec2d(to_x, to_y), m_writer, "Move to start next pattern wall");
|
gcode << move_to(Vec2d(to_x, to_y), writer, "Move to start next pattern wall");
|
||||||
} else if (j != num_patterns - 1) {
|
} else if (j != num_patterns - 1) {
|
||||||
// patterns not done yet. move to next pattern
|
// patterns not done yet. move to next pattern
|
||||||
to_x += m_pattern_spacing + line_width();
|
to_x += m_pattern_spacing + line_width();
|
||||||
gcode << move_to(Vec2d(to_x, to_y), m_writer, "Move to next pattern");
|
gcode << move_to(Vec2d(to_x, to_y), writer, "Move to next pattern");
|
||||||
} else if (i != m_num_layers - 1) {
|
} else if (i != m_num_layers - 1) {
|
||||||
// layers not done yet. move back to start
|
// layers not done yet. move back to start
|
||||||
to_x = initial_x;
|
to_x = initial_x;
|
||||||
gcode << move_to(Vec2d(to_x, to_y), m_writer, "Move back to start position");
|
gcode << move_to(Vec2d(to_x, to_y), writer, "Move back to start position");
|
||||||
} else {
|
} else {
|
||||||
// everything done
|
// everything done
|
||||||
}
|
}
|
||||||
@@ -503,7 +540,7 @@ CustomGCode::Info CalibPressureAdvancePattern::generate_gcodes()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gcode << m_writer.set_pressure_advance(m_params.start);
|
gcode << writer.set_pressure_advance(m_params.start);
|
||||||
gcode << "; end pressure advance pattern for layer\n";
|
gcode << "; end pressure advance pattern for layer\n";
|
||||||
|
|
||||||
CustomGCode::Item item;
|
CustomGCode::Item item;
|
||||||
@@ -519,21 +556,50 @@ CustomGCode::Info CalibPressureAdvancePattern::generate_gcodes()
|
|||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DynamicPrintConfig CalibPressureAdvancePattern::pattern_config() const
|
||||||
|
{
|
||||||
|
DynamicPrintConfig updated_config(m_initial_config);
|
||||||
|
updated_config.apply(m_model.objects[0]->volumes[0]->config.get(), true);
|
||||||
|
|
||||||
|
return updated_config;
|
||||||
|
}
|
||||||
|
|
||||||
|
GCodeWriter CalibPressureAdvancePattern::pattern_writer() const
|
||||||
|
{
|
||||||
|
PrintConfig print_config;
|
||||||
|
print_config.apply(pattern_config(), true);
|
||||||
|
|
||||||
|
GCodeWriter writer;
|
||||||
|
writer.apply_print_config(print_config);
|
||||||
|
|
||||||
|
writer.set_xy_offset(m_origin(0), m_origin(1));
|
||||||
|
|
||||||
|
writer.set_is_bbl_machine(m_is_bbl_machine);
|
||||||
|
|
||||||
|
const unsigned int extruder_id = m_model.objects.front()->volumes.front()->extruder_id();
|
||||||
|
writer.set_extruders({ extruder_id });
|
||||||
|
writer.set_extruder(extruder_id);
|
||||||
|
|
||||||
|
return writer;
|
||||||
|
}
|
||||||
|
|
||||||
std::string CalibPressureAdvancePattern::draw_line(Vec2d to_pt, DrawLineOptArgs opt_args)
|
std::string CalibPressureAdvancePattern::draw_line(Vec2d to_pt, DrawLineOptArgs opt_args)
|
||||||
{
|
{
|
||||||
std::stringstream gcode;
|
const DynamicPrintConfig& config = pattern_config();
|
||||||
|
|
||||||
const double e_per_mm = CalibPressureAdvance::e_per_mm(
|
const double e_per_mm = CalibPressureAdvance::e_per_mm(
|
||||||
opt_args.line_width,
|
opt_args.line_width,
|
||||||
opt_args.height,
|
opt_args.height,
|
||||||
m_config.filament_diameter.get_at(0),
|
config.option<ConfigOptionFloats>("filament_diameter")->get_at(0),
|
||||||
m_config.filament_flow_ratio.get_at(0)
|
config.option<ConfigOptionFloats>("filament_flow_ratio")->get_at(0)
|
||||||
);
|
);
|
||||||
|
|
||||||
const double length = get_distance(Vec2d(m_last_pos.x(), m_last_pos.y()), to_pt);
|
const double length = get_distance(Vec2d(m_last_pos.x(), m_last_pos.y()), to_pt);
|
||||||
auto dE = e_per_mm * length;
|
auto dE = e_per_mm * length;
|
||||||
|
|
||||||
gcode << m_writer.extrude_to_xy(to_pt, dE, opt_args.comment);
|
std::stringstream gcode;
|
||||||
|
|
||||||
|
gcode << pattern_writer().extrude_to_xy(to_pt, dE, opt_args.comment);
|
||||||
|
|
||||||
m_last_pos = Vec3d(to_pt.x(), to_pt.y(), 0);
|
m_last_pos = Vec3d(to_pt.x(), to_pt.y(), 0);
|
||||||
|
|
||||||
@@ -562,7 +628,9 @@ std::string CalibPressureAdvancePattern::draw_box(double min_x, double min_y, do
|
|||||||
|
|
||||||
opt_args.num_perimeters = std::min(opt_args.num_perimeters, max_perimeters);
|
opt_args.num_perimeters = std::min(opt_args.num_perimeters, max_perimeters);
|
||||||
|
|
||||||
gcode << move_to(Vec2d(min_x, min_y), m_writer, "Move to box start");
|
const GCodeWriter& writer = pattern_writer();
|
||||||
|
|
||||||
|
gcode << move_to(Vec2d(min_x, min_y), writer, "Move to box start");
|
||||||
|
|
||||||
DrawLineOptArgs line_opt_args(m_pattern_settings);
|
DrawLineOptArgs line_opt_args(m_pattern_settings);
|
||||||
line_opt_args.height = opt_args.height;
|
line_opt_args.height = opt_args.height;
|
||||||
@@ -573,7 +641,7 @@ std::string CalibPressureAdvancePattern::draw_box(double min_x, double min_y, do
|
|||||||
if (i != 0) { // after first perimeter, step inwards to start next perimeter
|
if (i != 0) { // after first perimeter, step inwards to start next perimeter
|
||||||
x += spacing;
|
x += spacing;
|
||||||
y += spacing;
|
y += spacing;
|
||||||
gcode << move_to(Vec2d(x, y), m_writer, "Step inwards to print next perimeter");
|
gcode << move_to(Vec2d(x, y), writer, "Step inwards to print next perimeter");
|
||||||
}
|
}
|
||||||
|
|
||||||
y += size_y - i * spacing * 2;
|
y += size_y - i * spacing * 2;
|
||||||
@@ -617,14 +685,14 @@ std::string CalibPressureAdvancePattern::draw_box(double min_x, double min_y, do
|
|||||||
x = x_min_bound;
|
x = x_min_bound;
|
||||||
y = y_min_bound;
|
y = y_min_bound;
|
||||||
|
|
||||||
gcode << move_to(Vec2d(x, y), m_writer, "Move to fill start");
|
gcode << move_to(Vec2d(x, y), writer, "Move to fill start");
|
||||||
|
|
||||||
for (int i = 0; i < x_count + y_count + (x_remainder + y_remainder >= spacing_45 ? 1 : 0); ++i) { // this isn't the most robust way, but less expensive than finding line intersections
|
for (int i = 0; i < x_count + y_count + (x_remainder + y_remainder >= spacing_45 ? 1 : 0); ++i) { // this isn't the most robust way, but less expensive than finding line intersections
|
||||||
if (i < std::min(x_count, y_count)) {
|
if (i < std::min(x_count, y_count)) {
|
||||||
if (i % 2 == 0) {
|
if (i % 2 == 0) {
|
||||||
x += spacing_45;
|
x += spacing_45;
|
||||||
y = y_min_bound;
|
y = y_min_bound;
|
||||||
gcode << move_to(Vec2d(x, y), m_writer, "Fill: Step right");
|
gcode << move_to(Vec2d(x, y), writer, "Fill: Step right");
|
||||||
|
|
||||||
y += x - x_min_bound;
|
y += x - x_min_bound;
|
||||||
x = x_min_bound;
|
x = x_min_bound;
|
||||||
@@ -633,7 +701,7 @@ std::string CalibPressureAdvancePattern::draw_box(double min_x, double min_y, do
|
|||||||
} else {
|
} else {
|
||||||
y += spacing_45;
|
y += spacing_45;
|
||||||
x = x_min_bound;
|
x = x_min_bound;
|
||||||
gcode << move_to(Vec2d(x, y), m_writer, "Fill: Step up");
|
gcode << move_to(Vec2d(x, y), writer, "Fill: Step up");
|
||||||
|
|
||||||
x += y - y_min_bound;
|
x += y - y_min_bound;
|
||||||
y = y_min_bound;
|
y = y_min_bound;
|
||||||
@@ -646,7 +714,7 @@ std::string CalibPressureAdvancePattern::draw_box(double min_x, double min_y, do
|
|||||||
if (i % 2 == 0) {
|
if (i % 2 == 0) {
|
||||||
x += spacing_45;
|
x += spacing_45;
|
||||||
y = y_min_bound;
|
y = y_min_bound;
|
||||||
gcode << move_to(Vec2d(x, y), m_writer, "Fill: Step right");
|
gcode << move_to(Vec2d(x, y), writer, "Fill: Step right");
|
||||||
|
|
||||||
x -= y_max_bound - y_min_bound;
|
x -= y_max_bound - y_min_bound;
|
||||||
y = y_max_bound;
|
y = y_max_bound;
|
||||||
@@ -660,7 +728,7 @@ std::string CalibPressureAdvancePattern::draw_box(double min_x, double min_y, do
|
|||||||
x += spacing_45;
|
x += spacing_45;
|
||||||
}
|
}
|
||||||
y = y_max_bound;
|
y = y_max_bound;
|
||||||
gcode << move_to(Vec2d(x, y), m_writer, "Fill: Step right");
|
gcode << move_to(Vec2d(x, y), writer, "Fill: Step right");
|
||||||
|
|
||||||
x += y_max_bound - y_min_bound;
|
x += y_max_bound - y_min_bound;
|
||||||
y = y_min_bound;
|
y = y_min_bound;
|
||||||
@@ -677,7 +745,7 @@ std::string CalibPressureAdvancePattern::draw_box(double min_x, double min_y, do
|
|||||||
} else {
|
} else {
|
||||||
y += spacing_45;
|
y += spacing_45;
|
||||||
}
|
}
|
||||||
gcode << move_to(Vec2d(x, y), m_writer, "Fill: Step up");
|
gcode << move_to(Vec2d(x, y), writer, "Fill: Step up");
|
||||||
|
|
||||||
x = x_min_bound;
|
x = x_min_bound;
|
||||||
y += x_max_bound - x_min_bound;
|
y += x_max_bound - x_min_bound;
|
||||||
@@ -686,7 +754,7 @@ std::string CalibPressureAdvancePattern::draw_box(double min_x, double min_y, do
|
|||||||
} else {
|
} else {
|
||||||
x = x_min_bound;
|
x = x_min_bound;
|
||||||
y += spacing_45;
|
y += spacing_45;
|
||||||
gcode << move_to(Vec2d(x, y), m_writer, "Fill: Step up");
|
gcode << move_to(Vec2d(x, y), writer, "Fill: Step up");
|
||||||
|
|
||||||
x = x_max_bound;
|
x = x_max_bound;
|
||||||
y -= x_max_bound - x_min_bound;
|
y -= x_max_bound - x_min_bound;
|
||||||
@@ -702,7 +770,7 @@ std::string CalibPressureAdvancePattern::draw_box(double min_x, double min_y, do
|
|||||||
} else {
|
} else {
|
||||||
y += spacing_45;
|
y += spacing_45;
|
||||||
}
|
}
|
||||||
gcode << move_to(Vec2d(x, y), m_writer, "Fill: Step up");
|
gcode << move_to(Vec2d(x, y), writer, "Fill: Step up");
|
||||||
|
|
||||||
x -= y_max_bound - y;
|
x -= y_max_bound - y;
|
||||||
y = y_max_bound;
|
y = y_max_bound;
|
||||||
@@ -715,7 +783,7 @@ std::string CalibPressureAdvancePattern::draw_box(double min_x, double min_y, do
|
|||||||
x += spacing_45;
|
x += spacing_45;
|
||||||
}
|
}
|
||||||
y = y_max_bound;
|
y = y_max_bound;
|
||||||
gcode << move_to(Vec2d(x, y), m_writer, "Fill: Step right");
|
gcode << move_to(Vec2d(x, y), writer, "Fill: Step right");
|
||||||
|
|
||||||
y -= x_max_bound - x;
|
y -= x_max_bound - x;
|
||||||
x = x_max_bound;
|
x = x_max_bound;
|
||||||
|
|||||||
@@ -1,13 +1,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#define calib_pressure_advance_dd
|
#define calib_pressure_advance_dd
|
||||||
|
|
||||||
#include <string>
|
#include "GCode.hpp"
|
||||||
#include "CustomGCode.hpp"
|
|
||||||
#include "GCodeWriter.hpp"
|
#include "GCodeWriter.hpp"
|
||||||
#include "PrintConfig.hpp"
|
#include "PrintConfig.hpp"
|
||||||
namespace Slic3r {
|
|
||||||
|
|
||||||
class GCode;
|
namespace Slic3r {
|
||||||
|
|
||||||
enum class CalibMode : int {
|
enum class CalibMode : int {
|
||||||
Calib_None = 0,
|
Calib_None = 0,
|
||||||
@@ -41,7 +39,7 @@ protected:
|
|||||||
virtual bool is_delta() const =0;
|
virtual bool is_delta() const =0;
|
||||||
void delta_scale_bed_ext(BoundingBoxf& bed_ext) const { bed_ext.scale(1.0f / 1.41421f); }
|
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());
|
std::string move_to(Vec2d pt, GCodeWriter writer, std::string comment = std::string());
|
||||||
double e_per_mm(
|
double e_per_mm(
|
||||||
double line_width,
|
double line_width,
|
||||||
double layer_height,
|
double layer_height,
|
||||||
@@ -98,8 +96,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
double& line_width() { return m_line_width; };
|
double& line_width() { return m_line_width; };
|
||||||
bool is_delta() const;
|
bool is_delta() const;
|
||||||
bool& draw_numbers() { return m_draw_numbers; }
|
bool& draw_numbers() { return m_draw_numbers; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string print_pa_lines(double start_x, double start_y, double start_pa, double step_pa, int num);
|
std::string print_pa_lines(double start_x, double start_y, double start_pa, double step_pa, int num);
|
||||||
@@ -122,7 +120,7 @@ friend struct DrawLineOptArgs;
|
|||||||
friend struct DrawBoxOptArgs;
|
friend struct DrawBoxOptArgs;
|
||||||
private:
|
private:
|
||||||
PatternSettings() { };
|
PatternSettings() { };
|
||||||
PatternSettings(const CalibPressureAdvancePattern* cpap);
|
PatternSettings(const CalibPressureAdvancePattern& cpap);
|
||||||
|
|
||||||
PatternSettings& operator= (const PatternSettings& rhs) =default;
|
PatternSettings& operator= (const PatternSettings& rhs) =default;
|
||||||
|
|
||||||
@@ -173,36 +171,25 @@ friend struct PatternSettings;
|
|||||||
public:
|
public:
|
||||||
CalibPressureAdvancePattern(
|
CalibPressureAdvancePattern(
|
||||||
const Calib_Params& params,
|
const Calib_Params& params,
|
||||||
const PrintConfig& config,
|
Model& model,
|
||||||
GCodeWriter& writer
|
DynamicPrintConfig& config,
|
||||||
) :
|
const bool& is_bbl_machine,
|
||||||
CalibPressureAdvance(),
|
const Vec3d& origin
|
||||||
m_params(params),
|
);
|
||||||
m_config(config),
|
|
||||||
m_writer(writer)
|
|
||||||
{
|
|
||||||
this->m_nozzle_diameter = config.nozzle_diameter.get_at(0);
|
|
||||||
this->m_height_layer = 0.2;
|
|
||||||
this->m_draw_digit_mode = DrawDigitMode::Bottom_To_Top;
|
|
||||||
this->m_line_width = line_width();
|
|
||||||
|
|
||||||
this->m_pattern_settings = PatternSettings(this);
|
|
||||||
};
|
|
||||||
// ~CalibPressureAdvancePattern() { }; TODO
|
|
||||||
|
|
||||||
bool is_delta() const
|
bool is_delta() const
|
||||||
{
|
{
|
||||||
return m_config.printable_area.values.size() > 4;
|
return pattern_config().option<ConfigOptionPoints>("printable_area")->values.size() > 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
double handle_xy_size() { return m_handle_xy_size; };
|
double handle_xy_size() const { return m_handle_xy_size; };
|
||||||
|
|
||||||
double height_first_layer() const { return m_height_first_layer; };
|
double height_first_layer() const { return m_height_first_layer; };
|
||||||
double height_layer() const { return m_height_layer; };
|
double height_layer() const { return m_height_layer; };
|
||||||
double max_layer_z() { return m_height_first_layer + ((m_num_layers - 1) * m_height_layer); };
|
double max_layer_z() const { return m_height_first_layer + ((m_num_layers - 1) * m_height_layer); };
|
||||||
|
|
||||||
void starting_point(Vec3d pt);
|
void starting_point(Vec3d pt);
|
||||||
void translate_starting_point(const Vec3d displacement);
|
void translate_starting_point(Vec3d displacement);
|
||||||
|
|
||||||
CustomGCode::Info generate_gcodes();
|
CustomGCode::Info generate_gcodes();
|
||||||
protected:
|
protected:
|
||||||
@@ -214,6 +201,9 @@ protected:
|
|||||||
int anchor_perimeters() const { return m_anchor_perimeters; };
|
int anchor_perimeters() const { return m_anchor_perimeters; };
|
||||||
double encroachment() const { return m_encroachment; };
|
double encroachment() const { return m_encroachment; };
|
||||||
private:
|
private:
|
||||||
|
DynamicPrintConfig pattern_config() const;
|
||||||
|
GCodeWriter pattern_writer() const; // travel_to and extrude_to require a non-const GCodeWriter
|
||||||
|
|
||||||
const int get_num_patterns() const
|
const int get_num_patterns() const
|
||||||
{
|
{
|
||||||
return std::ceil((m_params.end - m_params.start) / m_params.step + 1);
|
return std::ceil((m_params.end - m_params.start) / m_params.step + 1);
|
||||||
|
|||||||
@@ -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 number_extruders = wxGetApp().is_editor() ?
|
||||||
(unsigned int)print->extruders().size() :
|
(unsigned int)print->extruders().size() :
|
||||||
m_canvas->get_gcode_extruders_count();
|
m_canvas->get_gcode_extruders_count();
|
||||||
std::vector<Item> gcodes = wxGetApp().is_editor() ?
|
std::vector<CustomGCode::Item> gcodes = wxGetApp().is_editor() ?
|
||||||
//BBS
|
//BBS
|
||||||
wxGetApp().plater()->model().get_curr_plate_custom_gcodes().gcodes :
|
wxGetApp().plater()->model().get_curr_plate_custom_gcodes().gcodes :
|
||||||
m_canvas->get_custom_gcode_per_print_z();
|
m_canvas->get_custom_gcode_per_print_z();
|
||||||
|
|||||||
@@ -8131,22 +8131,14 @@ void Plater::_calib_pa_pattern(const Calib_Params& params)
|
|||||||
changed_objects({ 0 });
|
changed_objects({ 0 });
|
||||||
_calib_pa_select_added_objects();
|
_calib_pa_select_added_objects();
|
||||||
|
|
||||||
Print* print = p->background_process.fff_print();
|
DynamicPrintConfig full_config = wxGetApp().preset_bundle->full_config();
|
||||||
print->apply(this->model(), wxGetApp().preset_bundle->full_config());
|
PresetBundle* preset_bundle = wxGetApp().preset_bundle;
|
||||||
|
|
||||||
GCodeWriter writer;
|
|
||||||
const Vec3d origin = print->get_plate_origin();
|
|
||||||
writer.set_xy_offset(origin(0), origin(1));
|
|
||||||
writer.set_is_bbl_machine(print->is_BBL_printer()); // TODO: make sure this is correctly set!
|
|
||||||
writer.apply_print_config(print->config());
|
|
||||||
|
|
||||||
writer.set_extruders({0});
|
|
||||||
writer.set_extruder(0);
|
|
||||||
|
|
||||||
CalibPressureAdvancePattern pa_pattern(
|
CalibPressureAdvancePattern pa_pattern(
|
||||||
params,
|
params,
|
||||||
print->config(),
|
model(),
|
||||||
writer
|
full_config,
|
||||||
|
preset_bundle->printers.get_edited_preset().is_bbl_vendor_preset(preset_bundle),
|
||||||
|
fff_print().get_plate_origin()
|
||||||
);
|
);
|
||||||
|
|
||||||
GizmoObjectManipulation& giz_obj_manip = p->view3D->get_canvas3d()->
|
GizmoObjectManipulation& giz_obj_manip = p->view3D->get_canvas3d()->
|
||||||
|
|||||||
Reference in New Issue
Block a user