diff --git a/resources/data/printer_gantries/geometries.txt b/resources/data/printer_gantries/geometries.txt index 749d4427a3..dabf55f65b 100644 --- a/resources/data/printer_gantries/geometries.txt +++ b/resources/data/printer_gantries/geometries.txt @@ -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", diff --git a/src/libseqarrange/src/seq_defs.hpp b/src/libseqarrange/src/seq_defs.hpp index 88104d8301..32a9b9be16 100644 --- a/src/libseqarrange/src/seq_defs.hpp +++ b/src/libseqarrange/src/seq_defs.hpp @@ -1,6 +1,6 @@ /*================================================================*/ /* - * Author: Pavel Surynek, 2023 - 2023 + * Author: Pavel Surynek, 2023 - 2025 * * File: seq_defs.h * diff --git a/src/libseqarrange/src/seq_interface.cpp b/src/libseqarrange/src/seq_interface.cpp index 9c36b5d44e..b546ab682d 100644 --- a/src/libseqarrange/src/seq_interface.cpp +++ b/src/libseqarrange/src/seq_interface.cpp @@ -1,6 +1,6 @@ /*================================================================*/ /* - * Author: Pavel Surynek, 2023 - 2024 + * Author: Pavel Surynek, 2023 - 2025 * Company: Prusa Research * * File: seq_interface.cpp @@ -185,7 +185,7 @@ bool check_ScheduledObjectsForSequentialPrintability(const SolverConfiguration std::vector > unreachable_polygons; std::map flat_index_map; - + for (unsigned int i = 0; i < objects_to_print.size(); ++i) { std::vector convex_level_polygons; @@ -219,7 +219,7 @@ bool check_ScheduledObjectsForSequentialPrintability(const SolverConfiguration unreachable_polygons.push_back(scale_down_unreachable_polygons); polygons.push_back(scale_down_object_polygon); - } + } for (const auto& scheduled_plate: scheduled_plates) { @@ -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, @@ -288,7 +289,7 @@ bool check_ScheduledObjectsForSequentialPrintability(const SolverConfiguration printf("Line check ...\n"); } #endif - + if (!check_PolygonLineIntersections(dec_values_X, dec_values_Y, dec_values_T, diff --git a/src/libseqarrange/src/seq_preprocess.cpp b/src/libseqarrange/src/seq_preprocess.cpp index d96f3960aa..df76ca69fc 100644 --- a/src/libseqarrange/src/seq_preprocess.cpp +++ b/src/libseqarrange/src/seq_preprocess.cpp @@ -1,6 +1,6 @@ /*================================================================*/ /* - * Author: Pavel Surynek, 2023 - 2024 + * Author: Pavel Surynek, 2023 - 2025 * Company: Prusa Research * * File: seq_preprocess.hpp diff --git a/src/libseqarrange/src/seq_preprocess.hpp b/src/libseqarrange/src/seq_preprocess.hpp index 9cab9a7f6d..6cd68641bd 100644 --- a/src/libseqarrange/src/seq_preprocess.hpp +++ b/src/libseqarrange/src/seq_preprocess.hpp @@ -1,6 +1,6 @@ /*================================================================*/ /* - * Author: Pavel Surynek, 2023 - 2024 + * Author: Pavel Surynek, 2023 - 2025 * Company: Prusa Research * * File: seq_preprocess.hpp diff --git a/src/libseqarrange/src/seq_sequential.cpp b/src/libseqarrange/src/seq_sequential.cpp index f4fbc926ef..1becaa9c21 100644 --- a/src/libseqarrange/src/seq_sequential.cpp +++ b/src/libseqarrange/src/seq_sequential.cpp @@ -1,6 +1,6 @@ /*================================================================*/ /* - * Author: Pavel Surynek, 2023 - 2024 + * Author: Pavel Surynek, 2023 - 2025 * Company: Prusa Research * * File: seq_sequential.cpp diff --git a/src/libseqarrange/src/seq_sequential.hpp b/src/libseqarrange/src/seq_sequential.hpp index 120e13986f..7f1701594b 100644 --- a/src/libseqarrange/src/seq_sequential.hpp +++ b/src/libseqarrange/src/seq_sequential.hpp @@ -1,6 +1,6 @@ /*================================================================*/ /* - * Author: Pavel Surynek, 2023 - 2024 + * Author: Pavel Surynek, 2023 - 2025 * Company: Prusa Research * * File: seq_sequential.hpp diff --git a/src/libseqarrange/src/seq_utilities.cpp b/src/libseqarrange/src/seq_utilities.cpp index ec43304ba5..dd46cf40eb 100644 --- a/src/libseqarrange/src/seq_utilities.cpp +++ b/src/libseqarrange/src/seq_utilities.cpp @@ -1,6 +1,6 @@ /*================================================================*/ /* - * Author: Pavel Surynek, 2023 - 2024 + * Author: Pavel Surynek, 2023 - 2025 * Company: Prusa Research * * File: seq_utilities.cpp diff --git a/src/libseqarrange/src/seq_utilities.hpp b/src/libseqarrange/src/seq_utilities.hpp index 8a453b7163..3713039462 100644 --- a/src/libseqarrange/src/seq_utilities.hpp +++ b/src/libseqarrange/src/seq_utilities.hpp @@ -1,6 +1,6 @@ /*================================================================*/ /* - * Author: Pavel Surynek, 2023 - 2024 + * Author: Pavel Surynek, 2023 - 2025 * Company: Prusa Research * * File: seq_utilities.hpp diff --git a/src/libseqarrange/src/sequential_decimator.cpp b/src/libseqarrange/src/sequential_decimator.cpp index 433249f5e8..aa787881ed 100644 --- a/src/libseqarrange/src/sequential_decimator.cpp +++ b/src/libseqarrange/src/sequential_decimator.cpp @@ -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"); } @@ -230,8 +234,10 @@ int decimate_Polygons(const CommandParameters &command_parameters) } string svg_filename = "sequential_decimator.svg"; - SVG preview_svg(svg_filename); + 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(); diff --git a/src/libseqarrange/src/sequential_decimator.hpp b/src/libseqarrange/src/sequential_decimator.hpp index 21d2949bf5..ec86021c21 100644 --- a/src/libseqarrange/src/sequential_decimator.hpp +++ b/src/libseqarrange/src/sequential_decimator.hpp @@ -1,6 +1,6 @@ /*================================================================*/ /* - * Author: Pavel Surynek, 2023 - 2024 + * Author: Pavel Surynek, 2023 - 2025 * Company: Prusa Research * * File: sequential_decimator.hpp diff --git a/src/libseqarrange/src/sequential_prusa.cpp b/src/libseqarrange/src/sequential_prusa.cpp index d91f3ccf91..5c311baec8 100644 --- a/src/libseqarrange/src/sequential_prusa.cpp +++ b/src/libseqarrange/src/sequential_prusa.cpp @@ -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() }, diff --git a/src/libseqarrange/src/sequential_prusa.hpp b/src/libseqarrange/src/sequential_prusa.hpp index 0543a98c7d..c3e82fe24d 100644 --- a/src/libseqarrange/src/sequential_prusa.hpp +++ b/src/libseqarrange/src/sequential_prusa.hpp @@ -1,6 +1,6 @@ /*================================================================*/ /* - * Author: Pavel Surynek, 2023 - 2024 + * Author: Pavel Surynek, 2023 - 2025 * Company: Prusa Research * * File: sequential_prusa.hpp diff --git a/src/libseqarrange/test/seq_test_interface.cpp b/src/libseqarrange/test/seq_test_interface.cpp index 7f9c381f61..29dc003d64 100644 --- a/src/libseqarrange/test/seq_test_interface.cpp +++ b/src/libseqarrange/test/seq_test_interface.cpp @@ -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 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 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 objects_to_print = load_exported_data_from_text(arrange_data_export_text); @@ -746,7 +756,8 @@ 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.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 objects_to_print = load_exported_data_from_text(arrange_data_export_text); @@ -832,7 +843,8 @@ 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.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 objects_to_print = load_exported_data_from_text(arrange_data_export_text); diff --git a/src/libseqarrange/test/seq_test_polygon.cpp b/src/libseqarrange/test/seq_test_polygon.cpp index 10b39fd294..93a229ffbe 100644 --- a/src/libseqarrange/test/seq_test_polygon.cpp +++ b/src/libseqarrange/test/seq_test_polygon.cpp @@ -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 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 polygons; vector 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 polygons; diff --git a/src/libseqarrange/test/seq_test_preprocess.cpp b/src/libseqarrange/test/seq_test_preprocess.cpp index f119ff69f9..873013a240 100644 --- a/src/libseqarrange/test/seq_test_preprocess.cpp +++ b/src/libseqarrange/test/seq_test_preprocess.cpp @@ -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; + + /*----------------------------------------------------------------*/ @@ -86,7 +93,8 @@ TEST_CASE("Preprocessing test 1", "[Sequential Arrangement Preprocessing]") printf("Testing preprocessing 1 ...\n"); - SolverConfiguration solver_configuration; + 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 polygons; vector unreachable_polygons; @@ -339,7 +348,9 @@ TEST_CASE("Preprocessing test 3", "[Sequential Arrangement Preprocessing]") { clock_t start, finish; - SolverConfiguration solver_configuration; + 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 polygons; std::vector > 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 polygons; std::vector > 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 polygons; std::vector > unreachable_polygons; diff --git a/src/libseqarrange/test/seq_test_sequential.cpp b/src/libseqarrange/test/seq_test_sequential.cpp index 53fa2bf531..98553ef85d 100644 --- a/src/libseqarrange/test/seq_test_sequential.cpp +++ b/src/libseqarrange/test/seq_test_sequential.cpp @@ -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 polygons; vector 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 polygons; vector > unreachable_polygons;