slabasebed.cpp 963 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #include <iostream>
  2. #include <string>
  3. #include <libslic3r/libslic3r.h>
  4. #include <libslic3r/TriangleMesh.hpp>
  5. #include <libslic3r/SLA/SLABasePool.hpp>
  6. #include <libnest2d/tools/benchmark.h>
  7. const std::string USAGE_STR = {
  8. "Usage: slabasebed stlfilename.stl"
  9. };
  10. int main(const int argc, const char *argv[]) {
  11. using namespace Slic3r;
  12. using std::cout; using std::endl;
  13. if(argc < 2) {
  14. cout << USAGE_STR << endl;
  15. return EXIT_SUCCESS;
  16. }
  17. TriangleMesh model;
  18. Benchmark bench;
  19. model.ReadSTLFile(argv[1]);
  20. model.align_to_origin();
  21. ExPolygons ground_slice;
  22. TriangleMesh basepool;
  23. sla::base_plate(model, ground_slice, 0.1f);
  24. bench.start();
  25. sla::create_base_pool(ground_slice, basepool);
  26. bench.stop();
  27. cout << "Base pool creation time: " << std::setprecision(10)
  28. << bench.getElapsedSec() << " seconds." << endl;
  29. basepool.write_ascii("out.stl");
  30. return EXIT_SUCCESS;
  31. }