mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2026-01-30 12:50:50 -07:00
* Get libslic3r tests closer to passing
I can't get geometry tests to do anything useful. I've added extra
output, but it hasn't helped me figure out why they don't work
yet. That's also probably the last broken 3mf test doesn't work.
The config tests were mostly broken because of config name changes.
The placeholder_parser tests have some things that may-or-may-not
still apply to Orca.
* Vendor a 3.x version of Catch2
Everything is surely broken at this point.
* Allow building tests separately from Orca with build_linux.sh
* Remove unnecessary log message screwing up ctest
Same solution as Prusaslicer
* Make 2 TriangleMesh methods const
Since they can be.
* Move method comment to the header where it belongsc
* Add indirectly-included header directly
Transform3d IIRC
* libslic3r tests converted to Catch2 v3
Still has 3 failing tests, but builds and runs.
* Disable 2D convex hull test and comment what I've learned
Not sure the best way to solve this yet.
* Add diff compare method for DynamicConfig
Help the unit test report errors better.
* Perl no longer used, remove comment line
* Clang-format Config.?pp
So difficult to work with ATM
* Remove cpp17 unit tests
Who gives a shit
* Don't need explicit "example" test
We have lots of tests to serve as examples.
* Leave breadcrumb to enable sla_print tests
* Fix serialization of DynamicConfig
Add comments to test, because these code paths might not be even used
anymore.
* Update run_unit_tests to run all the tests
By the time I'm done with the PR all tests will either excluded by
default or passing, so just do all.
* Update how-to-test now that build_linux.sh builds tests separately
* Update cmake regenerate instructions
Read this online; hopefully works.
* Enable slic3rutils test with Catch2 v3
* Port libnest2d and fff_print to Catch2 v3
They build. Many failing.
* Add slightly more info to Objects not fit on bed exception
* Disable failing fff_print tests from running
They're mostly failing for "objects don't fit on bed" for an
infinite-sized bed. Given infinite bed is probably only used in tests,
it probably was incidentally broken long ago.
* Must checkout tests directory in GH Actions
So we get the test data
* Missed a failing fff_print test
* Disable (most/all) broken libnest2d tests
Trying all, not checking yet though
* Fix Polygon convex/concave detection tests
Document the implementation too. Reorganize the tests to be cleaner.
* Update the test script to run tests in parallel
* Get sla_print tests to build
Probably not passing
* Don't cause full project rebuild when updating test CMakeLists.txts
* Revert "Clang-format Config.?pp"
This reverts commit 771e4c0ad2.
---------
Co-authored-by: SoftFever <softfeverever@gmail.com>
97 lines
3.1 KiB
C++
97 lines
3.1 KiB
C++
#ifndef MODELARRANGE_HPP
|
|
#define MODELARRANGE_HPP
|
|
|
|
#include <libslic3r/Arrange.hpp>
|
|
#include "libslic3r/PrintConfig.hpp"
|
|
#include "libslic3r/Model.hpp"
|
|
|
|
namespace Slic3r {
|
|
using ModelInstancePtrs = std::vector<ModelInstance*>;
|
|
|
|
using arrangement::ArrangePolygon;
|
|
using arrangement::ArrangePolygons;
|
|
using arrangement::ArrangeParams;
|
|
using arrangement::InfiniteBed;
|
|
using arrangement::CircleBed;
|
|
|
|
// Do something with ArrangePolygons in virtual beds
|
|
using VirtualBedFn = std::function<void(arrangement::ArrangePolygon&)>;
|
|
|
|
[[noreturn]] inline void throw_if_out_of_bed(arrangement::ArrangePolygon& ap)
|
|
{
|
|
throw Slic3r::RuntimeError("Objects could not fit on the bed; bed_idx==" + std::to_string(ap.bed_idx));
|
|
}
|
|
|
|
ArrangePolygons get_arrange_polys(const Model &model, ModelInstancePtrs &instances);
|
|
ArrangePolygon get_arrange_poly(const Model &model);
|
|
bool apply_arrange_polys(ArrangePolygons &polys, ModelInstancePtrs &instances, VirtualBedFn);
|
|
|
|
void duplicate(Model &model, ArrangePolygons &copies, VirtualBedFn);
|
|
void duplicate_objects(Model &model, size_t copies_num);
|
|
|
|
template<class TBed>
|
|
bool arrange_objects(Model & model,
|
|
const TBed & bed,
|
|
const ArrangeParams ¶ms,
|
|
VirtualBedFn vfn = throw_if_out_of_bed)
|
|
{
|
|
ModelInstancePtrs instances;
|
|
auto&& input = get_arrange_polys(model, instances);
|
|
arrangement::arrange(input, bed, params);
|
|
|
|
return apply_arrange_polys(input, instances, vfn);
|
|
}
|
|
|
|
template<class TBed>
|
|
void duplicate(Model & model,
|
|
size_t copies_num,
|
|
const TBed & bed,
|
|
const ArrangeParams ¶ms,
|
|
VirtualBedFn vfn = throw_if_out_of_bed)
|
|
{
|
|
ArrangePolygons copies(copies_num, get_arrange_poly(model));
|
|
arrangement::arrange(copies, bed, params);
|
|
duplicate(model, copies, vfn);
|
|
}
|
|
|
|
template<class TBed>
|
|
void duplicate_objects(Model & model,
|
|
size_t copies_num,
|
|
const TBed & bed,
|
|
const ArrangeParams ¶ms,
|
|
VirtualBedFn vfn = throw_if_out_of_bed)
|
|
{
|
|
duplicate_objects(model, copies_num);
|
|
arrange_objects(model, bed, params, vfn);
|
|
}
|
|
|
|
template<class T> struct PtrWrapper
|
|
{
|
|
T* ptr;
|
|
|
|
explicit PtrWrapper(T* p) : ptr{ p } {}
|
|
|
|
arrangement::ArrangePolygon get_arrange_polygon(const Slic3r::DynamicPrintConfig &config = Slic3r::DynamicPrintConfig()) const
|
|
{
|
|
arrangement::ArrangePolygon ap;
|
|
ptr->get_arrange_polygon(&ap, config);
|
|
return ap;
|
|
}
|
|
|
|
void apply_arrange_result(const Vec2d& t, double rot, int item_id)
|
|
{
|
|
ptr->apply_arrange_result(t, rot);
|
|
ptr->arrange_order = item_id;
|
|
}
|
|
};
|
|
|
|
template<class T>
|
|
arrangement::ArrangePolygon get_arrange_poly(T obj, const DynamicPrintConfig &config = DynamicPrintConfig());
|
|
|
|
template<>
|
|
arrangement::ArrangePolygon get_arrange_poly(ModelInstance* inst, const DynamicPrintConfig& config);
|
|
|
|
ArrangePolygon get_instance_arrange_poly(ModelInstance* instance, const DynamicPrintConfig& config);
|
|
}
|
|
|
|
#endif // MODELARRANGE_HPP
|