mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-15 17:55:56 +08:00
Prepare arrange for variable bed distance
This commit is contained in:
parent
f025c9cd6f
commit
e58a15bdf8
@ -489,7 +489,7 @@ void _arrange(
|
|||||||
{
|
{
|
||||||
// Integer ceiling the min distance from the bed perimeters
|
// Integer ceiling the min distance from the bed perimeters
|
||||||
coord_t md = params.min_obj_distance;
|
coord_t md = params.min_obj_distance;
|
||||||
md = md / 2;
|
md = md / 2 - params.min_bed_distance;
|
||||||
|
|
||||||
auto corrected_bin = bin;
|
auto corrected_bin = bin;
|
||||||
sl::offset(corrected_bin, md);
|
sl::offset(corrected_bin, md);
|
||||||
|
@ -49,11 +49,11 @@ struct ArrangePolygon {
|
|||||||
coord_t inflation = 0; /// Arrange with inflated polygon
|
coord_t inflation = 0; /// Arrange with inflated polygon
|
||||||
int bed_idx{UNARRANGED}; /// To which logical bed does poly belong...
|
int bed_idx{UNARRANGED}; /// To which logical bed does poly belong...
|
||||||
int priority{0};
|
int priority{0};
|
||||||
|
|
||||||
// If empty, any rotation is allowed (currently unsupported)
|
// If empty, any rotation is allowed (currently unsupported)
|
||||||
// If only a zero is there, no rotation is allowed
|
// If only a zero is there, no rotation is allowed
|
||||||
std::vector<double> allowed_rotations = {0.};
|
std::vector<double> allowed_rotations = {0.};
|
||||||
|
|
||||||
/// Optional setter function which can store arbitrary data in its closure
|
/// Optional setter function which can store arbitrary data in its closure
|
||||||
std::function<void(const ArrangePolygon&)> setter = nullptr;
|
std::function<void(const ArrangePolygon&)> setter = nullptr;
|
||||||
|
|
||||||
@ -76,29 +76,32 @@ struct ArrangePolygon {
|
|||||||
using ArrangePolygons = std::vector<ArrangePolygon>;
|
using ArrangePolygons = std::vector<ArrangePolygon>;
|
||||||
|
|
||||||
struct ArrangeParams {
|
struct ArrangeParams {
|
||||||
|
|
||||||
/// The minimum distance which is allowed for any
|
/// The minimum distance which is allowed for any
|
||||||
/// pair of items on the print bed in any direction.
|
/// pair of items on the print bed in any direction.
|
||||||
coord_t min_obj_distance = 0;
|
coord_t min_obj_distance = 0;
|
||||||
|
|
||||||
|
/// The minimum distance of any object from bed edges
|
||||||
|
coord_t min_bed_distance = 0;
|
||||||
|
|
||||||
/// The accuracy of optimization.
|
/// The accuracy of optimization.
|
||||||
/// Goes from 0.0 to 1.0 and scales performance as well
|
/// Goes from 0.0 to 1.0 and scales performance as well
|
||||||
float accuracy = 1.f;
|
float accuracy = 1.f;
|
||||||
|
|
||||||
/// Allow parallel execution.
|
/// Allow parallel execution.
|
||||||
bool parallel = true;
|
bool parallel = true;
|
||||||
|
|
||||||
bool allow_rotations = false;
|
bool allow_rotations = false;
|
||||||
|
|
||||||
/// Progress indicator callback called when an object gets packed.
|
/// Progress indicator callback called when an object gets packed.
|
||||||
/// The unsigned argument is the number of items remaining to pack.
|
/// The unsigned argument is the number of items remaining to pack.
|
||||||
std::function<void(unsigned)> progressind;
|
std::function<void(unsigned)> progressind;
|
||||||
|
|
||||||
std::function<void(const ArrangePolygon &)> on_packed;
|
std::function<void(const ArrangePolygon &)> on_packed;
|
||||||
|
|
||||||
/// A predicate returning true if abort is needed.
|
/// A predicate returning true if abort is needed.
|
||||||
std::function<bool(void)> stopcondition;
|
std::function<bool(void)> stopcondition;
|
||||||
|
|
||||||
ArrangeParams() = default;
|
ArrangeParams() = default;
|
||||||
explicit ArrangeParams(coord_t md) : min_obj_distance(md) {}
|
explicit ArrangeParams(coord_t md) : min_obj_distance(md) {}
|
||||||
};
|
};
|
||||||
|
@ -476,7 +476,8 @@ public:
|
|||||||
|
|
||||||
struct ArrangeSettings
|
struct ArrangeSettings
|
||||||
{
|
{
|
||||||
float distance = 6.;
|
float distance = 6.f;
|
||||||
|
float distance_from_bed = 0.f;
|
||||||
// float distance_seq_print = 6.; // Used when sequential print is ON
|
// float distance_seq_print = 6.; // Used when sequential print is ON
|
||||||
// float distance_sla = 6.;
|
// float distance_sla = 6.;
|
||||||
float accuracy = 0.65f; // Unused currently
|
float accuracy = 0.65f; // Unused currently
|
||||||
|
@ -286,6 +286,7 @@ arrangement::ArrangeParams get_arrange_params(Plater *p)
|
|||||||
arrangement::ArrangeParams params;
|
arrangement::ArrangeParams params;
|
||||||
params.allow_rotations = settings.enable_rotation;
|
params.allow_rotations = settings.enable_rotation;
|
||||||
params.min_obj_distance = scaled(settings.distance);
|
params.min_obj_distance = scaled(settings.distance);
|
||||||
|
params.min_bed_distance = scaled(settings.distance_from_bed);
|
||||||
|
|
||||||
return params;
|
return params;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user