mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-14 05:56:02 +08:00
Revisited simplified extruder model for MK4 and code cleaning.
This commit is contained in:
parent
531f00e6b9
commit
3efa84f744
@ -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",
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*================================================================*/
|
||||
/*
|
||||
* Author: Pavel Surynek, 2023 - 2023
|
||||
* Author: Pavel Surynek, 2023 - 2025
|
||||
*
|
||||
* File: seq_defs.h
|
||||
*
|
||||
|
@ -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<std::vector<Slic3r::Polygon> > unreachable_polygons;
|
||||
|
||||
std::map<int, int> flat_index_map;
|
||||
|
||||
|
||||
for (unsigned int i = 0; i < objects_to_print.size(); ++i)
|
||||
{
|
||||
std::vector<Slic3r::Polygon> 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,
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*================================================================*/
|
||||
/*
|
||||
* Author: Pavel Surynek, 2023 - 2024
|
||||
* Author: Pavel Surynek, 2023 - 2025
|
||||
* Company: Prusa Research
|
||||
*
|
||||
* File: seq_preprocess.hpp
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*================================================================*/
|
||||
/*
|
||||
* Author: Pavel Surynek, 2023 - 2024
|
||||
* Author: Pavel Surynek, 2023 - 2025
|
||||
* Company: Prusa Research
|
||||
*
|
||||
* File: seq_preprocess.hpp
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*================================================================*/
|
||||
/*
|
||||
* Author: Pavel Surynek, 2023 - 2024
|
||||
* Author: Pavel Surynek, 2023 - 2025
|
||||
* Company: Prusa Research
|
||||
*
|
||||
* File: seq_sequential.cpp
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*================================================================*/
|
||||
/*
|
||||
* Author: Pavel Surynek, 2023 - 2024
|
||||
* Author: Pavel Surynek, 2023 - 2025
|
||||
* Company: Prusa Research
|
||||
*
|
||||
* File: seq_sequential.hpp
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*================================================================*/
|
||||
/*
|
||||
* Author: Pavel Surynek, 2023 - 2024
|
||||
* Author: Pavel Surynek, 2023 - 2025
|
||||
* Company: Prusa Research
|
||||
*
|
||||
* File: seq_utilities.cpp
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*================================================================*/
|
||||
/*
|
||||
* Author: Pavel Surynek, 2023 - 2024
|
||||
* Author: Pavel Surynek, 2023 - 2025
|
||||
* Company: Prusa Research
|
||||
*
|
||||
* File: seq_utilities.hpp
|
||||
|
@ -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();
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*================================================================*/
|
||||
/*
|
||||
* Author: Pavel Surynek, 2023 - 2024
|
||||
* Author: Pavel Surynek, 2023 - 2025
|
||||
* Company: Prusa Research
|
||||
*
|
||||
* File: sequential_decimator.hpp
|
||||
|
@ -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() },
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*================================================================*/
|
||||
/*
|
||||
* Author: Pavel Surynek, 2023 - 2024
|
||||
* Author: Pavel Surynek, 2023 - 2025
|
||||
* Company: Prusa Research
|
||||
*
|
||||
* File: sequential_prusa.hpp
|
||||
|
@ -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);
|
||||
@ -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<ObjectToPrint> 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<ObjectToPrint> objects_to_print = load_exported_data_from_text(arrange_data_export_text);
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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<Polygon> polygons;
|
||||
vector<Polygon> 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<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;
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user