mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-06-14 07:52:56 +00:00
Make pattern actually move with handle
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include "calib.hpp"
|
||||
#include "BoundingBox.hpp"
|
||||
#include "Model.hpp"
|
||||
|
||||
namespace Slic3r {
|
||||
@@ -376,11 +377,21 @@ CalibPressureAdvancePattern::CalibPressureAdvancePattern(
|
||||
this->m_draw_digit_mode = DrawDigitMode::Bottom_To_Top;
|
||||
};
|
||||
|
||||
void CalibPressureAdvancePattern::starting_point(Vec3d pt, Model& model)
|
||||
void CalibPressureAdvancePattern::starting_point(const Model& model)
|
||||
{
|
||||
ModelObject* obj = model.objects.front();
|
||||
BoundingBoxf3 bbox =
|
||||
obj->instance_bounding_box(
|
||||
*obj->instances.front(),
|
||||
false
|
||||
)
|
||||
;
|
||||
|
||||
Vec3d pt(bbox.min.x(), bbox.max.y(), 0);
|
||||
|
||||
m_starting_point = pt;
|
||||
|
||||
if (is_delta(model)) {
|
||||
if (m_is_delta) {
|
||||
m_starting_point.x() *= -1;
|
||||
m_starting_point.y() -= (frame_size_y() / 2);
|
||||
}
|
||||
@@ -388,12 +399,6 @@ void CalibPressureAdvancePattern::starting_point(Vec3d pt, Model& model)
|
||||
m_last_pos = m_starting_point;
|
||||
}
|
||||
|
||||
void CalibPressureAdvancePattern::translate_starting_point(const Vec3d displacement)
|
||||
{
|
||||
m_starting_point += displacement;
|
||||
m_last_pos = m_starting_point;
|
||||
};
|
||||
|
||||
void CalibPressureAdvancePattern::generate_gcodes(Model& model)
|
||||
{
|
||||
std::stringstream gcode;
|
||||
@@ -558,6 +563,10 @@ DynamicPrintConfig CalibPressureAdvancePattern::pattern_config(const Model& mode
|
||||
updated_config.apply(model.objects.front()->config.get(), true);
|
||||
updated_config.apply(model.objects.front()->volumes.front()->config.get(), true);
|
||||
|
||||
m_is_delta = (updated_config.option<ConfigOptionPoints>("printable_area")->values.size() > 4);
|
||||
|
||||
starting_point(model);
|
||||
|
||||
m_nozzle_diameter = updated_config.option<ConfigOptionFloats>("nozzle_diameter")->values[0];
|
||||
m_line_width = line_width();
|
||||
m_pattern_settings = PatternSettings(*this);
|
||||
|
||||
@@ -178,8 +178,7 @@ public:
|
||||
double height_layer() const { return 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, Model& model);
|
||||
void translate_starting_point(Vec3d displacement);
|
||||
void starting_point(const Model& model);
|
||||
|
||||
void generate_gcodes(Model& model);
|
||||
protected:
|
||||
@@ -191,11 +190,6 @@ protected:
|
||||
int anchor_perimeters() const { return m_anchor_perimeters; };
|
||||
double encroachment() const { return m_encroachment; };
|
||||
private:
|
||||
bool is_delta(Model& model)
|
||||
{
|
||||
return pattern_config(model).option<ConfigOptionPoints>("printable_area")->values.size() > 4;
|
||||
}
|
||||
|
||||
DynamicPrintConfig pattern_config(const Model& model);
|
||||
GCodeWriter pattern_writer(const Model& model); // travel_to and extrude_to require a non-const GCodeWriter
|
||||
|
||||
@@ -245,6 +239,7 @@ private:
|
||||
const bool& m_is_bbl_machine;
|
||||
const Vec3d& m_origin;
|
||||
|
||||
bool m_is_delta;
|
||||
Vec3d m_starting_point;
|
||||
|
||||
PatternSettings m_pattern_settings;
|
||||
|
||||
@@ -8155,14 +8155,6 @@ void Plater::_calib_pa_pattern(const Calib_Params& params)
|
||||
);
|
||||
center_selection();
|
||||
|
||||
BoundingBoxf3 bbox;
|
||||
for (const ModelObject* obj : model().objects) {
|
||||
for (size_t i = 0; i < obj->instances.size(); ++i) {
|
||||
bbox.merge(obj->instance_bounding_box(i, false));
|
||||
}
|
||||
}
|
||||
pa_pattern.starting_point(Vec3d(bbox.min.x(), bbox.max.y(), 0), model());
|
||||
|
||||
DynamicPrintConfig* print_config = &wxGetApp().preset_bundle->prints.get_edited_preset().config;
|
||||
DynamicPrintConfig* printerConfig = &wxGetApp().preset_bundle->printers.get_edited_preset().config;
|
||||
DynamicPrintConfig* filament_config = &wxGetApp().preset_bundle->filaments.get_edited_preset().config;
|
||||
|
||||
@@ -916,10 +916,6 @@ void Selection::translate(const Vec3d& displacement, bool local)
|
||||
synchronize_unselected_volumes();
|
||||
#endif // !DISABLE_INSTANCES_SYNCH
|
||||
|
||||
if (m_model->calib_pa_pattern) {
|
||||
m_model->calib_pa_pattern->translate_starting_point(displacement);
|
||||
}
|
||||
|
||||
ensure_not_below_bed();
|
||||
set_bounding_boxes_dirty();
|
||||
wxGetApp().plater()->canvas3D()->requires_check_outside_state();
|
||||
|
||||
Reference in New Issue
Block a user