diff options
author | tamasmeszaros <meszaros.q@gmail.com> | 2018-11-02 13:57:57 +0300 |
---|---|---|
committer | tamasmeszaros <meszaros.q@gmail.com> | 2018-11-02 13:57:57 +0300 |
commit | 48bc166d6d1ee257fc9f0d540ab2c349091fc900 (patch) | |
tree | 38b01f6985220e112b463313c100b5236e0dc633 /sandboxes | |
parent | 93ef2de6678d4aca9b7b507d35c5854239195643 (diff) |
Importing the SLA computing module into the native source tree.
Diffstat (limited to 'sandboxes')
-rw-r--r-- | sandboxes/CMakeLists.txt | 2 | ||||
-rw-r--r-- | sandboxes/slabasebed/CMakeLists.txt | 2 | ||||
-rw-r--r-- | sandboxes/slabasebed/slabasebed.cpp | 43 | ||||
-rw-r--r-- | sandboxes/slasupporttree/CMakeLists.txt | 2 | ||||
-rw-r--r-- | sandboxes/slasupporttree/slasupporttree.cpp | 48 |
5 files changed, 97 insertions, 0 deletions
diff --git a/sandboxes/CMakeLists.txt b/sandboxes/CMakeLists.txt new file mode 100644 index 000000000..5905c438e --- /dev/null +++ b/sandboxes/CMakeLists.txt @@ -0,0 +1,2 @@ +add_subdirectory(slabasebed) +add_subdirectory(slasupporttree) diff --git a/sandboxes/slabasebed/CMakeLists.txt b/sandboxes/slabasebed/CMakeLists.txt new file mode 100644 index 000000000..bff5ca588 --- /dev/null +++ b/sandboxes/slabasebed/CMakeLists.txt @@ -0,0 +1,2 @@ +add_executable(slabasebed EXCLUDE_FROM_ALL slabasebed.cpp) +target_link_libraries(slabasebed libslic3r)
\ No newline at end of file diff --git a/sandboxes/slabasebed/slabasebed.cpp b/sandboxes/slabasebed/slabasebed.cpp new file mode 100644 index 000000000..255ce2cc3 --- /dev/null +++ b/sandboxes/slabasebed/slabasebed.cpp @@ -0,0 +1,43 @@ +#include <iostream> +#include <string> + +#include <libslic3r.h> +#include "TriangleMesh.hpp" +#include "SLABasePool.hpp" +#include "benchmark.h" + +const std::string USAGE_STR = { + "Usage: slabasebed stlfilename.stl" +}; + +int main(const int argc, const char *argv[]) { + using namespace Slic3r; + using std::cout; using std::endl; + + if(argc < 2) { + cout << USAGE_STR << endl; + return EXIT_SUCCESS; + } + + TriangleMesh model; + Benchmark bench; + + model.ReadSTLFile(argv[1]); + model.align_to_origin(); + + ExPolygons ground_slice; + TriangleMesh basepool; + + sla::ground_layer(model, ground_slice, 0.1f); + + bench.start(); + sla::create_base_pool(ground_slice, basepool); + bench.stop(); + + cout << "Base pool creation time: " << std::setprecision(10) + << bench.getElapsedSec() << " seconds." << endl; + + basepool.write_ascii("out.stl"); + + return EXIT_SUCCESS; +} diff --git a/sandboxes/slasupporttree/CMakeLists.txt b/sandboxes/slasupporttree/CMakeLists.txt new file mode 100644 index 000000000..a3323a83d --- /dev/null +++ b/sandboxes/slasupporttree/CMakeLists.txt @@ -0,0 +1,2 @@ +add_executable(slasupporttree EXCLUDE_FROM_ALL slasupporttree.cpp) +target_link_libraries(slasupporttree libslic3r)
\ No newline at end of file diff --git a/sandboxes/slasupporttree/slasupporttree.cpp b/sandboxes/slasupporttree/slasupporttree.cpp new file mode 100644 index 000000000..0cfc60f7a --- /dev/null +++ b/sandboxes/slasupporttree/slasupporttree.cpp @@ -0,0 +1,48 @@ +#include <iostream> +#include <string> + +#include <libslic3r.h> +#include "TriangleMesh.hpp" +#include "Model.hpp" +#include "callback.hpp" +#include "SLA/SLASupportTree.hpp" +#include "benchmark.h" + +const std::string USAGE_STR = { + "Usage: slasupporttree stlfilename.stl" +}; + +void confess_at(const char * /*file*/, + int /*line*/, + const char * /*func*/, + const char * /*pat*/, + ...) {} + +namespace Slic3r { + +void PerlCallback::deregister_callback() {} +} + +int main(const int argc, const char *argv[]) { + using namespace Slic3r; + using std::cout; using std::endl; + + if(argc < 2) { + cout << USAGE_STR << endl; + return EXIT_SUCCESS; + } + + Benchmark bench; + TriangleMesh result; + + bench.start(); + sla::create_head(result, 3, 1, 4); + bench.stop(); + + cout << "Support tree creation time: " << std::setprecision(10) + << bench.getElapsedSec() << " seconds." << endl; + + result.write_ascii("out.stl"); + + return EXIT_SUCCESS; +} |