mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-07-24 01:24:25 +08:00
External files for tests are no longer needed, everything is moved as text to the source.
This commit is contained in:
parent
d1afa5b5d8
commit
dc7ea52d88
@ -37,10 +37,12 @@ namespace Sequential
|
||||
/*----------------------------------------------------------------*/
|
||||
|
||||
|
||||
bool find_and_remove(std::string& src, const std::string& key)
|
||||
bool find_and_remove(std::string &src, const std::string &key)
|
||||
{
|
||||
size_t pos = src.find(key);
|
||||
if (pos != std::string::npos) {
|
||||
|
||||
if (pos != std::string::npos)
|
||||
{
|
||||
src.erase(pos, key.length());
|
||||
return true;
|
||||
}
|
||||
@ -48,17 +50,37 @@ bool find_and_remove(std::string& src, const std::string& key)
|
||||
}
|
||||
|
||||
|
||||
std::vector<ObjectToPrint> load_exported_data(const std::string& filename)
|
||||
std::vector<ObjectToPrint> load_exported_data_from_file(const std::string &filename)
|
||||
{
|
||||
std::ifstream in(filename);
|
||||
|
||||
if (!in)
|
||||
{
|
||||
throw std::runtime_error("NO EXPORTED FILE WAS FOUND");
|
||||
}
|
||||
|
||||
return load_exported_data_from_stream(in);
|
||||
}
|
||||
|
||||
|
||||
std::vector<ObjectToPrint> load_exported_data_from_text(const std::string &data_text)
|
||||
{
|
||||
std::istringstream iss(data_text);
|
||||
|
||||
return load_exported_data_from_stream(iss);
|
||||
}
|
||||
|
||||
|
||||
std::vector<ObjectToPrint> load_exported_data_from_stream(std::istream &data_stream)
|
||||
{
|
||||
std::vector<ObjectToPrint> objects_to_print;
|
||||
|
||||
std::ifstream in(filename);
|
||||
if (!in)
|
||||
throw std::runtime_error("NO EXPORTED FILE WAS FOUND");
|
||||
std::string line;
|
||||
|
||||
while (in) {
|
||||
std::getline(in, line);
|
||||
while (data_stream)
|
||||
{
|
||||
std::getline(data_stream, line);
|
||||
|
||||
if (find_and_remove(line, "OBJECT_ID")) {
|
||||
objects_to_print.push_back(ObjectToPrint());
|
||||
objects_to_print.back().id = std::stoi(line);
|
||||
@ -83,20 +105,38 @@ std::vector<ObjectToPrint> load_exported_data(const std::string& filename)
|
||||
}
|
||||
}
|
||||
return objects_to_print;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int load_printer_geometry(const std::string& filename, PrinterGeometry &printer_geometry)
|
||||
int load_printer_geometry_from_file(const std::string &filename, PrinterGeometry &printer_geometry)
|
||||
{
|
||||
std::ifstream in(filename);
|
||||
if (!in)
|
||||
throw std::runtime_error("NO PRINTER GEOMETRY FILE WAS FOUND");
|
||||
std::string line;
|
||||
|
||||
Polygon *current_polygon = NULL;
|
||||
|
||||
while (in) {
|
||||
std::getline(in, line);
|
||||
if (!in)
|
||||
{
|
||||
throw std::runtime_error("NO PRINTER GEOMETRY FILE WAS FOUND");
|
||||
}
|
||||
|
||||
return load_printer_geometry_from_stream(in, printer_geometry);
|
||||
}
|
||||
|
||||
|
||||
int load_printer_geometry_from_text(const std::string &geometry_text, PrinterGeometry &printer_geometry)
|
||||
{
|
||||
std::istringstream iss(geometry_text);
|
||||
|
||||
return load_printer_geometry_from_stream(iss, printer_geometry);
|
||||
}
|
||||
|
||||
|
||||
int load_printer_geometry_from_stream(std::istream &geometry_stream, PrinterGeometry &printer_geometry)
|
||||
{
|
||||
Polygon *current_polygon = NULL;
|
||||
std::string line;
|
||||
|
||||
while (geometry_stream)
|
||||
{
|
||||
std::getline(geometry_stream, line);
|
||||
|
||||
if (find_and_remove(line, "POLYGON_AT_HEIGHT"))
|
||||
{
|
||||
@ -167,19 +207,21 @@ int load_printer_geometry(const std::string& filename, PrinterGeometry &printer_
|
||||
printer_geometry.y_size = y_size;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void save_import_data(const std::string &filename,
|
||||
const std::map<double, int> &scheduled_polygons,
|
||||
const map<int, int> &original_index_map,
|
||||
const vector<Rational> &poly_positions_X,
|
||||
const vector<Rational> &poly_positions_Y)
|
||||
|
||||
void save_import_data_to_file(const std::string &filename,
|
||||
const std::map<double, int> &scheduled_polygons,
|
||||
const map<int, int> &original_index_map,
|
||||
const vector<Rational> &poly_positions_X,
|
||||
const vector<Rational> &poly_positions_Y)
|
||||
{
|
||||
std::ofstream out(filename);
|
||||
if (!out)
|
||||
{
|
||||
throw std::runtime_error("CANNOT CREATE IMPORT FILE");
|
||||
}
|
||||
|
||||
for (const auto& scheduled_polygon: scheduled_polygons)
|
||||
{
|
||||
@ -191,7 +233,6 @@ void save_import_data(const std::string &filename,
|
||||
Y);
|
||||
const auto& original_index = original_index_map.find(scheduled_polygon.second);
|
||||
|
||||
// out << original_index_map[scheduled_polygon.second] << " " << X << " " << Y << endl;
|
||||
out << original_index->second << " " << X << " " << Y << endl;
|
||||
}
|
||||
}
|
||||
|
@ -25,16 +25,21 @@ namespace Sequential
|
||||
{
|
||||
|
||||
|
||||
bool find_and_remove(std::string& src, const std::string& key);
|
||||
std::vector<ObjectToPrint> load_exported_data(const std::string& filename);
|
||||
bool find_and_remove(std::string &src, const std::string &key);
|
||||
|
||||
int load_printer_geometry(const std::string& filename, PrinterGeometry &printer_geometry);
|
||||
std::vector<ObjectToPrint> load_exported_data_from_file(const std::string &filename);
|
||||
std::vector<ObjectToPrint> load_exported_data_from_text(const std::string &data_text);
|
||||
std::vector<ObjectToPrint> load_exported_data_from_stream(std::istream &data_stream);
|
||||
|
||||
int load_printer_geometry_from_file(const std::string& filename, PrinterGeometry &printer_geometry);
|
||||
int load_printer_geometry_from_text(const std::string& geometry_text, PrinterGeometry &printer_geometry);
|
||||
int load_printer_geometry_from_stream(std::istream& geometry_stream, PrinterGeometry &printer_geometry);
|
||||
|
||||
void save_import_data(const std::string &filename,
|
||||
const std::map<double, int> &scheduled_polygons,
|
||||
const map<int, int> &original_index_map,
|
||||
const vector<Rational> &poly_positions_X,
|
||||
const vector<Rational> &poly_positions_Y);
|
||||
void save_import_data_to_file(const std::string &filename,
|
||||
const std::map<double, int> &scheduled_polygons,
|
||||
const map<int, int> &original_index_map,
|
||||
const vector<Rational> &poly_positions_X,
|
||||
const vector<Rational> &poly_positions_Y);
|
||||
|
||||
|
||||
/*----------------------------------------------------------------*/
|
||||
|
@ -169,7 +169,7 @@ int decimate_Polygons(const CommandParameters &command_parameters)
|
||||
start = clock();
|
||||
|
||||
SolverConfiguration solver_configuration;
|
||||
std::vector<ObjectToPrint> objects_to_print = load_exported_data(command_parameters.input_filename);
|
||||
std::vector<ObjectToPrint> objects_to_print = load_exported_data_from_file(command_parameters.input_filename);
|
||||
|
||||
std::vector<Slic3r::Polygon> decimated_polygons;
|
||||
std::vector<std::vector<Slic3r::Polygon> > unreachable_polygons;
|
||||
|
@ -195,7 +195,7 @@ int solve_SequentialPrint(const CommandParameters &command_parameters)
|
||||
if (!command_parameters.printer_filename.empty())
|
||||
{
|
||||
printf(" Loading printer geometry ...\n");
|
||||
int result = load_printer_geometry(command_parameters.printer_filename, printer_geometry);
|
||||
int result = load_printer_geometry_from_file(command_parameters.printer_filename, printer_geometry);
|
||||
|
||||
if (result != 0)
|
||||
{
|
||||
@ -206,7 +206,7 @@ int solve_SequentialPrint(const CommandParameters &command_parameters)
|
||||
printf(" Loading printer geometry ... finished\n");
|
||||
}
|
||||
|
||||
std::vector<ObjectToPrint> objects_to_print = load_exported_data(command_parameters.input_filename);
|
||||
std::vector<ObjectToPrint> objects_to_print = load_exported_data_from_file(command_parameters.input_filename);
|
||||
|
||||
std::vector<Slic3r::Polygon> polygons;
|
||||
std::vector<std::vector<Slic3r::Polygon> > unreachable_polygons;
|
||||
@ -459,11 +459,11 @@ int solve_SequentialPrint(const CommandParameters &command_parameters)
|
||||
+ command_parameters.output_filename.substr(suffix_position, command_parameters.output_filename.length());
|
||||
}
|
||||
|
||||
save_import_data(output_filename,
|
||||
scheduled_polygons,
|
||||
original_index_map,
|
||||
poly_positions_X,
|
||||
poly_positions_Y);
|
||||
save_import_data_to_file(output_filename,
|
||||
scheduled_polygons,
|
||||
original_index_map,
|
||||
poly_positions_X,
|
||||
poly_positions_Y);
|
||||
|
||||
string svg_filename;
|
||||
|
||||
|
@ -40,6 +40,386 @@ using namespace Sequential;
|
||||
|
||||
/*----------------------------------------------------------------*/
|
||||
|
||||
const std::string arrange_data_export_text = "OBJECT_ID131\n\
|
||||
TOTAL_HEIGHT62265434\n\
|
||||
POLYGON_AT_HEIGHT0\n\
|
||||
POINT-21000000 -16000000\n\
|
||||
POINT21000000 -16000000\n\
|
||||
POINT21000000 12000000\n\
|
||||
POINT17000000 16000000\n\
|
||||
POINT-17000000 16000000\n\
|
||||
POINT-21000000 12000000\n\
|
||||
POLYGON_AT_HEIGHT2000000\n\
|
||||
POINT-21000000 -16000000\n\
|
||||
POINT21000000 -16000000\n\
|
||||
POINT21000000 12000000\n\
|
||||
POINT17000000 16000000\n\
|
||||
POINT-17000000 16000000\n\
|
||||
POINT-21000000 12000000\n\
|
||||
POLYGON_AT_HEIGHT18000000\n\
|
||||
POINT-21000000 -16000000\n\
|
||||
POINT21000000 -16000000\n\
|
||||
POINT21000000 4000000\n\
|
||||
POINT-21000000 4000000\n\
|
||||
POLYGON_AT_HEIGHT26000000\n\
|
||||
POINT-21000000 -16000000\n\
|
||||
POINT21000000 -16000000\n\
|
||||
POINT21000000 4000000\n\
|
||||
POINT-21000000 4000000\n\
|
||||
OBJECT_ID66\n\
|
||||
TOTAL_HEIGHT10000000\n\
|
||||
POLYGON_AT_HEIGHT0\n\
|
||||
POINT-21000000 -16000000\n\
|
||||
POINT21000000 -16000000\n\
|
||||
POINT21000000 12000000\n\
|
||||
POINT17000000 16000000\n\
|
||||
POINT-17000000 16000000\n\
|
||||
POINT-21000000 12000000\n\
|
||||
POLYGON_AT_HEIGHT2000000\n\
|
||||
POINT-21000000 -16000000\n\
|
||||
POINT21000000 -16000000\n\
|
||||
POINT21000000 4000000\n\
|
||||
POINT-21000000 4000000\n\
|
||||
POLYGON_AT_HEIGHT18000000\n\
|
||||
POLYGON_AT_HEIGHT26000000\n\
|
||||
OBJECT_ID44\n\
|
||||
TOTAL_HEIGHT10000000\n\
|
||||
POLYGON_AT_HEIGHT0\n\
|
||||
POINT-21000000 -16000000\n\
|
||||
POINT21000000 -16000000\n\
|
||||
POINT21000000 11999992\n\
|
||||
POINT17000000 15999992\n\
|
||||
POINT-17000000 15999992\n\
|
||||
POINT-21000000 11999992\n\
|
||||
POLYGON_AT_HEIGHT2000000\n\
|
||||
POINT-21000000 -16000000\n\
|
||||
POINT21000000 -16000000\n\
|
||||
POINT21000000 3999992\n\
|
||||
POINT-21000000 3999992\n\
|
||||
POLYGON_AT_HEIGHT18000000\n\
|
||||
POLYGON_AT_HEIGHT26000000\n\
|
||||
OBJECT_ID88\n\
|
||||
TOTAL_HEIGHT10000000\n\
|
||||
POLYGON_AT_HEIGHT0\n\
|
||||
POINT-21000000 -16000000\n\
|
||||
POINT21000000 -16000000\n\
|
||||
POINT21000000 12000000\n\
|
||||
POINT17000000 16000000\n\
|
||||
POINT-17000000 16000000\n\
|
||||
POINT-21000000 12000000\n\
|
||||
POLYGON_AT_HEIGHT2000000\n\
|
||||
POINT-21000000 -16000000\n\
|
||||
POINT21000000 -16000000\n\
|
||||
POINT21000000 4000000\n\
|
||||
POINT-21000000 4000000\n\
|
||||
POLYGON_AT_HEIGHT18000000\n\
|
||||
POLYGON_AT_HEIGHT26000000\n\
|
||||
OBJECT_ID77\n\
|
||||
TOTAL_HEIGHT10000000\n\
|
||||
POLYGON_AT_HEIGHT0\n\
|
||||
POINT-21000000 -16000000\n\
|
||||
POINT21000000 -16000000\n\
|
||||
POINT21000000 12000008\n\
|
||||
POINT17000000 16000008\n\
|
||||
POINT-17000000 16000008\n\
|
||||
POINT-21000000 12000008\n\
|
||||
POLYGON_AT_HEIGHT2000000\n\
|
||||
POINT-21000000 -16000000\n\
|
||||
POINT21000000 -16000000\n\
|
||||
POINT21000000 4000000\n\
|
||||
POINT-21000000 4000000\n\
|
||||
POLYGON_AT_HEIGHT18000000\n\
|
||||
POLYGON_AT_HEIGHT26000000\n\
|
||||
OBJECT_ID120\n\
|
||||
TOTAL_HEIGHT62265434\n\
|
||||
POLYGON_AT_HEIGHT0\n\
|
||||
POINT-21000000 -15999992\n\
|
||||
POINT21000000 -15999992\n\
|
||||
POINT21000000 12000000\n\
|
||||
POINT17000000 16000000\n\
|
||||
POINT-17000000 16000000\n\
|
||||
POINT-21000000 12000000\n\
|
||||
POLYGON_AT_HEIGHT2000000\n\
|
||||
POINT-21000000 -15999992\n\
|
||||
POINT21000000 -15999992\n\
|
||||
POINT21000000 12000000\n\
|
||||
POINT17000000 16000000\n\
|
||||
POINT-17000000 16000000\n\
|
||||
POINT-21000000 12000000\n\
|
||||
POLYGON_AT_HEIGHT18000000\n\
|
||||
POINT-21000000 -15999992\n\
|
||||
POINT21000000 -15999992\n\
|
||||
POINT21000000 4000000\n\
|
||||
POINT-21000000 4000000\n\
|
||||
POLYGON_AT_HEIGHT26000000\n\
|
||||
POINT-21000000 -15999992\n\
|
||||
POINT21000000 -15999992\n\
|
||||
POINT21000000 4000000\n\
|
||||
POINT-21000000 4000000\n\
|
||||
OBJECT_ID99\n\
|
||||
TOTAL_HEIGHT62265434\n\
|
||||
POLYGON_AT_HEIGHT0\n\
|
||||
POINT-21000000 -16000000\n\
|
||||
POINT21000000 -16000000\n\
|
||||
POINT21000000 12000000\n\
|
||||
POINT17000000 16000000\n\
|
||||
POINT-17000000 16000000\n\
|
||||
POINT-21000000 12000000\n\
|
||||
POLYGON_AT_HEIGHT2000000\n\
|
||||
POINT-21000000 -16000000\n\
|
||||
POINT21000000 -16000000\n\
|
||||
POINT21000000 12000000\n\
|
||||
POINT17000000 16000000\n\
|
||||
POINT-17000000 16000000\n\
|
||||
POINT-21000000 12000000\n\
|
||||
POLYGON_AT_HEIGHT18000000\n\
|
||||
POINT-21000000 -16000000\n\
|
||||
POINT21000000 -16000000\n\
|
||||
POINT21000000 4000000\n\
|
||||
POINT-21000000 4000000\n\
|
||||
POLYGON_AT_HEIGHT26000000\n\
|
||||
POINT-21000000 -16000000\n\
|
||||
POINT21000000 -16000000\n\
|
||||
POINT21000000 4000000\n\
|
||||
POINT-21000000 4000000\n\
|
||||
OBJECT_ID151\n\
|
||||
TOTAL_HEIGHT62265434\n\
|
||||
POLYGON_AT_HEIGHT0\n\
|
||||
POINT-21000000 -16000000\n\
|
||||
POINT21000000 -16000000\n\
|
||||
POINT21000000 12000000\n\
|
||||
POINT17000000 16000000\n\
|
||||
POINT-17000000 16000000\n\
|
||||
POINT-21000000 12000000\n\
|
||||
POLYGON_AT_HEIGHT2000000\n\
|
||||
POINT-21000000 -16000000\n\
|
||||
POINT21000000 -16000000\n\
|
||||
POINT21000000 12000000\n\
|
||||
POINT17000000 16000000\n\
|
||||
POINT-17000000 16000000\n\
|
||||
POINT-21000000 12000000\n\
|
||||
POLYGON_AT_HEIGHT18000000\n\
|
||||
POINT-21000000 -16000000\n\
|
||||
POINT21000000 -16000000\n\
|
||||
POINT21000000 4000000\n\
|
||||
POINT-21000000 4000000\n\
|
||||
POLYGON_AT_HEIGHT26000000\n\
|
||||
POINT-21000000 -16000000\n\
|
||||
POINT21000000 -16000000\n\
|
||||
POINT21000000 4000000\n\
|
||||
POINT-21000000 4000000\n\
|
||||
OBJECT_ID162\n\
|
||||
TOTAL_HEIGHT62265434\n\
|
||||
POLYGON_AT_HEIGHT0\n\
|
||||
POINT-30189590 -16000000\n\
|
||||
POINT30189576 -16000000\n\
|
||||
POINT30189576 12000000\n\
|
||||
POINT24439178 16000000\n\
|
||||
POINT-24439194 16000000\n\
|
||||
POINT-30189590 12000000\n\
|
||||
POLYGON_AT_HEIGHT2000000\n\
|
||||
POINT-30189590 -16000000\n\
|
||||
POINT30189576 -16000000\n\
|
||||
POINT30189576 12000000\n\
|
||||
POINT26286238 14715178\n\
|
||||
POINT24439178 16000000\n\
|
||||
POINT-24439194 16000000\n\
|
||||
POINT-28342532 13284822\n\
|
||||
POINT-30189590 12000000\n\
|
||||
POLYGON_AT_HEIGHT18000000\n\
|
||||
POINT-30189590 -16000000\n\
|
||||
POINT30189576 -16000000\n\
|
||||
POINT30189576 4000000\n\
|
||||
POINT-30189590 4000000\n\
|
||||
POLYGON_AT_HEIGHT26000000\n\
|
||||
POINT-30189590 -16000000\n\
|
||||
POINT30189576 -16000000\n\
|
||||
POINT30189576 4000000\n\
|
||||
POINT-30189590 4000000\n\
|
||||
OBJECT_ID192\n\
|
||||
TOTAL_HEIGHT62265434\n\
|
||||
POLYGON_AT_HEIGHT0\n\
|
||||
POINT-21000000 -16000000\n\
|
||||
POINT21000000 -16000000\n\
|
||||
POINT21000000 12000000\n\
|
||||
POINT17000000 16000000\n\
|
||||
POINT-17000000 16000000\n\
|
||||
POINT-21000000 12000000\n\
|
||||
POLYGON_AT_HEIGHT2000000\n\
|
||||
POINT-21000000 -16000000\n\
|
||||
POINT21000000 -16000000\n\
|
||||
POINT21000000 12000000\n\
|
||||
POINT17000000 16000000\n\
|
||||
POINT-17000000 16000000\n\
|
||||
POINT-21000000 12000000\n\
|
||||
POLYGON_AT_HEIGHT18000000\n\
|
||||
POINT-21000000 -16000000\n\
|
||||
POINT21000000 -16000000\n\
|
||||
POINT21000000 4000000\n\
|
||||
POINT-21000000 4000000\n\
|
||||
POLYGON_AT_HEIGHT26000000\n\
|
||||
POINT-21000000 -16000000\n\
|
||||
POINT21000000 -16000000\n\
|
||||
POINT21000000 4000000\n\
|
||||
POINT-21000000 4000000\n\
|
||||
OBJECT_ID203\n\
|
||||
TOTAL_HEIGHT62265434\n\
|
||||
POLYGON_AT_HEIGHT0\n\
|
||||
POINT-21000000 -15999999\n\
|
||||
POINT21000000 -15999999\n\
|
||||
POINT21000000 12000002\n\
|
||||
POINT17000000 16000002\n\
|
||||
POINT-17000000 16000002\n\
|
||||
POINT-21000000 12000002\n\
|
||||
POLYGON_AT_HEIGHT2000000\n\
|
||||
POINT-21000000 -15999999\n\
|
||||
POINT21000000 -15999999\n\
|
||||
POINT21000000 12000002\n\
|
||||
POINT17000000 16000002\n\
|
||||
POINT-17000000 16000002\n\
|
||||
POINT-21000000 12000002\n\
|
||||
POLYGON_AT_HEIGHT18000000\n\
|
||||
POINT-21000000 -15999999\n\
|
||||
POINT21000000 -15999999\n\
|
||||
POINT21000000 4000000\n\
|
||||
POINT-21000000 4000000\n\
|
||||
POLYGON_AT_HEIGHT26000000\n\
|
||||
POINT-21000000 -15999999\n\
|
||||
POINT21000000 -15999999\n\
|
||||
POINT21000000 4000000\n\
|
||||
POINT-21000000 4000000\n\
|
||||
OBJECT_ID223\n\
|
||||
TOTAL_HEIGHT62265434\n\
|
||||
POLYGON_AT_HEIGHT0\n\
|
||||
POINT-20999998 -16000000\n\
|
||||
POINT21000004 -16000000\n\
|
||||
POINT21000004 12000000\n\
|
||||
POINT17000004 16000000\n\
|
||||
POINT-16999998 16000000\n\
|
||||
POINT-20999998 12000000\n\
|
||||
POLYGON_AT_HEIGHT2000000\n\
|
||||
POINT-20999998 -16000000\n\
|
||||
POINT21000004 -16000000\n\
|
||||
POINT21000004 12000000\n\
|
||||
POINT17000004 16000000\n\
|
||||
POINT-16999998 16000000\n\
|
||||
POINT-20999998 12000000\n\
|
||||
POLYGON_AT_HEIGHT18000000\n\
|
||||
POINT-20999998 -16000000\n\
|
||||
POINT21000004 -16000000\n\
|
||||
POINT21000004 4000000\n\
|
||||
POINT-20999998 4000000\n\
|
||||
POLYGON_AT_HEIGHT26000000\n\
|
||||
POINT-20999998 -16000000\n\
|
||||
POINT21000004 -16000000\n\
|
||||
POINT21000004 4000000\n\
|
||||
POINT-20999998 4000000\n\
|
||||
OBJECT_ID234\n\
|
||||
TOTAL_HEIGHT62265434\n\
|
||||
POLYGON_AT_HEIGHT0\n\
|
||||
POINT-21000002 -16000000\n\
|
||||
POINT21000000 -16000000\n\
|
||||
POINT21000000 12000000\n\
|
||||
POINT17000000 16000000\n\
|
||||
POINT-17000002 16000000\n\
|
||||
POINT-21000002 12000000\n\
|
||||
POLYGON_AT_HEIGHT2000000\n\
|
||||
POINT-21000002 -16000000\n\
|
||||
POINT21000000 -16000000\n\
|
||||
POINT21000000 12000000\n\
|
||||
POINT17000000 16000000\n\
|
||||
POINT-17000002 16000000\n\
|
||||
POINT-21000002 12000000\n\
|
||||
POLYGON_AT_HEIGHT18000000\n\
|
||||
POINT-21000002 -16000000\n\
|
||||
POINT21000000 -16000000\n\
|
||||
POINT21000000 4000000\n\
|
||||
POINT-21000002 4000000\n\
|
||||
POLYGON_AT_HEIGHT26000000\n\
|
||||
POINT-21000002 -16000000\n\
|
||||
POINT21000000 -16000000\n\
|
||||
POINT21000000 4000000\n\
|
||||
POINT-21000002 4000000\n\
|
||||
";
|
||||
|
||||
const std::string printer_geometry_mk4_compatibility_text = "X_SIZE250000000\n\
|
||||
Y_SIZE210000000\n\
|
||||
CONVEX_HEIGHT0\n\
|
||||
CONVEX_HEIGHT2000000\n\
|
||||
BOX_HEIGHT18000000\n\
|
||||
BOX_HEIGHT26000000\n\
|
||||
POLYGON_AT_HEIGHT0\n\
|
||||
POINT-500000 -500000\n\
|
||||
POINT500000 -500000\n\
|
||||
POINT500000 500000\n\
|
||||
POINT-500000 500000\n\
|
||||
POLYGON_AT_HEIGHT2000000\n\
|
||||
POINT-1000000 -21000000 \n\
|
||||
POINT37000000 -21000000\n\
|
||||
POINT37000000 44000000\n\
|
||||
POINT-1000000 44000000\n\
|
||||
POLYGON_AT_HEIGHT2000000\n\
|
||||
POINT-40000000 -45000000\n\
|
||||
POINT38000000 -45000000\n\
|
||||
POINT38000000 20000000\n\
|
||||
POINT-40000000 20000000\n\
|
||||
POLYGON_AT_HEIGHT18000000\n\
|
||||
POINT-350000000 -23000000\n\
|
||||
POINT350000000 -23000000\n\
|
||||
POINT350000000 -35000000\n\
|
||||
POINT-350000000 -35000000\n\
|
||||
POLYGON_AT_HEIGHT26000000\n\
|
||||
POINT-12000000 -350000000\n\
|
||||
POINT9000000 -350000000\n\
|
||||
POINT9000000 -39000000\n\
|
||||
POINT-12000000 -39000000\n\
|
||||
POLYGON_AT_HEIGHT26000000\n\
|
||||
POINT-12000000 -350000000\n\
|
||||
POINT250000000 -350000000\n\
|
||||
POINT250000000 -82000000\n\
|
||||
POINT-12000000 -82000000\n\
|
||||
";
|
||||
|
||||
|
||||
const std::string printer_geometry_mk4_text = "X_SIZE250000000\n\
|
||||
Y_SIZE210000000\n\
|
||||
CONVEX_HEIGHT0\n\
|
||||
CONVEX_HEIGHT3000000\n\
|
||||
BOX_HEIGHT11000000\n\
|
||||
BOX_HEIGHT13000000\n\
|
||||
POLYGON_AT_HEIGHT0\n\
|
||||
POINT-500000 -500000\n\
|
||||
POINT500000 -500000\n\
|
||||
POINT500000 500000\n\
|
||||
POINT-500000 500000\n\
|
||||
POLYGON_AT_HEIGHT3000000\n\
|
||||
POINT-1000000 -21000000\n\
|
||||
POINT37000000 -21000000\n\
|
||||
POINT37000000 44000000\n\
|
||||
POINT-1000000 44000000\n\
|
||||
POLYGON_AT_HEIGHT3000000\n\
|
||||
POINT-40000000 -45000000\n\
|
||||
POINT38000000 -45000000\n\
|
||||
POINT38000000 20000000\n\
|
||||
POINT-40000000 20000000\n\
|
||||
POLYGON_AT_HEIGHT11000000\n\
|
||||
POINT-350000000 -23000000\n\
|
||||
POINT350000000 -23000000\n\
|
||||
POINT350000000 -35000000\n\
|
||||
POINT-350000000 -35000000\n\
|
||||
POLYGON_AT_HEIGHT13000000\n\
|
||||
POINT-12000000 -350000000\n\
|
||||
POINT9000000 -350000000\n\
|
||||
POINT9000000 -39000000\n\
|
||||
POINT-12000000 -39000000\n\
|
||||
POLYGON_AT_HEIGHT13000000\n\
|
||||
POINT-12000000 -350000000\n\
|
||||
POINT250000000 -350000000\n\
|
||||
POINT250000000 -82000000\n\
|
||||
POINT-12000000 -82000000\n\
|
||||
";
|
||||
|
||||
|
||||
/*
|
||||
static bool find_and_remove(std::string& src, const std::string& key)
|
||||
{
|
||||
@ -127,7 +507,7 @@ TEST_CASE("Interface test 1", "[Sequential Arrangement Interface]")
|
||||
solver_configuration.decimation_precision = SEQ_DECIMATION_PRECISION_HIGH;
|
||||
|
||||
printf("Loading objects ...\n");
|
||||
std::vector<ObjectToPrint> objects_to_print = load_exported_data("arrange_data_export.txt");
|
||||
std::vector<ObjectToPrint> objects_to_print = load_exported_data_from_text(arrange_data_export_text);
|
||||
REQUIRE(objects_to_print.size() > 0);
|
||||
printf("Loading objects ... finished\n");
|
||||
|
||||
@ -185,7 +565,7 @@ TEST_CASE("Interface test 2", "[Sequential Arrangement Interface]")
|
||||
solver_configuration.decimation_precision = SEQ_DECIMATION_PRECISION_HIGH;
|
||||
|
||||
printf("Loading objects ...\n");
|
||||
std::vector<ObjectToPrint> objects_to_print = load_exported_data("arrange_data_export.txt");
|
||||
std::vector<ObjectToPrint> objects_to_print = load_exported_data_from_text(arrange_data_export_text);
|
||||
|
||||
std::vector<std::vector<Slic3r::Polygon> > convex_unreachable_zones;
|
||||
std::vector<std::vector<Slic3r::Polygon> > box_unreachable_zones;
|
||||
@ -246,7 +626,7 @@ TEST_CASE("Interface test 3", "[Sequential Arrangement Interface]")
|
||||
start = clock();
|
||||
|
||||
PrinterGeometry printer_geometry;
|
||||
int result = load_printer_geometry("printers/printer_geometry.mk4.txt", printer_geometry);
|
||||
int result = load_printer_geometry_from_text(printer_geometry_mk4_text, printer_geometry);
|
||||
REQUIRE(result == 0);
|
||||
|
||||
if (result != 0)
|
||||
@ -257,6 +637,7 @@ TEST_CASE("Interface test 3", "[Sequential Arrangement Interface]")
|
||||
|
||||
printf("x_size: %d\n", printer_geometry.x_size);
|
||||
printf("y_size: %d\n", printer_geometry.y_size);
|
||||
|
||||
REQUIRE(printer_geometry.x_size > 0);
|
||||
REQUIRE(printer_geometry.y_size > 0);
|
||||
|
||||
@ -305,13 +686,13 @@ TEST_CASE("Interface test 4", "[Sequential Arrangement Interface]")
|
||||
solver_configuration.object_group_size = 4;
|
||||
|
||||
printf("Loading objects ...\n");
|
||||
std::vector<ObjectToPrint> objects_to_print = load_exported_data("arrange_data_export.txt");
|
||||
std::vector<ObjectToPrint> objects_to_print = load_exported_data_from_text(arrange_data_export_text);
|
||||
printf("Loading objects ... finished\n");
|
||||
|
||||
PrinterGeometry printer_geometry;
|
||||
|
||||
printf("Loading printer geometry ...\n");
|
||||
int result = load_printer_geometry("../printers/printer_geometry.mk4.compatibility.txt", printer_geometry);
|
||||
int result = load_printer_geometry_from_text(printer_geometry_mk4_compatibility_text, printer_geometry);
|
||||
|
||||
REQUIRE(result == 0);
|
||||
if (result != 0)
|
||||
@ -369,13 +750,13 @@ TEST_CASE("Interface test 5", "[Sequential Arrangement Interface]")
|
||||
solver_configuration.object_group_size = 4;
|
||||
|
||||
printf("Loading objects ...\n");
|
||||
std::vector<ObjectToPrint> objects_to_print = load_exported_data("arrange_data_export.txt");
|
||||
std::vector<ObjectToPrint> objects_to_print = load_exported_data_from_text(arrange_data_export_text);
|
||||
printf("Loading objects ... finished\n");
|
||||
|
||||
PrinterGeometry printer_geometry;
|
||||
|
||||
printf("Loading printer geometry ...\n");
|
||||
int result = load_printer_geometry("../printers/printer_geometry.mk4.compatibility.txt", printer_geometry);
|
||||
int result = load_printer_geometry_from_text(printer_geometry_mk4_compatibility_text, printer_geometry);
|
||||
|
||||
REQUIRE(result == 0);
|
||||
if (result != 0)
|
||||
@ -452,7 +833,7 @@ TEST_CASE("Interface test 6", "[Sequential Arrangement Interface]")
|
||||
solver_configuration.object_group_size = 4;
|
||||
|
||||
printf("Loading objects ...\n");
|
||||
std::vector<ObjectToPrint> objects_to_print = load_exported_data("arrange_data_export.txt");
|
||||
std::vector<ObjectToPrint> objects_to_print = load_exported_data_from_text(arrange_data_export_text);
|
||||
REQUIRE(objects_to_print.size() > 0);
|
||||
printf("Loading objects ... finished\n");
|
||||
|
||||
@ -464,7 +845,7 @@ TEST_CASE("Interface test 6", "[Sequential Arrangement Interface]")
|
||||
PrinterGeometry printer_geometry;
|
||||
|
||||
printf("Loading printer geometry ...\n");
|
||||
int result = load_printer_geometry("../printers/printer_geometry.mk4.compatibility.txt", printer_geometry);
|
||||
int result = load_printer_geometry_from_text(printer_geometry_mk4_compatibility_text, printer_geometry);
|
||||
REQUIRE(result == 0);
|
||||
if (result != 0)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user