2019-12-09 14:34:48 +00:00
|
|
|
#include <iostream>
|
2020-01-16 12:20:17 +00:00
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include <libslic3r/TriangleMesh.hpp>
|
|
|
|
#include <libslic3r/Model.hpp>
|
|
|
|
#include <libslic3r/SLAPrint.hpp>
|
|
|
|
#include <libslic3r/SLAPrintSteps.hpp>
|
|
|
|
#include <libslic3r/MeshBoolean.hpp>
|
2019-12-09 14:34:48 +00:00
|
|
|
|
2020-01-16 12:20:17 +00:00
|
|
|
#include <libnest2d/tools/benchmark.h>
|
2019-12-09 14:34:48 +00:00
|
|
|
|
|
|
|
#include <boost/log/trivial.hpp>
|
|
|
|
|
|
|
|
int main(const int argc, const char * argv[])
|
|
|
|
{
|
2020-01-16 12:20:17 +00:00
|
|
|
using namespace Slic3r;
|
|
|
|
|
2020-02-05 16:39:56 +00:00
|
|
|
if (argc <= 1) {
|
|
|
|
std::cout << "Usage: meshboolean <input_file.3mf>" << std::endl;
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
2020-01-16 12:20:17 +00:00
|
|
|
|
|
|
|
|
2020-02-05 16:39:56 +00:00
|
|
|
TriangleMesh input;
|
2020-01-16 12:20:17 +00:00
|
|
|
|
2020-02-05 16:39:56 +00:00
|
|
|
input.ReadSTLFile(argv[1]);
|
|
|
|
input.repair();
|
2020-01-16 12:20:17 +00:00
|
|
|
|
|
|
|
Benchmark bench;
|
2019-12-09 14:34:48 +00:00
|
|
|
|
2020-02-05 16:39:56 +00:00
|
|
|
bench.start();
|
|
|
|
bool fckd = MeshBoolean::cgal::does_self_intersect(input);
|
|
|
|
bench.stop();
|
|
|
|
|
|
|
|
std::cout << "Self intersect test: " << fckd << " duration: " << bench.getElapsedSec() << std::endl;
|
|
|
|
|
|
|
|
bench.start();
|
|
|
|
MeshBoolean::self_union(input);
|
|
|
|
bench.stop();
|
|
|
|
|
|
|
|
std::cout << "Self union duration: " << bench.getElapsedSec() << std::endl;
|
2019-12-09 14:34:48 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|