Revisited simplified extruder model for MK4 and code cleaning.

This commit is contained in:
surynek 2025-02-10 21:41:56 +01:00 committed by Lukas Matena
parent 531f00e6b9
commit 3efa84f744
17 changed files with 94 additions and 27 deletions

View File

@ -15,15 +15,23 @@
"height": "3",
"type": "convex",
"polygons": [
"-10,-21;37,-21;37,44;-10,44",
"-40,-45;38,-45;38,20;-40,20"
"-9,-17; 40,-17; 40,44; -9,44",
"-36,-44; 40,-44; 40,-13; -36,-13"
]
},
{
"height": "22",
"type": "convex",
"polygons": [
"-41,-45; 16,-45; 16,22; -41,22",
"11,-45; 39,-45; 39,45; 11,45"
]
},
{
"height": "11",
"type": "box",
"polygons": [
"-350,-23;350,-23;350,-35;-350,-35"
"-300,-23;300,-23;300,-35;-300,-35"
]
},
{
@ -36,8 +44,6 @@
}
]
},
{
"printer_notes_regex": ".*PRINTER_MODEL_MK4S.*",
"gantry_model_filename": "prusa3d_mk4s_gantry.stl",

View File

@ -1,6 +1,6 @@
/*================================================================*/
/*
* Author: Pavel Surynek, 2023 - 2023
* Author: Pavel Surynek, 2023 - 2025
*
* File: seq_defs.h
*

View File

@ -1,6 +1,6 @@
/*================================================================*/
/*
* Author: Pavel Surynek, 2023 - 2024
* Author: Pavel Surynek, 2023 - 2025
* Company: Prusa Research
*
* File: seq_interface.cpp
@ -269,6 +269,7 @@ bool check_ScheduledObjectsForSequentialPrintability(const SolverConfiguration
printf("Point check ...\n");
}
#endif
if (!check_PointsOutsidePolygons(dec_values_X,
dec_values_Y,
dec_values_T,

View File

@ -1,6 +1,6 @@
/*================================================================*/
/*
* Author: Pavel Surynek, 2023 - 2024
* Author: Pavel Surynek, 2023 - 2025
* Company: Prusa Research
*
* File: seq_preprocess.hpp

View File

@ -1,6 +1,6 @@
/*================================================================*/
/*
* Author: Pavel Surynek, 2023 - 2024
* Author: Pavel Surynek, 2023 - 2025
* Company: Prusa Research
*
* File: seq_preprocess.hpp

View File

@ -1,6 +1,6 @@
/*================================================================*/
/*
* Author: Pavel Surynek, 2023 - 2024
* Author: Pavel Surynek, 2023 - 2025
* Company: Prusa Research
*
* File: seq_sequential.cpp

View File

@ -1,6 +1,6 @@
/*================================================================*/
/*
* Author: Pavel Surynek, 2023 - 2024
* Author: Pavel Surynek, 2023 - 2025
* Company: Prusa Research
*
* File: seq_sequential.hpp

View File

@ -1,6 +1,6 @@
/*================================================================*/
/*
* Author: Pavel Surynek, 2023 - 2024
* Author: Pavel Surynek, 2023 - 2025
* Company: Prusa Research
*
* File: seq_utilities.cpp

View File

@ -1,6 +1,6 @@
/*================================================================*/
/*
* Author: Pavel Surynek, 2023 - 2024
* Author: Pavel Surynek, 2023 - 2025
* Company: Prusa Research
*
* File: seq_utilities.hpp

View File

@ -1,6 +1,6 @@
/*================================================================*/
/*
* Author: Pavel Surynek, 2023 - 2024
* Author: Pavel Surynek, 2023 - 2025
* Company: Prusa Research
*
* File: sequential_decimator.cpp
@ -20,6 +20,7 @@
#include "seq_version.hpp"
#include "seq_utilities.hpp"
#include "seq_interface.hpp"
#include "sequential_decimator.hpp"
@ -42,6 +43,9 @@ using namespace Sequential;
//const Point polygon_offset_3(0,-24000000); // gantry
//const Point polygon_offset_4(0,0); // nozzle
const int SEQ_PRUSA_MK3S_X_SIZE = 2500;
const int SEQ_PRUSA_MK3S_Y_SIZE = 2100;
/*----------------------------------------------------------------*/
@ -49,7 +53,7 @@ using namespace Sequential;
void print_IntroductoryMessage(void)
{
printf("----------------------------------------------------------------\n");
printf("Polygon decimation utility - build %s\n", SEQ_SEQUENTIAL_BUILD);
printf("Polygon decimation utility\n");
printf("(C) 2024 Prusa Research \n");
printf("================================================================\n");
}
@ -231,7 +235,9 @@ int decimate_Polygons(const CommandParameters &command_parameters)
string svg_filename = "sequential_decimator.svg";
SVG preview_svg(svg_filename);
solver_configuration.plate_bounding_box = BoundingBox({0,0}, {SEQ_PRUSA_MK3S_X_SIZE, SEQ_PRUSA_MK3S_Y_SIZE});
printf(" Generating output SVG ...\n");
for (unsigned int i = 0; i < decimated_polygons.size(); ++i)
{
Polygon transformed_polygon;
@ -366,7 +372,7 @@ int decimate_Polygons(const CommandParameters &command_parameters)
preview_svg.draw_outline(display_bed_polygon, "black");
preview_svg.Close();
printf(" Displaying ... finised\n");
printf(" Generating output SVG ... finised\n");
finish = clock();

View File

@ -1,6 +1,6 @@
/*================================================================*/
/*
* Author: Pavel Surynek, 2023 - 2024
* Author: Pavel Surynek, 2023 - 2025
* Company: Prusa Research
*
* File: sequential_decimator.hpp

View File

@ -1,6 +1,6 @@
/*================================================================*/
/*
* Author: Pavel Surynek, 2023 - 2024
* Author: Pavel Surynek, 2023 - 2025
* Company: Prusa Research
*
* File: sequential_prusa.cpp
@ -26,6 +26,12 @@ using namespace Slic3r;
using namespace Sequential;
/*----------------------------------------------------------------*/
const int SEQ_PRUSA_MK3S_X_SIZE = 2500;
const int SEQ_PRUSA_MK3S_Y_SIZE = 2100;
/*----------------------------------------------------------------*/
@ -692,6 +698,8 @@ int solve_SequentialPrint(const CommandParameters &command_parameters)
preview_svg.draw_text(Point(x, y), ("ID:" + std::to_string(original_index_map[decided_polygons[i]]) + " T:" + std::to_string(times_T[decided_polygons[i]].as_int64())).c_str(), text_color.c_str());
}
solver_configuration.plate_bounding_box = BoundingBox({0,0}, {SEQ_PRUSA_MK3S_X_SIZE, SEQ_PRUSA_MK3S_Y_SIZE});
Polygon plate_polygon({ { solver_configuration.plate_bounding_box.min.x(), solver_configuration.plate_bounding_box.min.y() },
{ solver_configuration.plate_bounding_box.max.x(), solver_configuration.plate_bounding_box.min.y() },
{ solver_configuration.plate_bounding_box.max.x(), solver_configuration.plate_bounding_box.max.y() },

View File

@ -1,6 +1,6 @@
/*================================================================*/
/*
* Author: Pavel Surynek, 2023 - 2024
* Author: Pavel Surynek, 2023 - 2025
* Company: Prusa Research
*
* File: sequential_prusa.hpp

View File

@ -38,6 +38,12 @@
using namespace Sequential;
/*----------------------------------------------------------------*/
const int SEQ_PRUSA_MK3S_X_SIZE = 2500;
const int SEQ_PRUSA_MK3S_Y_SIZE = 2100;
/*----------------------------------------------------------------*/
const std::string arrange_data_export_text = "OBJECT_ID131\n\
@ -505,6 +511,8 @@ TEST_CASE("Interface test 1", "[Sequential Arrangement Interface]")
SolverConfiguration solver_configuration;
solver_configuration.decimation_precision = SEQ_DECIMATION_PRECISION_HIGH;
solver_configuration.plate_bounding_box = BoundingBox({0,0}, {SEQ_PRUSA_MK3S_X_SIZE, SEQ_PRUSA_MK3S_Y_SIZE});
printf("Loading objects ...\n");
std::vector<ObjectToPrint> objects_to_print = load_exported_data_from_text(arrange_data_export_text);
@ -563,6 +571,7 @@ TEST_CASE("Interface test 2", "[Sequential Arrangement Interface]")
SolverConfiguration solver_configuration;
solver_configuration.decimation_precision = SEQ_DECIMATION_PRECISION_HIGH;
solver_configuration.plate_bounding_box = BoundingBox({0,0}, {SEQ_PRUSA_MK3S_X_SIZE, SEQ_PRUSA_MK3S_Y_SIZE});
printf("Loading objects ...\n");
std::vector<ObjectToPrint> objects_to_print = load_exported_data_from_text(arrange_data_export_text);
@ -680,6 +689,7 @@ TEST_CASE("Interface test 4", "[Sequential Arrangement Interface]")
SolverConfiguration solver_configuration;
solver_configuration.decimation_precision = SEQ_DECIMATION_PRECISION_HIGH;
solver_configuration.object_group_size = 4;
solver_configuration.plate_bounding_box = BoundingBox({0,0}, {SEQ_PRUSA_MK3S_X_SIZE, SEQ_PRUSA_MK3S_Y_SIZE});
printf("Loading objects ...\n");
std::vector<ObjectToPrint> objects_to_print = load_exported_data_from_text(arrange_data_export_text);
@ -747,6 +757,7 @@ TEST_CASE("Interface test 5", "[Sequential Arrangement Interface]")
SolverConfiguration solver_configuration;
solver_configuration.decimation_precision = SEQ_DECIMATION_PRECISION_LOW;
solver_configuration.object_group_size = 4;
solver_configuration.plate_bounding_box = BoundingBox({0,0}, {SEQ_PRUSA_MK3S_X_SIZE, SEQ_PRUSA_MK3S_Y_SIZE});
printf("Loading objects ...\n");
std::vector<ObjectToPrint> objects_to_print = load_exported_data_from_text(arrange_data_export_text);
@ -833,6 +844,7 @@ TEST_CASE("Interface test 6", "[Sequential Arrangement Interface]")
SolverConfiguration solver_configuration;
solver_configuration.decimation_precision = SEQ_DECIMATION_PRECISION_LOW;
solver_configuration.object_group_size = 4;
solver_configuration.plate_bounding_box = BoundingBox({0,0}, {SEQ_PRUSA_MK3S_X_SIZE, SEQ_PRUSA_MK3S_Y_SIZE});
printf("Loading objects ...\n");
std::vector<ObjectToPrint> objects_to_print = load_exported_data_from_text(arrange_data_export_text);

View File

@ -46,6 +46,12 @@ using namespace Sequential;
#define SCALE_FACTOR 100000
/*----------------------------------------------------------------*/
const int SEQ_PRUSA_MK3S_X_SIZE = 2500;
const int SEQ_PRUSA_MK3S_Y_SIZE = 2100;
/*----------------------------------------------------------------*/
TEST_CASE("Polygon test 1", "[Polygon]")
@ -2204,6 +2210,7 @@ TEST_CASE("Polygon test 12", "[Polygon]")
start = clock();
SolverConfiguration solver_configuration;
solver_configuration.plate_bounding_box = BoundingBox({0,0}, {SEQ_PRUSA_MK3S_X_SIZE, SEQ_PRUSA_MK3S_Y_SIZE});
z3::context z_context;
z3::expr_vector X_positions(z_context);
@ -2315,6 +2322,7 @@ TEST_CASE("Polygon test 13", "[Polygon]")
start = clock();
SolverConfiguration solver_configuration;
solver_configuration.plate_bounding_box = BoundingBox({0,0}, {SEQ_PRUSA_MK3S_X_SIZE, SEQ_PRUSA_MK3S_Y_SIZE});
z3::context z_context;
z3::expr_vector X_positions(z_context);
@ -2468,6 +2476,7 @@ TEST_CASE("Polygon test 14", "[Polygon]")
start = clock();
SolverConfiguration solver_configuration;
solver_configuration.plate_bounding_box = BoundingBox({0,0}, {SEQ_PRUSA_MK3S_X_SIZE, SEQ_PRUSA_MK3S_Y_SIZE});
vector<Polygon> polygons;
polygons.push_back(polygon_1);
@ -2720,6 +2729,7 @@ TEST_CASE("Polygon test 15", "[Polygon]")
start = clock();
SolverConfiguration solver_configuration;
solver_configuration.plate_bounding_box = BoundingBox({0,0}, {SEQ_PRUSA_MK3S_X_SIZE, SEQ_PRUSA_MK3S_Y_SIZE});
vector<Polygon> polygons;
vector<int> remaining_polygons;
@ -2907,6 +2917,7 @@ TEST_CASE("Polygon test 16", "[Polygon]")
start = clock();
SolverConfiguration solver_configuration;
solver_configuration.plate_bounding_box = BoundingBox({0,0}, {SEQ_PRUSA_MK3S_X_SIZE, SEQ_PRUSA_MK3S_Y_SIZE});
vector<Polygon> polygons;

View File

@ -48,6 +48,13 @@ using namespace Sequential;
#define SCALE_FACTOR 50000.0
/*----------------------------------------------------------------*/
const int SEQ_PRUSA_MK3S_X_SIZE = 2500;
const int SEQ_PRUSA_MK3S_Y_SIZE = 2100;
/*----------------------------------------------------------------*/
@ -87,6 +94,7 @@ TEST_CASE("Preprocessing test 1", "[Sequential Arrangement Preprocessing]")
printf("Testing preprocessing 1 ...\n");
SolverConfiguration solver_configuration;
solver_configuration.plate_bounding_box = BoundingBox({0,0}, {SEQ_PRUSA_MK3S_X_SIZE, SEQ_PRUSA_MK3S_Y_SIZE});
start = clock();
for (unsigned int i = 0; i < PRUSA_PART_POLYGONS.size(); ++i)
@ -120,6 +128,7 @@ TEST_CASE("Preprocessing test 2", "[Sequential Arrangement Preprocessing]")
start = clock();
SolverConfiguration solver_configuration;
solver_configuration.plate_bounding_box = BoundingBox({0,0}, {SEQ_PRUSA_MK3S_X_SIZE, SEQ_PRUSA_MK3S_Y_SIZE});
vector<Polygon> polygons;
vector<Polygon> unreachable_polygons;
@ -340,6 +349,8 @@ TEST_CASE("Preprocessing test 3", "[Sequential Arrangement Preprocessing]")
clock_t start, finish;
SolverConfiguration solver_configuration;
solver_configuration.plate_bounding_box = BoundingBox({0,0}, {SEQ_PRUSA_MK3S_X_SIZE, SEQ_PRUSA_MK3S_Y_SIZE});
printf("Testing preprocessing 3 ...\n");
start = clock();
@ -593,6 +604,7 @@ TEST_CASE("Preprocessing test 4", "[Sequential Arrangement Preprocessing]")
start = clock();
SolverConfiguration solver_configuration;
solver_configuration.plate_bounding_box = BoundingBox({0,0}, {SEQ_PRUSA_MK3S_X_SIZE, SEQ_PRUSA_MK3S_Y_SIZE});
std::vector<Slic3r::Polygon> polygons;
std::vector<std::vector<Slic3r::Polygon> > unreachable_polygons;
@ -827,6 +839,7 @@ TEST_CASE("Preprocessing test 5", "[Sequential Arrangement Preprocessing]")
start = clock();
SolverConfiguration solver_configuration;
solver_configuration.plate_bounding_box = BoundingBox({0,0}, {SEQ_PRUSA_MK3S_X_SIZE, SEQ_PRUSA_MK3S_Y_SIZE});
std::vector<Slic3r::Polygon> polygons;
std::vector<std::vector<Slic3r::Polygon> > unreachable_polygons;
@ -882,6 +895,7 @@ TEST_CASE("Preprocessing test 6", "[Sequential Arrangement Preprocessing]")
start = clock();
SolverConfiguration solver_configuration;
solver_configuration.plate_bounding_box = BoundingBox({0,0}, {SEQ_PRUSA_MK3S_X_SIZE, SEQ_PRUSA_MK3S_Y_SIZE});
std::vector<Slic3r::Polygon> polygons;
std::vector<std::vector<Slic3r::Polygon> > unreachable_polygons;

View File

@ -43,6 +43,13 @@ using namespace Sequential;
#define SCALE_FACTOR 100000.0
/*----------------------------------------------------------------*/
const int SEQ_PRUSA_MK3S_X_SIZE = 2500;
const int SEQ_PRUSA_MK3S_Y_SIZE = 2100;
/*----------------------------------------------------------------*/
@ -1694,6 +1701,7 @@ TEST_CASE("Sequential test 6", "[Sequential Arrangement Core]")
start = clock();
SolverConfiguration solver_configuration;
solver_configuration.plate_bounding_box = BoundingBox({0,0}, {SEQ_PRUSA_MK3S_X_SIZE, SEQ_PRUSA_MK3S_Y_SIZE});
vector<Polygon> polygons;
vector<Polygon> unreachable_polygons;
@ -1953,6 +1961,7 @@ TEST_CASE("Sequential test 7", "[Sequential Arrangement Core]")
start = clock();
SolverConfiguration solver_configuration;
solver_configuration.plate_bounding_box = BoundingBox({0,0}, {SEQ_PRUSA_MK3S_X_SIZE, SEQ_PRUSA_MK3S_Y_SIZE});
vector<Polygon> polygons;
vector<vector<Polygon> > unreachable_polygons;