mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-11 08:47:52 -06:00
Add new config values to SL1 zip file config.ini
All requested config values are written into SL1 ini file inside the zip * TIme.hpp and Time.cpp is now part of libslic3r instead of libslic3r_gui * Updated time manipulation function: separate timestamp_local_str and timestamp_utc_str * timestamp_utc_str is used in header_slic3r_generated(). Gcode now contains UTC timestamps
This commit is contained in:
parent
af77eca9df
commit
c37ec7463f
15 changed files with 273 additions and 213 deletions
|
@ -1381,9 +1381,9 @@ void SLAPrint::process()
|
|||
// Estimated printing time
|
||||
// A layers count o the highest object
|
||||
if (m_printer_input.size() == 0)
|
||||
m_print_statistics.estimated_print_time = "N/A";
|
||||
m_print_statistics.estimated_print_time = std::nan("");
|
||||
else
|
||||
m_print_statistics.estimated_print_time = get_time_dhms(float(estim_time));
|
||||
m_print_statistics.estimated_print_time = estim_time;
|
||||
|
||||
m_print_statistics.fast_layers_count = fast_layers;
|
||||
m_print_statistics.slow_layers_count = slow_layers;
|
||||
|
@ -1394,16 +1394,9 @@ void SLAPrint::process()
|
|||
// Rasterizing the model objects, and their supports
|
||||
auto rasterize = [this]() {
|
||||
if(canceled()) return;
|
||||
|
||||
{ // create a raster printer for the current print parameters
|
||||
double layerh = m_default_object_config.layer_height.getFloat();
|
||||
m_printer.reset(new sla::SLARasterWriter(m_printer_config,
|
||||
m_material_config,
|
||||
layerh));
|
||||
}
|
||||
|
||||
// Allocate space for all the layers
|
||||
sla::SLARasterWriter &printer = *m_printer;
|
||||
|
||||
// Set up the printer, allocate space for all the layers
|
||||
sla::SLARasterWriter &printer = init_printer();
|
||||
|
||||
auto lvlcnt = unsigned(m_printer_input.size());
|
||||
printer.layers(lvlcnt);
|
||||
|
@ -1422,10 +1415,12 @@ void SLAPrint::process()
|
|||
double dstatus = m_report_status.status();
|
||||
|
||||
SpinMutex slck;
|
||||
|
||||
auto orientation = get_printer_orientation();
|
||||
|
||||
// procedure to process one height level. This will run in parallel
|
||||
auto lvlfn =
|
||||
[this, &slck, &printer, increment, &dstatus, &pst]
|
||||
[this, &slck, &printer, increment, &dstatus, &pst, orientation]
|
||||
(unsigned level_id)
|
||||
{
|
||||
if(canceled()) return;
|
||||
|
@ -1436,7 +1431,7 @@ void SLAPrint::process()
|
|||
printer.begin_layer(level_id);
|
||||
|
||||
for(const ClipperLib::Polygon& poly : printlayer.transformed_slices())
|
||||
printer.draw_polygon(poly, level_id);
|
||||
printer.draw_polygon(poly, level_id, orientation);
|
||||
|
||||
// Finish the layer for later saving it.
|
||||
printer.finish_layer(level_id);
|
||||
|
@ -1464,12 +1459,18 @@ void SLAPrint::process()
|
|||
tbb::parallel_for<unsigned, decltype(lvlfn)>(0, lvlcnt, lvlfn);
|
||||
|
||||
// Set statistics values to the printer
|
||||
m_printer->set_statistics(
|
||||
{(m_print_statistics.objects_used_material
|
||||
+ m_print_statistics.support_used_material) / 1000,
|
||||
double(m_default_object_config.faded_layers.getInt()),
|
||||
double(m_print_statistics.slow_layers_count),
|
||||
double(m_print_statistics.fast_layers_count)});
|
||||
sla::SLARasterWriter::PrintStatistics stats;
|
||||
stats.used_material = (m_print_statistics.objects_used_material +
|
||||
m_print_statistics.support_used_material) /
|
||||
1000;
|
||||
|
||||
int num_fade = m_default_object_config.faded_layers.getInt();
|
||||
stats.num_fade = num_fade >= 0 ? size_t(num_fade) : size_t(0);
|
||||
stats.num_fast = m_print_statistics.fast_layers_count;
|
||||
stats.num_slow = m_print_statistics.slow_layers_count;
|
||||
stats.estimated_print_time_s = m_print_statistics.estimated_print_time;
|
||||
|
||||
m_printer->set_statistics(stats);
|
||||
};
|
||||
|
||||
using slaposFn = std::function<void(SLAPrintObject&)>;
|
||||
|
@ -1653,6 +1654,39 @@ bool SLAPrint::invalidate_state_by_config_options(const std::vector<t_config_opt
|
|||
return invalidated;
|
||||
}
|
||||
|
||||
sla::SLARasterWriter & SLAPrint::init_printer()
|
||||
{
|
||||
sla::Raster::Resolution res;
|
||||
sla::Raster::PixelDim pxdim;
|
||||
std::array<bool, 2> mirror;
|
||||
double gamma;
|
||||
|
||||
double w = m_printer_config.display_width.getFloat();
|
||||
double h = m_printer_config.display_height.getFloat();
|
||||
auto pw = size_t(m_printer_config.display_pixels_x.getInt());
|
||||
auto ph = size_t(m_printer_config.display_pixels_y.getInt());
|
||||
|
||||
mirror[X] = m_printer_config.display_mirror_x.getBool();
|
||||
mirror[Y] = m_printer_config.display_mirror_y.getBool();
|
||||
|
||||
if (get_printer_orientation() == sla::SLARasterWriter::roPortrait) {
|
||||
std::swap(w, h);
|
||||
std::swap(pw, ph);
|
||||
|
||||
// XY flipping implicitly does an X mirror
|
||||
mirror[X] = !mirror[X];
|
||||
}
|
||||
|
||||
res = sla::Raster::Resolution{pw, ph};
|
||||
pxdim = sla::Raster::PixelDim{w / pw, h / ph};
|
||||
|
||||
gamma = m_printer_config.gamma_correction.getFloat();
|
||||
|
||||
m_printer.reset(new sla::SLARasterWriter(res, pxdim, mirror, gamma));
|
||||
m_printer->set_config(m_full_print_config);
|
||||
return *m_printer;
|
||||
}
|
||||
|
||||
// Returns true if an object step is done on all objects and there's at least one object.
|
||||
bool SLAPrint::is_step_done(SLAPrintObjectStep step) const
|
||||
{
|
||||
|
@ -1932,7 +1966,7 @@ std::vector<sla::SupportPoint> SLAPrintObject::transformed_support_points() cons
|
|||
DynamicConfig SLAPrintStatistics::config() const
|
||||
{
|
||||
DynamicConfig config;
|
||||
const std::string print_time = Slic3r::short_time(this->estimated_print_time);
|
||||
const std::string print_time = Slic3r::short_time(get_time_dhms(float(this->estimated_print_time)));
|
||||
config.set_key_value("print_time", new ConfigOptionString(print_time));
|
||||
config.set_key_value("objects_used_material", new ConfigOptionFloat(this->objects_used_material));
|
||||
config.set_key_value("support_used_material", new ConfigOptionFloat(this->support_used_material));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue