mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-22 16:21:24 -06:00
Added a tooltip overlay for the variable layer height edit tool.
Short methods of PrintState made inline. Added layer height profile to a Model class.
This commit is contained in:
parent
aceb87d188
commit
43ac693900
8 changed files with 98 additions and 56 deletions
|
@ -114,6 +114,9 @@ public:
|
|||
DynamicPrintConfig config;
|
||||
// Variation of a layer thickness for spans of Z coordinates.
|
||||
t_layer_height_ranges layer_height_ranges;
|
||||
// Profile of increasing z to a layer height, to be linearly interpolated when calculating the layers.
|
||||
// The pairs of <z, layer_height> are packed into a 1D array to simplify handling by the Perl XS.
|
||||
std::vector<coordf_t> layer_height_profile;
|
||||
|
||||
/* This vector accumulates the total translation applied to the object by the
|
||||
center_around_origin() method. Callers might want to apply the same translation
|
||||
|
|
|
@ -8,43 +8,6 @@
|
|||
|
||||
namespace Slic3r {
|
||||
|
||||
template <class StepClass>
|
||||
bool
|
||||
PrintState<StepClass>::is_started(StepClass step) const
|
||||
{
|
||||
return this->started.find(step) != this->started.end();
|
||||
}
|
||||
|
||||
template <class StepClass>
|
||||
bool
|
||||
PrintState<StepClass>::is_done(StepClass step) const
|
||||
{
|
||||
return this->done.find(step) != this->done.end();
|
||||
}
|
||||
|
||||
template <class StepClass>
|
||||
void
|
||||
PrintState<StepClass>::set_started(StepClass step)
|
||||
{
|
||||
this->started.insert(step);
|
||||
}
|
||||
|
||||
template <class StepClass>
|
||||
void
|
||||
PrintState<StepClass>::set_done(StepClass step)
|
||||
{
|
||||
this->done.insert(step);
|
||||
}
|
||||
|
||||
template <class StepClass>
|
||||
bool
|
||||
PrintState<StepClass>::invalidate(StepClass step)
|
||||
{
|
||||
bool invalidated = this->started.erase(step) > 0;
|
||||
this->done.erase(step);
|
||||
return invalidated;
|
||||
}
|
||||
|
||||
template class PrintState<PrintStep>;
|
||||
template class PrintState<PrintObjectStep>;
|
||||
|
||||
|
|
|
@ -33,14 +33,18 @@ enum PrintObjectStep {
|
|||
template <class StepType>
|
||||
class PrintState
|
||||
{
|
||||
public:
|
||||
public:
|
||||
std::set<StepType> started, done;
|
||||
|
||||
bool is_started(StepType step) const;
|
||||
bool is_done(StepType step) const;
|
||||
void set_started(StepType step);
|
||||
void set_done(StepType step);
|
||||
bool invalidate(StepType step);
|
||||
bool is_started(StepType step) const { return this->started.find(step) != this->started.end(); }
|
||||
bool is_done(StepType step) const { return this->done.find(step) != this->done.end(); }
|
||||
void set_started(StepType step) { this->started.insert(step); }
|
||||
void set_done(StepType step) { this->done.insert(step); }
|
||||
bool invalidate(StepType step) {
|
||||
bool invalidated = this->started.erase(step) > 0;
|
||||
this->done.erase(step);
|
||||
return invalidated;
|
||||
}
|
||||
};
|
||||
|
||||
// A PrintRegion object represents a group of volumes to print
|
||||
|
@ -143,7 +147,7 @@ public:
|
|||
|
||||
// Process layer_height_ranges, the raft layers and first layer thickness into layer_height_profile.
|
||||
// The layer_height_profile may be later modified interactively by the user to refine layers at sloping surfaces.
|
||||
void update_layer_height_profile();
|
||||
bool update_layer_height_profile();
|
||||
|
||||
// Collect the slicing parameters, to be used by variable layer thickness algorithm,
|
||||
// by the interactive layer height editor and by the printing process itself.
|
||||
|
|
|
@ -49,6 +49,7 @@ PrintObject::PrintObject(Print* print, ModelObject* model_object, const Bounding
|
|||
|
||||
this->reload_model_instances();
|
||||
this->layer_height_ranges = model_object->layer_height_ranges;
|
||||
this->layer_height_profile = model_object->layer_height_profile;
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -949,8 +950,9 @@ SlicingParameters PrintObject::slicing_parameters() const
|
|||
unscale(this->size.z), this->print()->object_extruders());
|
||||
}
|
||||
|
||||
void PrintObject::update_layer_height_profile()
|
||||
bool PrintObject::update_layer_height_profile()
|
||||
{
|
||||
bool updated = false;
|
||||
if (this->layer_height_profile.empty()) {
|
||||
if (0)
|
||||
// if (this->layer_height_profile.empty())
|
||||
|
@ -958,7 +960,9 @@ void PrintObject::update_layer_height_profile()
|
|||
this->model_object()->volumes);
|
||||
else
|
||||
this->layer_height_profile = layer_height_profile_from_ranges(this->slicing_parameters(), this->layer_height_ranges);
|
||||
updated = true;
|
||||
}
|
||||
return updated;
|
||||
}
|
||||
|
||||
// 1) Decides Z positions of the layers,
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include <xsinit.h>
|
||||
#include "libslic3r/Model.hpp"
|
||||
#include "libslic3r/PrintConfig.hpp"
|
||||
#include "libslic3r/Slicing.hpp"
|
||||
%}
|
||||
|
||||
%name{Slic3r::Model} class Model {
|
||||
|
@ -169,6 +170,7 @@ ModelMaterial::attributes()
|
|||
void set_layer_height_ranges(t_layer_height_ranges ranges)
|
||||
%code%{ THIS->layer_height_ranges = ranges; %};
|
||||
|
||||
|
||||
Ref<Pointf3> origin_translation()
|
||||
%code%{ RETVAL = &THIS->origin_translation; %};
|
||||
void set_origin_translation(Pointf3* point)
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
%{
|
||||
#include <xsinit.h>
|
||||
#include "libslic3r/Print.hpp"
|
||||
#include "libslic3r/Slicing.hpp"
|
||||
#include "libslic3r/PlaceholderParser.hpp"
|
||||
%}
|
||||
|
||||
|
@ -121,6 +120,8 @@ _constant()
|
|||
void _infill();
|
||||
void _generate_support_material();
|
||||
|
||||
bool update_layer_height_profile();
|
||||
|
||||
void adjust_layer_height_profile(coordf_t z, coordf_t layer_thickness_delta, coordf_t band_width, int action)
|
||||
%code%{
|
||||
THIS->update_layer_height_profile();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue