Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
Slic3r::SLAPrint Class Reference

This class is the high level FSM for the SLA printing process. More...

#include <src/libslic3r/SLAPrint.hpp>

+ Inheritance diagram for Slic3r::SLAPrint:
+ Collaboration diagram for Slic3r::SLAPrint:

Classes

class  PrintLayer
 
class  StatusReporter
 
class  Steps
 

Public Types

using PrintStepEnum = SLAPrintStep
 
enum  ApplyStatus { APPLY_STATUS_UNCHANGED , APPLY_STATUS_CHANGED , APPLY_STATUS_INVALIDATED }
 
enum  CancelStatus { NOT_CANCELED = 0 , CANCELED_BY_USER = 1 , CANCELED_INTERNAL = 2 }
 
typedef std::function< void(const SlicingStatus &)> status_callback_type
 
typedef std::function< void()> cancel_callback_type
 
using Timestamp = uint64_t
 

Public Member Functions

 SLAPrint ()=default
 
virtual ~SLAPrint () override
 
PrinterTechnology technology () const noexcept override
 
void clear () override
 
bool empty () const override
 
std::vector< ObjectIDprint_object_ids () const override
 
ApplyStatus apply (const Model &model, DynamicPrintConfig config) override
 
void set_task (const TaskParams &params) override
 
void process () override
 
void finalize () override
 
void cleanup () override
 
bool is_step_done (SLAPrintObjectStep step) const
 
bool finished () const override
 
const PrintObjectsobjects () const
 
const SLAPrintObjectget_print_object_by_model_object_id (ObjectID object_id) const
 
const SLAPrintObjectget_object (ObjectID object_id) const
 
const SLAPrintConfigprint_config () const
 
const SLAPrinterConfigprinter_config () const
 
const SLAMaterialConfig & material_config () const
 
const SLAPrintObjectConfigdefault_object_config () const
 
Vec3d relative_correction () const
 
Transform3d sla_trafo (const ModelObject &model_object) const
 
std::string output_filename (const std::string &filename_base=std::string()) const override
 
const SLAPrintStatisticsprint_statistics () const
 
std::string validate (std::vector< std::string > *warnings=nullptr) const override
 
const std::vector< PrintLayer > & print_layers () const
 
void export_print (const std::string &fname, const std::string &projectname="")
 
void export_print (const std::string &fname, const ThumbnailsList &thumbnails, const std::string &projectname="")
 
bool is_step_done (PrintStepEnum step) const
 
PrintStateBase::StateWithTimeStamp step_state_with_timestamp (PrintStepEnum step) const
 
PrintStateBase::StateWithWarnings step_state_with_warnings (PrintStepEnum step) const
 
const Modelmodel () const
 
void set_status_default ()
 
void set_status_silent ()
 
void set_status_callback (status_callback_type cb)
 
void set_status (int percent, const std::string &message, unsigned int flags=SlicingStatus::DEFAULT)
 
void set_cancel_callback (cancel_callback_type cancel_callback)
 
CancelStatus cancel_status () const
 
bool canceled () const
 
void cancel ()
 
void cancel_internal ()
 
void restart ()
 
const PlaceholderParserplaceholder_parser () const
 
const DynamicPrintConfigfull_print_config () const
 
std::string output_filepath (const std::string &path, const std::string &filename_base=std::string()) const
 
ObjectID id () const
 
virtual Timestamp timestamp () const
 

Static Public Attributes

static constexpr const size_t PrintStepEnumSize
 

Protected Member Functions

bool set_started (PrintStepEnum step)
 
PrintStateBase::TimeStamp set_done (PrintStepEnum step)
 
bool invalidate_steps (StepTypeIterator step_begin, StepTypeIterator step_end)
 
bool invalidate_steps (std::initializer_list< PrintStepEnum > il)
 
bool invalidate_all_steps ()
 
bool is_step_started_unguarded (PrintStepEnum step) const
 
bool is_step_done_unguarded (PrintStepEnum step) const
 
void active_step_add_warning (PrintStateBase::WarningLevel warning_level, const std::string &message, int message_id=0)
 
void set_task_impl (const TaskParams &params, std::vector< PrintObject * > &print_objects)
 
void finalize_impl (std::vector< PrintObject * > &print_objects)
 
std::string output_filename (const std::string &format, const std::string &default_ext, const std::string &filename_base, const DynamicConfig *config_override=nullptr) const
 
std::mutex & state_mutex () const
 
std::function< void()> cancel_callback ()
 
void call_cancel_callback ()
 
void status_update_warnings (int step, PrintStateBase::WarningLevel warning_level, const std::string &message, const PrintObjectBase *print_object=nullptr)
 
void throw_if_canceled () const
 
PrintTryCancel make_try_cancel () const
 
void update_object_placeholders (DynamicConfig &config, const std::string &default_ext) const
 
void set_new_unique_id ()
 
void set_invalid_id ()
 
void copy_id (const ObjectBase &rhs)
 
virtual void assign_new_unique_ids_recursive ()
 

Protected Attributes

Model m_model
 
DynamicPrintConfig m_full_print_config
 
PlaceholderParser m_placeholder_parser
 
status_callback_type m_status_callback
 

Private Types

typedef PrintBaseWithState< SLAPrintStep, slapsCountInherited
 

Private Member Functions

bool invalidate_step (SLAPrintStep st)
 
bool invalidate_state_by_config_options (const std::vector< t_config_option_key > &opt_keys, bool &invalidate_all_model_objects)
 
template<class Archive >
void serialize (Archive &ar)
 

Static Private Member Functions

static ObjectID generate_new_id ()
 
template<class Archive >
static void load_and_construct (Archive &ar, cereal::construct< ObjectBase > &construct)
 

Private Attributes

SLAPrintConfig m_print_config
 
SLAPrinterConfig m_printer_config
 
SLAMaterialConfig m_material_config
 
SLAPrintObjectConfig m_default_object_config
 
PrintObjects m_objects
 
std::vector< PrintLayerm_printer_input
 
std::unique_ptr< SLAArchiveWriterm_archiver
 
SLAPrintStatistics m_print_statistics
 
class Slic3r::SLAPrint::StatusReporter m_report_status
 
friend SLAPrintObject
 
PrintState< PrintStepEnum, COUNT > m_state
 
std::atomic< CancelStatusm_cancel_status
 
cancel_callback_type m_cancel_callback = [](){}
 
std::mutex m_state_mutex
 
friend PrintTryCancel
 
ObjectID m_id
 

Static Private Attributes

static size_t s_last_id = 0
 

Detailed Description

This class is the high level FSM for the SLA printing process.

It should support the background processing framework and contain the metadata for the support geometries and their slicing. It should also dispatch the SLA printing configuration values to the appropriate calculation steps.

Member Typedef Documentation

◆ cancel_callback_type

typedef std::function<void()> Slic3r::PrintBase::cancel_callback_type
inherited

◆ Inherited

◆ PrintStepEnum

using Slic3r::PrintBaseWithState< SLAPrintStep , COUNT >::PrintStepEnum = SLAPrintStep
inherited

◆ status_callback_type

◆ Timestamp

Member Enumeration Documentation

◆ ApplyStatus

Enumerator
APPLY_STATUS_UNCHANGED 
APPLY_STATUS_CHANGED 
APPLY_STATUS_INVALIDATED 
423 {
424 // No change after the Print::apply() call.
426 // Some of the Print / PrintObject / PrintObjectInstance data was changed,
427 // but no result was invalidated (only data influencing not yet calculated results were changed).
429 // Some data was changed, which in turn invalidated already calculated steps.
431 };
@ APPLY_STATUS_UNCHANGED
Definition PrintBase.hpp:425
@ APPLY_STATUS_CHANGED
Definition PrintBase.hpp:428
@ APPLY_STATUS_INVALIDATED
Definition PrintBase.hpp:430

◆ CancelStatus

Enumerator
NOT_CANCELED 
CANCELED_BY_USER 
CANCELED_INTERNAL 
503 {
504 // No cancelation, background processing should run.
505 NOT_CANCELED = 0,
506 // Canceled by user from the user interface (user pressed the "Cancel" button or user closed the application).
508 // Canceled internally from Print::apply() through the Print/PrintObject::invalidate_step() or ::invalidate_all_steps().
510 };
@ NOT_CANCELED
Definition PrintBase.hpp:505
@ CANCELED_INTERNAL
Definition PrintBase.hpp:509
@ CANCELED_BY_USER
Definition PrintBase.hpp:507

Constructor & Destructor Documentation

◆ SLAPrint()

Slic3r::SLAPrint::SLAPrint ( )
default

◆ ~SLAPrint()

virtual Slic3r::SLAPrint::~SLAPrint ( )
inlineoverridevirtual
450{ this->clear(); }
void clear() override
Definition SLAPrint.cpp:149

Member Function Documentation

◆ active_step_add_warning()

void Slic3r::PrintBaseWithState< SLAPrintStep , COUNT >::active_step_add_warning ( PrintStateBase::WarningLevel  warning_level,
const std::string &  message,
int  message_id = 0 
)
inlineprotectedinherited
610 {
611 std::pair<PrintStepEnum, bool> active_step = m_state.active_step_add_warning(warning_level, message, message_id, this->state_mutex());
612 if (active_step.second)
613 // Update UI.
614 this->status_update_warnings(static_cast<int>(active_step.first), warning_level, message);
615 }
void status_update_warnings(int step, PrintStateBase::WarningLevel warning_level, const std::string &message, const PrintObjectBase *print_object=nullptr)
Definition PrintBase.cpp:100
std::mutex & state_mutex() const
Definition PrintBase.hpp:534
PrintState< PrintStepEnum, COUNT > m_state
Definition PrintBase.hpp:725
std::pair< StepType, bool > active_step_add_warning(PrintStateBase::WarningLevel warning_level, const std::string &message, int message_id, std::mutex &mtx)
Definition PrintBase.hpp:321

◆ apply()

SLAPrint::ApplyStatus Slic3r::SLAPrint::apply ( const Model model,
DynamicPrintConfig  config 
)
overridevirtual

Implements Slic3r::PrintBase.

201{
202#ifdef _DEBUG
204#endif /* _DEBUG */
205
206 // Normalize the config.
207 config.option("sla_print_settings_id", true);
208 config.option("sla_material_settings_id", true);
209 config.option("printer_settings_id", true);
210 config.option("physical_printer_settings_id", true);
211 // Collect changes to print config.
212 t_config_option_keys print_diff = m_print_config.diff(config);
213 t_config_option_keys printer_diff = m_printer_config.diff(config);
214 t_config_option_keys material_diff = m_material_config.diff(config);
215 t_config_option_keys object_diff = m_default_object_config.diff(config);
216 t_config_option_keys placeholder_parser_diff = m_placeholder_parser.config_diff(config);
217
218 // Do not use the ApplyStatus as we will use the max function when updating apply_status.
219 unsigned int apply_status = APPLY_STATUS_UNCHANGED;
220 auto update_apply_status = [&apply_status](bool invalidated)
221 { apply_status = std::max<unsigned int>(apply_status, invalidated ? APPLY_STATUS_INVALIDATED : APPLY_STATUS_CHANGED); };
222 if (! (print_diff.empty() && printer_diff.empty() && material_diff.empty() && object_diff.empty()))
223 update_apply_status(false);
224
225 // Grab the lock for the Print / PrintObject milestones.
226 std::scoped_lock<std::mutex> lock(this->state_mutex());
227
228 // The following call may stop the background processing.
229 bool invalidate_all_model_objects = false;
230 if (! print_diff.empty())
231 update_apply_status(this->invalidate_state_by_config_options(print_diff, invalidate_all_model_objects));
232 if (! printer_diff.empty())
233 update_apply_status(this->invalidate_state_by_config_options(printer_diff, invalidate_all_model_objects));
234 if (! material_diff.empty())
235 update_apply_status(this->invalidate_state_by_config_options(material_diff, invalidate_all_model_objects));
236
237 // Apply variables to placeholder parser. The placeholder parser is currently used
238 // only to generate the output file name.
239 if (! placeholder_parser_diff.empty()) {
240 // update_apply_status(this->invalidate_step(slapsRasterize));
242 // Set the profile aliases for the PrintBase::output_filename()
243 m_placeholder_parser.set("print_preset", config.option("sla_print_settings_id")->clone());
244 m_placeholder_parser.set("material_preset", config.option("sla_material_settings_id")->clone());
245 m_placeholder_parser.set("printer_preset", config.option("printer_settings_id")->clone());
246 m_placeholder_parser.set("physical_printer_preset", config.option("physical_printer_settings_id")->clone());
247 }
248
249 // It is also safe to change m_config now after this->invalidate_state_by_config_options() call.
250 m_print_config.apply_only(config, print_diff, true);
251 m_printer_config.apply_only(config, printer_diff, true);
252 // Handle changes to material config.
253 m_material_config.apply_only(config, material_diff, true);
254 // Handle changes to object config defaults
255 m_default_object_config.apply_only(config, object_diff, true);
256
257 if (!m_archiver || !printer_diff.empty())
258 m_archiver = SLAArchiveWriter::create(m_printer_config.sla_archive_format.value.c_str(), m_printer_config);
259
260 struct ModelObjectStatus {
261 enum Status {
262 Unknown,
263 Old,
264 New,
265 Moved,
266 Deleted,
267 };
268 ModelObjectStatus(ObjectID id, Status status = Unknown) : id(id), status(status) {}
269 ObjectID id;
270 Status status;
271 // Search by id.
272 bool operator<(const ModelObjectStatus &rhs) const { return id < rhs.id; }
273 };
274 std::set<ModelObjectStatus> model_object_status;
275
276 // 1) Synchronize model objects.
277 if (model.id() != m_model.id() || invalidate_all_model_objects) {
278 // Kill everything, initialize from scratch.
279 // Stop background processing.
280 this->call_cancel_callback();
281 update_apply_status(this->invalidate_all_steps());
282 for (SLAPrintObject *object : m_objects) {
283 model_object_status.emplace(object->model_object()->id(), ModelObjectStatus::Deleted);
284 update_apply_status(object->invalidate_all_steps());
285 delete object;
286 }
287 m_objects.clear();
288 m_model.assign_copy(model);
289 for (const ModelObject *model_object : m_model.objects)
290 model_object_status.emplace(model_object->id(), ModelObjectStatus::New);
291 } else {
293 // The object list did not change.
294 for (const ModelObject *model_object : m_model.objects)
295 model_object_status.emplace(model_object->id(), ModelObjectStatus::Old);
297 // Add new objects. Their volumes and configs will be synchronized later.
298 update_apply_status(this->invalidate_step(slapsMergeSlicesAndEval));
299 for (const ModelObject *model_object : m_model.objects)
300 model_object_status.emplace(model_object->id(), ModelObjectStatus::Old);
301 for (size_t i = m_model.objects.size(); i < model.objects.size(); ++ i) {
302 model_object_status.emplace(model.objects[i]->id(), ModelObjectStatus::New);
303 m_model.objects.emplace_back(ModelObject::new_copy(*model.objects[i]));
304 m_model.objects.back()->set_model(&m_model);
305 }
306 } else {
307 // Reorder the objects, add new objects.
308 // First stop background processing before shuffling or deleting the PrintObjects in the object list.
309 this->call_cancel_callback();
310 update_apply_status(this->invalidate_step(slapsMergeSlicesAndEval));
311 // Second create a new list of objects.
312 std::vector<ModelObject*> model_objects_old(std::move(m_model.objects));
313 m_model.objects.clear();
314 m_model.objects.reserve(model.objects.size());
315 auto by_id_lower = [](const ModelObject *lhs, const ModelObject *rhs){ return lhs->id() < rhs->id(); };
316 std::sort(model_objects_old.begin(), model_objects_old.end(), by_id_lower);
317 for (const ModelObject *mobj : model.objects) {
318 auto it = std::lower_bound(model_objects_old.begin(), model_objects_old.end(), mobj, by_id_lower);
319 if (it == model_objects_old.end() || (*it)->id() != mobj->id()) {
320 // New ModelObject added.
321 m_model.objects.emplace_back(ModelObject::new_copy(*mobj));
322 m_model.objects.back()->set_model(&m_model);
323 model_object_status.emplace(mobj->id(), ModelObjectStatus::New);
324 } else {
325 // Existing ModelObject re-added (possibly moved in the list).
326 m_model.objects.emplace_back(*it);
327 model_object_status.emplace(mobj->id(), ModelObjectStatus::Moved);
328 }
329 }
330 bool deleted_any = false;
331 for (ModelObject *&model_object : model_objects_old) {
332 if (model_object_status.find(ModelObjectStatus(model_object->id())) == model_object_status.end()) {
333 model_object_status.emplace(model_object->id(), ModelObjectStatus::Deleted);
334 deleted_any = true;
335 } else
336 // Do not delete this ModelObject instance.
337 model_object = nullptr;
338 }
339 if (deleted_any) {
340 // Delete PrintObjects of the deleted ModelObjects.
341 std::vector<SLAPrintObject*> print_objects_old = std::move(m_objects);
342 m_objects.clear();
343 m_objects.reserve(print_objects_old.size());
344 for (SLAPrintObject *print_object : print_objects_old) {
345 auto it_status = model_object_status.find(ModelObjectStatus(print_object->model_object()->id()));
346 assert(it_status != model_object_status.end());
347 if (it_status->status == ModelObjectStatus::Deleted) {
348 update_apply_status(print_object->invalidate_all_steps());
349 delete print_object;
350 } else
351 m_objects.emplace_back(print_object);
352 }
353 for (ModelObject *model_object : model_objects_old)
354 delete model_object;
355 }
356 }
357 }
358
359 // 2) Map print objects including their transformation matrices.
360 struct PrintObjectStatus {
361 enum Status {
362 Unknown,
363 Deleted,
364 Reused,
365 New
366 };
367 PrintObjectStatus(SLAPrintObject *print_object, Status status = Unknown) :
368 id(print_object->model_object()->id()),
369 print_object(print_object),
370 trafo(print_object->trafo()),
371 status(status) {}
372 PrintObjectStatus(ObjectID id) : id(id), print_object(nullptr), trafo(Transform3d::Identity()), status(Unknown) {}
373 // ID of the ModelObject & PrintObject
374 ObjectID id;
375 // Pointer to the old PrintObject
376 SLAPrintObject *print_object;
377 // Trafo generated with model_object->world_matrix(true)
378 Transform3d trafo;
379 Status status;
380 // Search by id.
381 bool operator<(const PrintObjectStatus &rhs) const { return id < rhs.id; }
382 };
383 std::multiset<PrintObjectStatus> print_object_status;
384 for (SLAPrintObject *print_object : m_objects)
385 print_object_status.emplace(PrintObjectStatus(print_object));
386
387 // 3) Synchronize ModelObjects & PrintObjects.
388 std::vector<SLAPrintObject*> print_objects_new;
389 print_objects_new.reserve(std::max(m_objects.size(), m_model.objects.size()));
390 bool new_objects = false;
391 for (size_t idx_model_object = 0; idx_model_object < model.objects.size(); ++ idx_model_object) {
392 ModelObject &model_object = *m_model.objects[idx_model_object];
393 auto it_status = model_object_status.find(ModelObjectStatus(model_object.id()));
394 assert(it_status != model_object_status.end());
395 assert(it_status->status != ModelObjectStatus::Deleted);
396 // PrintObject for this ModelObject, if it exists.
397 auto it_print_object_status = print_object_status.end();
398 if (it_status->status != ModelObjectStatus::New) {
399 // Update the ModelObject instance, possibly invalidate the linked PrintObjects.
400 assert(it_status->status == ModelObjectStatus::Old || it_status->status == ModelObjectStatus::Moved);
401 const ModelObject &model_object_new = *model.objects[idx_model_object];
402 it_print_object_status = print_object_status.lower_bound(PrintObjectStatus(model_object.id()));
403 if (it_print_object_status != print_object_status.end() && it_print_object_status->id != model_object.id())
404 it_print_object_status = print_object_status.end();
405 // Check whether a model part volume was added or removed, their transformations or order changed.
406 bool model_parts_differ =
407 model_volume_list_changed(model_object, model_object_new,
412 bool sla_trafo_differs =
413 model_object.instances.empty() != model_object_new.instances.empty() ||
414 (! model_object.instances.empty() &&
415 (! sla_trafo(model_object).isApprox(sla_trafo(model_object_new)) ||
416 model_object.instances.front()->is_left_handed() != model_object_new.instances.front()->is_left_handed()));
417 if (model_parts_differ || sla_trafo_differs) {
418 // The very first step (the slicing step) is invalidated. One may freely remove all associated PrintObjects.
419 if (it_print_object_status != print_object_status.end()) {
420 update_apply_status(it_print_object_status->print_object->invalidate_all_steps());
421 const_cast<PrintObjectStatus&>(*it_print_object_status).status = PrintObjectStatus::Deleted;
422 }
423 // Copy content of the ModelObject including its ID, do not change the parent.
424 model_object.assign_copy(model_object_new);
425 } else {
426 // Synchronize Object's config.
427 bool object_config_changed = ! model_object.config.timestamp_matches(model_object_new.config);
428 if (object_config_changed)
429 model_object.config.assign_config(model_object_new.config);
430 if (! object_diff.empty() || object_config_changed) {
432 new_config.apply(model_object.config.get(), true);
433 if (it_print_object_status != print_object_status.end()) {
434 t_config_option_keys diff = it_print_object_status->print_object->config().diff(new_config);
435 if (! diff.empty()) {
436 update_apply_status(it_print_object_status->print_object->invalidate_state_by_config_options(diff));
437 it_print_object_status->print_object->config_apply_only(new_config, diff, true);
438 }
439 }
440 }
441
442 bool old_user_modified = model_object.sla_points_status == sla::PointsStatus::UserModified;
443 bool new_user_modified = model_object_new.sla_points_status == sla::PointsStatus::UserModified;
444 if ((old_user_modified && ! new_user_modified) || // switching to automatic supports from manual supports
445 (! old_user_modified && new_user_modified) || // switching to manual supports from automatic supports
446 (new_user_modified && model_object.sla_support_points != model_object_new.sla_support_points)) {
447 if (it_print_object_status != print_object_status.end())
448 update_apply_status(it_print_object_status->print_object->invalidate_step(slaposSupportPoints));
449
450 model_object.sla_support_points = model_object_new.sla_support_points;
451 }
452 model_object.sla_points_status = model_object_new.sla_points_status;
453
454 // Invalidate hollowing if drain holes have changed
455 if (model_object.sla_drain_holes != model_object_new.sla_drain_holes)
456 {
457 model_object.sla_drain_holes = model_object_new.sla_drain_holes;
458 update_apply_status(it_print_object_status->print_object->invalidate_step(slaposDrillHoles));
459 }
460
461 // Copy the ModelObject name, input_file and instances. The instances will compared against PrintObject instances in the next step.
462 model_object.name = model_object_new.name;
463 model_object.input_file = model_object_new.input_file;
464 model_object.clear_instances();
465 model_object.instances.reserve(model_object_new.instances.size());
466 for (const ModelInstance *model_instance : model_object_new.instances) {
467 model_object.instances.emplace_back(new ModelInstance(*model_instance));
468 model_object.instances.back()->set_model_object(&model_object);
469 }
470 }
471 }
472
473 std::vector<SLAPrintObject::Instance> new_instances = sla_instances(model_object);
474 if (it_print_object_status != print_object_status.end() && it_print_object_status->status != PrintObjectStatus::Deleted) {
475 // The SLAPrintObject is already there.
476 if (new_instances.empty()) {
477 const_cast<PrintObjectStatus&>(*it_print_object_status).status = PrintObjectStatus::Deleted;
478 } else {
479 if (new_instances != it_print_object_status->print_object->instances()) {
480 // Instances changed.
481 it_print_object_status->print_object->set_instances(new_instances);
482 update_apply_status(this->invalidate_step(slapsMergeSlicesAndEval));
483 }
484 print_objects_new.emplace_back(it_print_object_status->print_object);
485 const_cast<PrintObjectStatus&>(*it_print_object_status).status = PrintObjectStatus::Reused;
486 }
487 } else if (! new_instances.empty()) {
488 auto print_object = new SLAPrintObject(this, &model_object);
489
490 // FIXME: this invalidates the transformed mesh in SLAPrintObject
491 // which is expensive to calculate (especially the raw_mesh() call)
492 print_object->set_trafo(sla_trafo(model_object), model_object.instances.front()->is_left_handed());
493
494 print_object->set_instances(std::move(new_instances));
495
496 print_object->config_apply(m_default_object_config, true);
497 print_object->config_apply(model_object.config.get(), true);
498 print_objects_new.emplace_back(print_object);
499 new_objects = true;
500 }
501 }
502
503 if (m_objects != print_objects_new) {
504 this->call_cancel_callback();
505 update_apply_status(this->invalidate_all_steps());
506 m_objects = print_objects_new;
507 // Delete the PrintObjects marked as Unknown or Deleted.
508 for (auto &pos : print_object_status)
509 if (pos.status == PrintObjectStatus::Unknown || pos.status == PrintObjectStatus::Deleted) {
510 update_apply_status(pos.print_object->invalidate_all_steps());
511 delete pos.print_object;
512 }
513 if (new_objects)
514 update_apply_status(false);
515 }
516
517 if(m_objects.empty()) {
518 m_printer_input = {};
520 }
521
522#ifdef _DEBUG
524#endif /* _DEBUG */
525
526 m_full_print_config = std::move(config);
527
528 return static_cast<ApplyStatus>(apply_status);
529}
ModelObjectPtrs objects
Definition Model.hpp:1254
ObjectID id() const
Definition ObjectID.hpp:55
bool apply_config(const DynamicPrintConfig &config)
Definition PlaceholderParser.cpp:124
void set(const std::string &key, const std::string &value)
Definition PlaceholderParser.hpp:44
std::vector< std::string > config_diff(const DynamicPrintConfig &rhs)
Definition PlaceholderParser.cpp:109
void call_cancel_callback()
Definition PrintBase.hpp:536
ApplyStatus
Definition PrintBase.hpp:423
const Model & model() const
Definition PrintBase.hpp:433
DynamicPrintConfig m_full_print_config
Definition PrintBase.hpp:554
Model m_model
Definition PrintBase.hpp:553
PlaceholderParser m_placeholder_parser
Definition PrintBase.hpp:555
bool invalidate_all_steps()
Definition PrintBase.hpp:602
static std::unique_ptr< SLAArchiveWriter > create(const std::string &archtype, const SLAPrinterConfig &)
Definition SLAArchiveWriter.cpp:7
bool invalidate_step(SLAPrintStep st)
Definition SLAPrint.cpp:613
SLAPrinterConfig m_printer_config
Definition SLAPrint.hpp:560
friend SLAPrintObject
Definition SLAPrint.hpp:589
bool invalidate_state_by_config_options(const std::vector< t_config_option_key > &opt_keys, bool &invalidate_all_model_objects)
Definition SLAPrint.cpp:733
SLAPrintConfig m_print_config
Definition SLAPrint.hpp:559
const PrintObjects & objects() const
Definition SLAPrint.hpp:468
std::unique_ptr< SLAArchiveWriter > m_archiver
Definition SLAPrint.hpp:570
PrintObjects m_objects
Definition SLAPrint.hpp:564
SLAPrintObjectConfig m_default_object_config
Definition SLAPrint.hpp:562
Transform3d sla_trafo(const ModelObject &model_object) const
Definition SLAPrint.cpp:161
std::vector< PrintLayer > m_printer_input
Definition SLAPrint.hpp:567
SLAPrintStatistics m_print_statistics
Definition SLAPrint.hpp:573
SLAMaterialConfig m_material_config
Definition SLAPrint.hpp:561
EIGEN_DEVICE_FUNC bool isApprox(const Transform &other, const typename NumTraits< Scalar >::Real &prec=NumTraits< Scalar >::dummy_precision()) const
Definition Transform.h:647
if(!(yy_init))
Definition lexer.c:1190
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bool operator<(const half &a, const half &b)
Definition Half.h:307
Vec3d pos(const Pt &p)
Definition ReprojectPointsOnMesh.hpp:14
Eigen::Transform< double, 3, Eigen::Affine, Eigen::DontAlign > Transform3d
Definition Point.hpp:81
void check_model_ids_validity(const Model &model)
Definition Model.cpp:2623
bool model_object_list_extended(const Model &model_old, const Model &model_new)
Definition Model.cpp:2481
void check_model_ids_equal(const Model &model1, const Model &model2)
Definition Model.cpp:2647
std::vector< std::string > t_config_option_keys
Definition Config.hpp:77
@ slaposSupportPoints
Definition SLAPrint.hpp:32
@ slaposDrillHoles
Definition SLAPrint.hpp:30
static std::vector< SLAPrintObject::Instance > sla_instances(const ModelObject &model_object)
Definition SLAPrint.cpp:173
SLAPrintObjectConfig
Definition PrintConfig.hpp:1111
bool model_volume_list_changed(const ModelObject &model_object_old, const ModelObject &model_object_new, TypeFilterFn type_filter)
Definition Model.cpp:2492
@ slapsMergeSlicesAndEval
Definition SLAPrint.hpp:22
bool model_object_list_equal(const Model &model_old, const Model &model_new)
Definition Model.cpp:2469
Slic3r::Polygons diff(const Slic3r::Polygon &subject, const Slic3r::Polygon &clip, ApplySafetyOffset do_safety_offset)
Definition ClipperUtils.cpp:672
@ Identity
Definition lim.h:66
@ New
Definition PrintApply.cpp:323
@ Old
Definition PrintApply.cpp:322
@ Moved
Definition PrintApply.cpp:324
@ Deleted
Definition PrintApply.cpp:325
@ Deleted
Definition PrintApply.cpp:386
@ Reused
Definition PrintApply.cpp:387

References Slic3r::PlaceholderParser::apply_config(), Slic3r::PrintBase::APPLY_STATUS_CHANGED, Slic3r::PrintBase::APPLY_STATUS_INVALIDATED, Slic3r::PrintBase::APPLY_STATUS_UNCHANGED, Slic3r::ModelConfig::assign_config(), Slic3r::PrintBase::call_cancel_callback(), Slic3r::check_model_ids_equal(), Slic3r::check_model_ids_validity(), Slic3r::ModelObject::clear_instances(), Slic3r::ConfigOption::clone(), Slic3r::ModelObject::config, Slic3r::PlaceholderParser::config_diff(), Slic3r::SLAArchiveWriter::create(), Slic3r::ModelObjectStatus::Deleted, Slic3r::PrintObjectStatus::Deleted, Slic3r::diff(), Slic3r::ModelConfig::get(), Slic3r::ObjectID::id, Slic3r::ObjectBase::id(), Slic3r::ModelObjectStatus::id, Slic3r::PrintObjectStatus::id, Slic3r::ModelObject::input_file, Slic3r::ModelObject::instances, Slic3r::PrintBaseWithState< SLAPrintStep, slapsCount >::invalidate_all_steps(), invalidate_state_by_config_options(), invalidate_step(), Eigen::Transform< _Scalar, _Dim, _Mode, _Options >::isApprox(), m_archiver, m_default_object_config, Slic3r::PrintBase::m_full_print_config, m_material_config, Slic3r::PrintBase::m_model, m_objects, Slic3r::PrintBase::m_placeholder_parser, m_print_config, m_print_statistics, m_printer_config, m_printer_input, Slic3r::PrintBase::model(), Slic3r::PrintObjectBase::model_object(), Slic3r::model_object_list_equal(), Slic3r::model_object_list_extended(), Slic3r::MODEL_PART, Slic3r::model_volume_list_changed(), Slic3r::ModelObjectStatus::Moved, Slic3r::ModelObject::name, Slic3r::NEGATIVE_VOLUME, Slic3r::ModelObjectStatus::New, Slic3r::Model::objects, Slic3r::ModelObjectStatus::Old, Slic3r::ConfigBase::option(), Slic3r::PrintObjectStatus::Reused, Slic3r::PlaceholderParser::set(), Slic3r::ModelObject::sla_drain_holes, Slic3r::sla_instances(), Slic3r::ModelObject::sla_points_status, Slic3r::ModelObject::sla_support_points, sla_trafo(), Slic3r::slaposDrillHoles, Slic3r::slaposSupportPoints, SLAPrintObject, Slic3r::SLAPrintObjectConfig, Slic3r::slapsMergeSlicesAndEval, Slic3r::PrintBase::state_mutex(), Slic3r::PrintObjectStatus::status, Slic3r::SUPPORT_BLOCKER, Slic3r::SUPPORT_ENFORCER, Slic3r::ModelConfig::timestamp_matches(), Slic3r::SLAPrintObject::trafo(), Slic3r::PrintObjectStatus::Unknown, and Slic3r::sla::UserModified.

+ Here is the call graph for this function:

◆ assign_new_unique_ids_recursive()

virtual void Slic3r::ObjectBase::assign_new_unique_ids_recursive ( )
inlineprotectedvirtualinherited

Reimplemented in Slic3r::Model, Slic3r::ModelObject, and Slic3r::ModelVolume.

79{ this->set_new_unique_id(); }
void set_new_unique_id()
Definition ObjectID.hpp:73

References Slic3r::ObjectBase::set_new_unique_id().

+ Here is the call graph for this function:

◆ call_cancel_callback()

void Slic3r::PrintBase::call_cancel_callback ( )
inlineprotectedinherited
cancel_callback_type m_cancel_callback
Definition PrintBase.hpp:564

References Slic3r::PrintBase::m_cancel_callback.

Referenced by apply(), and Slic3r::PrintBaseWithState< PrintStepEnumType, COUNT >::set_task_impl().

+ Here is the caller graph for this function:

◆ cancel()

void Slic3r::PrintBase::cancel ( )
inlineinherited
std::atomic< CancelStatus > m_cancel_status
Definition PrintBase.hpp:561

References Slic3r::PrintBase::CANCELED_BY_USER, and Slic3r::PrintBase::m_cancel_status.

Referenced by Slic3r::BackgroundSlicingProcess::stop().

+ Here is the caller graph for this function:

◆ cancel_callback()

std::function< void()> Slic3r::PrintBase::cancel_callback ( )
inlineprotectedinherited

◆ cancel_internal()

void Slic3r::PrintBase::cancel_internal ( )
inlineinherited

References Slic3r::PrintBase::CANCELED_INTERNAL, and Slic3r::PrintBase::m_cancel_status.

Referenced by Slic3r::BackgroundSlicingProcess::stop_internal().

+ Here is the caller graph for this function:

◆ cancel_status()

CancelStatus Slic3r::PrintBase::cancel_status ( ) const
inlineinherited
511{ return m_cancel_status.load(std::memory_order_acquire); }

References Slic3r::PrintBase::m_cancel_status.

Referenced by Slic3r::BackgroundSlicingProcess::thread_proc().

+ Here is the caller graph for this function:

◆ canceled()

◆ cleanup()

void Slic3r::SLAPrint::cleanup ( )
inlineoverridevirtual

Implements Slic3r::PrintBase.

462{}

◆ clear()

void Slic3r::SLAPrint::clear ( )
overridevirtual

Implements Slic3r::PrintBase.

150{
151 std::scoped_lock<std::mutex> lock(this->state_mutex());
152 // The following call should stop background processing if it is running.
153 this->invalidate_all_steps();
154 for (SLAPrintObject *object : m_objects)
155 delete object;
156 m_objects.clear();
158}
void clear_objects()
Definition Model.cpp:272

References Slic3r::Model::clear_objects(), Slic3r::PrintBaseWithState< SLAPrintStep, slapsCount >::invalidate_all_steps(), Slic3r::PrintBase::m_model, m_objects, and Slic3r::PrintBase::state_mutex().

+ Here is the call graph for this function:

◆ copy_id()

void Slic3r::ObjectBase::copy_id ( const ObjectBase rhs)
inlineprotectedinherited
76{ m_id = rhs.id(); }
ObjectID m_id
Definition ObjectID.hpp:82
size_t id
Definition ObjectID.hpp:37

References Slic3r::ObjectBase::id(), and Slic3r::ObjectBase::m_id.

Referenced by Slic3r::CutObjectBase::copy().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ default_object_config()

const SLAPrintObjectConfig & Slic3r::SLAPrint::default_object_config ( ) const
inline
485{ return m_default_object_config; }

References Slic3r::SLAPrintObjectConfig.

Referenced by Slic3r::GUI::GLCanvas3D::_render_sla_slices(), and Slic3r::anonymous_namespace{SL1.cpp}::fill_iniconf().

+ Here is the caller graph for this function:

◆ empty()

bool Slic3r::SLAPrint::empty ( ) const
inlineoverridevirtual

Implements Slic3r::PrintBase.

455{ return m_objects.empty(); }

◆ export_print() [1/2]

void Slic3r::SLAPrint::export_print ( const std::string &  fname,
const std::string &  projectname = "" 
)
inline
542 {
543 ThumbnailsList thumbnails; //empty thumbnail list
544 export_print(fname, thumbnails, projectname);
545 }
void export_print(const std::string &fname, const std::string &projectname="")
Definition SLAPrint.hpp:541
std::vector< ThumbnailData > ThumbnailsList
Definition ThumbnailData.hpp:22

Referenced by Slic3r::BackgroundSlicingProcess::prepare_upload(), Slic3r::BackgroundSlicingProcess::process_sla(), and Slic3r::CLI::run().

+ Here is the caller graph for this function:

◆ export_print() [2/2]

void Slic3r::SLAPrint::export_print ( const std::string &  fname,
const ThumbnailsList thumbnails,
const std::string &  projectname = "" 
)
605{
606 if (m_archiver)
607 m_archiver->export_print(fname, *this, thumbnails, projectname);
608 else {
609 throw ExportError(format(_u8L("Unknown archive format: %s"), m_printer_config.sla_archive_format.value));
610 }
611}
#define _u8L(s)
macro used to mark string used at localization, return same string
Definition SLAPrint.cpp:29
std::string format(const char *fmt, TArgs &&... args)
Definition format.hpp:44

References _u8L, Slic3r::format(), m_archiver, and m_printer_config.

+ Here is the call graph for this function:

◆ finalize()

void Slic3r::SLAPrint::finalize ( )
inlineoverridevirtual

Implements Slic3r::PrintBase.

void finalize_impl(std::vector< PrintObject * > &print_objects)
Definition PrintBase.hpp:714

◆ finalize_impl()

void Slic3r::PrintBaseWithState< SLAPrintStep , COUNT >::finalize_impl ( std::vector< PrintObject * > &  print_objects)
inlineprotectedinherited
715 {
716 // Grab the lock for the Print / PrintObject milestones.
717 std::scoped_lock<std::mutex> lock(this->state_mutex());
718 for (auto *po : print_objects)
719 po->finalize_impl();
722 }
void mark_canceled_unguarded()
Definition PrintBase.hpp:308
void enable_all_unguarded(bool enable)
Definition PrintBase.hpp:154

◆ finished()

bool Slic3r::SLAPrint::finished ( ) const
inlineoverridevirtual

Implements Slic3r::PrintBase.

bool is_step_done(PrintStepEnum step) const
Definition PrintBase.hpp:583
bool is_step_done(SLAPrintObjectStep step) const
Definition SLAPrint.cpp:822
@ slaposSliceSupports
Definition SLAPrint.hpp:35
@ slapsRasterize
Definition SLAPrint.hpp:23

References Slic3r::slaposSliceSupports, and Slic3r::slapsRasterize.

Referenced by output_filename().

+ Here is the caller graph for this function:

◆ full_print_config()

◆ generate_new_id()

static ObjectID Slic3r::ObjectBase::generate_new_id ( )
inlinestaticprivateinherited
84{ return ObjectID(++ s_last_id); }
static size_t s_last_id
Definition ObjectID.hpp:85

References Slic3r::ObjectBase::s_last_id.

Referenced by Slic3r::ObjectBase::set_new_unique_id().

+ Here is the caller graph for this function:

◆ get_object()

const SLAPrintObject * Slic3r::SLAPrint::get_object ( ObjectID  object_id) const
inline
476 {
477 auto it = std::find_if(m_objects.begin(), m_objects.end(),
478 [object_id](const SLAPrintObject *obj) { return obj->id() == object_id; });
479 return (it == m_objects.end()) ? nullptr : *it;
480 }

Referenced by Slic3r::GUI::Plater::priv::on_slicing_update().

+ Here is the caller graph for this function:

◆ get_print_object_by_model_object_id()

const SLAPrintObject * Slic3r::SLAPrint::get_print_object_by_model_object_id ( ObjectID  object_id) const
inline
471 {
472 auto it = std::find_if(m_objects.begin(), m_objects.end(),
473 [object_id](const SLAPrintObject* obj) { return obj->model_object()->id() == object_id; });
474 return (it == m_objects.end()) ? nullptr : *it;
475 }

Referenced by Slic3r::GUI::get_arrange_poly(), Slic3r::GUI::CommonGizmosDataObjects::SelectionInfo::on_update(), Slic3r::GUI::processed_objects_idxs(), and Slic3r::GUI::GLCanvas3D::reload_scene().

+ Here is the caller graph for this function:

◆ id()

ObjectID Slic3r::ObjectBase::id ( ) const
inlineinherited
55{ return m_id; }

References Slic3r::ObjectBase::m_id.

Referenced by Slic3r::Model::Model(), Slic3r::ModelInstance::ModelInstance(), Slic3r::ModelMaterial::ModelMaterial(), Slic3r::ModelObject::ModelObject(), Slic3r::ModelObject::ModelObject(), Slic3r::ModelObject::ModelObject(), Slic3r::ModelObject::ModelObject(), Slic3r::ModelObject::ModelObject(), Slic3r::ModelVolume::ModelVolume(), Slic3r::ModelVolume::ModelVolume(), Slic3r::ModelVolume::ModelVolume(), Slic3r::_3MF_Importer::_load_model_from_file(), Slic3r::GUI::Plater::priv::actualize_slicing_warnings(), Slic3r::ModelObjectStatusDB::add(), Slic3r::ModelObjectStatusDB::add_if_new(), Slic3r::Print::apply(), apply(), Slic3r::GUI::GLGizmoFdmSupports::apply_data_from_backend(), Slic3r::ModelVolume::check(), Slic3r::check_model_ids_equal(), Slic3r::ModelObject::convert_units(), Slic3r::ObjectBase::copy_id(), Slic3r::PrintObjectStatusDB::count(), anonymous_namespace{RaycastManager.cpp}::create_key(), priv::create_volume(), Slic3r::GUI::Emboss::create_volume_sources(), Slic3r::GUI::GLGizmoHollow::data_changed(), Slic3r::GUI::GLGizmoPainterBase::data_changed(), Slic3r::GUI::GLGizmoSlaSupports::data_changed(), Slic3r::Model::delete_object(), Slic3r::GUI::Plater::export_stl_obj(), Slic3r::ModelObjectStatusDB::get(), Slic3r::GUI::get_arrange_poly(), Slic3r::GUI::GLGizmoSlaSupports::get_data_from_backend(), Slic3r::PrintObjectStatusDB::get_range(), Slic3r::GUI::GLGizmoFdmSupports::has_backend_supports(), Slic3r::GUI::GLGizmoSlaSupports::has_backend_supports(), Slic3r::CutObjectBase::has_same_id(), Slic3r::UndoRedo::StackImpl::immutable_object_id_impl(), Slic3r::GUI::GLGizmoSimplify::init_model(), Slic3r::inner_brim_area(), Slic3r::ModelObject::is_cut(), Slic3r::CutObjectBase::is_equal(), Slic3r::ObjectBase::load_and_construct(), Slic3r::UndoRedo::StackImpl::load_snapshot(), Slic3r::GUI::ObjectList::merge(), Slic3r::model_property_changed(), Slic3r::model_volume_list_changed(), Slic3r::model_volume_list_copy_configs(), Slic3r::ModelConfigObject::object_id_and_timestamp_match(), Slic3r::ObjectWithTimestamp::object_id_and_timestamp_match(), Slic3r::GUI::GLGizmoEmboss::on_mouse_change_selection(), Slic3r::GUI::CommonGizmosDataObjects::SelectionInfo::on_update(), Slic3r::CutObjectBase::operator<(), Slic3r::Model::operator=(), Slic3r::ModelObject::operator=(), Slic3r::ModelObject::operator=(), Slic3r::CutObjectBase::operator==(), Slic3r::GUI::GLGizmoCut3D::perform_cut(), Slic3r::GUI::GLGizmoEmboss::process(), Slic3r::GUI::processed_objects_idxs(), Slic3r::GUI::GLCanvas3D::reload_scene(), Slic3r::GUI::GLCanvas3D::LayersEditing::select_object(), Slic3r::ModelMaterial::serialize(), Slic3r::SLAPrintObject::SliceRecord::set_model_slice_idx(), Slic3r::SLAPrintObject::SliceRecord::set_support_slice_idx(), Slic3r::slices_to_regions(), Slic3r::ModelObject::split(), Slic3r::UndoRedo::StackImpl::take_snapshot(), Slic3r::top_level_outer_brim_area(), Slic3r::GUI::update_object_cut_id(), and anonymous_namespace{EmbossJob.cpp}::update_volume_name().

◆ invalidate_all_steps()

bool Slic3r::PrintBaseWithState< SLAPrintStep , COUNT >::invalidate_all_steps ( )
inlineprotectedinherited
603 { return m_state.invalidate_all(this->cancel_callback()); }
std::function< void()> cancel_callback()
Definition PrintBase.hpp:535
bool invalidate_all(CancelationCallback cancel)
Definition PrintBase.hpp:279

◆ invalidate_state_by_config_options()

bool Slic3r::SLAPrint::invalidate_state_by_config_options ( const std::vector< t_config_option_key > &  opt_keys,
bool &  invalidate_all_model_objects 
)
private
734{
735 if (opt_keys.empty())
736 return false;
737
738 static std::unordered_set<std::string> steps_full = {
739 "initial_layer_height",
740 "material_correction",
741 "material_correction_x",
742 "material_correction_y",
743 "material_correction_z",
744 "material_print_speed",
745 "relative_correction",
746 "relative_correction_x",
747 "relative_correction_y",
748 "relative_correction_z",
749 "absolute_correction",
750 "elefant_foot_compensation",
751 "elefant_foot_min_width",
752 "gamma_correction"
753 };
754
755 // Cache the plenty of parameters, which influence the final rasterization only,
756 // or they are only notes not influencing the rasterization step.
757 static std::unordered_set<std::string> steps_rasterize = {
758 "min_exposure_time",
759 "max_exposure_time",
760 "exposure_time",
761 "min_initial_exposure_time",
762 "max_initial_exposure_time",
763 "initial_exposure_time",
764 "display_width",
765 "display_height",
766 "display_pixels_x",
767 "display_pixels_y",
768 "display_mirror_x",
769 "display_mirror_y",
770 "display_orientation",
771 "sla_archive_format",
772 "sla_output_precision"
773 };
774
775 static std::unordered_set<std::string> steps_ignore = {
776 "bed_shape",
777 "max_print_height",
778 "printer_technology",
779 "output_filename_format",
780 "fast_tilt_time",
781 "slow_tilt_time",
782 "high_viscosity_tilt_time",
783 "area_fill",
784 "bottle_cost",
785 "bottle_volume",
786 "bottle_weight",
787 "material_density"
788 };
789
790 std::vector<SLAPrintStep> steps;
791 std::vector<SLAPrintObjectStep> osteps;
792 bool invalidated = false;
793
794 for (const t_config_option_key &opt_key : opt_keys) {
795 if (steps_rasterize.find(opt_key) != steps_rasterize.end()) {
796 // These options only affect the final rasterization, or they are just notes without influence on the output,
797 // so there is nothing to invalidate.
798 steps.emplace_back(slapsMergeSlicesAndEval);
799 } else if (steps_ignore.find(opt_key) != steps_ignore.end()) {
800 // These steps have no influence on the output. Just ignore them.
801 } else if (steps_full.find(opt_key) != steps_full.end()) {
802 steps.emplace_back(slapsMergeSlicesAndEval);
803 osteps.emplace_back(slaposObjectSlice);
804 invalidate_all_model_objects = true;
805 } else {
806 // All values should be covered.
807 assert(false);
808 }
809 }
810
812 for (SLAPrintStep step : steps)
813 invalidated |= this->invalidate_step(step);
815 for (SLAPrintObjectStep ostep : osteps)
816 for (SLAPrintObject *object : m_objects)
817 invalidated |= object->invalidate_step(ostep);
818 return invalidated;
819}
std::string t_config_option_key
Definition Config.hpp:76
SLAPrintObjectStep
Definition SLAPrint.hpp:27
@ slaposObjectSlice
Definition SLAPrint.hpp:31
void sort_remove_duplicates(std::vector< T > &vec)
Definition libslic3r.h:188
SLAPrintStep
Definition SLAPrint.hpp:21
Coord step(const Coord &crd, Dir d)
Definition MarchingSquares.hpp:137

References invalidate_step(), m_objects, Slic3r::slaposObjectSlice, Slic3r::slapsMergeSlicesAndEval, and Slic3r::sort_remove_duplicates().

Referenced by apply().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ invalidate_step()

bool Slic3r::SLAPrint::invalidate_step ( SLAPrintStep  st)
private
614{
615 bool invalidated = Inherited::invalidate_step(step);
616
617 // propagate to dependent steps
618 if (step == slapsMergeSlicesAndEval) {
619 invalidated |= this->invalidate_all_steps();
620 }
621
622 return invalidated;
623}
bool invalidate_step(PrintStepEnum step)
Definition PrintBase.hpp:595

References Slic3r::PrintBaseWithState< SLAPrintStep, slapsCount >::invalidate_all_steps(), Slic3r::PrintBaseWithState< SLAPrintStep, slapsCount >::invalidate_step(), and Slic3r::slapsMergeSlicesAndEval.

Referenced by apply(), and invalidate_state_by_config_options().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ invalidate_steps() [1/2]

bool Slic3r::PrintBaseWithState< SLAPrintStep , COUNT >::invalidate_steps ( std::initializer_list< PrintStepEnum il)
inlineprotectedinherited
601 { return m_state.invalidate_multiple(il.begin(), il.end(), this->cancel_callback()); }
bool invalidate_multiple(StepTypeIterator step_begin, StepTypeIterator step_end, CancelationCallback cancel)
Definition PrintBase.hpp:249

◆ invalidate_steps() [2/2]

bool Slic3r::PrintBaseWithState< SLAPrintStep , COUNT >::invalidate_steps ( StepTypeIterator  step_begin,
StepTypeIterator  step_end 
)
inlineprotectedinherited
599 { return m_state.invalidate_multiple(step_begin, step_end, this->cancel_callback()); }

◆ is_step_done() [1/2]

bool Slic3r::PrintBaseWithState< SLAPrintStep , COUNT >::is_step_done ( PrintStepEnum  step) const
inlineinherited
583{ return m_state.is_done(step, this->state_mutex()); }
bool is_done(StepType step, std::mutex &mtx) const
Definition PrintBase.hpp:134

◆ is_step_done() [2/2]

bool Slic3r::SLAPrint::is_step_done ( SLAPrintObjectStep  step) const
823{
824 if (m_objects.empty())
825 return false;
826 std::scoped_lock<std::mutex> lock(this->state_mutex());
827 for (const SLAPrintObject *object : m_objects)
828 if (! object->is_step_done_unguarded(step))
829 return false;
830 return true;
831}
bool is_step_done_unguarded(PrintStepEnum step) const
Definition PrintBase.hpp:606

References m_objects, and Slic3r::PrintBase::state_mutex().

+ Here is the call graph for this function:

◆ is_step_done_unguarded()

bool Slic3r::PrintBaseWithState< SLAPrintStep , COUNT >::is_step_done_unguarded ( PrintStepEnum  step) const
inlineprotectedinherited
606{ return m_state.is_done_unguarded(step); }
bool is_done_unguarded(StepType step) const
Definition PrintBase.hpp:146

◆ is_step_started_unguarded()

bool Slic3r::PrintBaseWithState< SLAPrintStep , COUNT >::is_step_started_unguarded ( PrintStepEnum  step) const
inlineprotectedinherited
605{ return m_state.is_started_unguarded(step); }
bool is_started_unguarded(StepType step) const
Definition PrintBase.hpp:142

◆ load_and_construct()

template<class Archive >
static void Slic3r::ObjectBase::load_and_construct ( Archive &  ar,
cereal::construct< ObjectBase > &  construct 
)
inlinestaticprivateinherited
96{ ObjectID id; ar(id); construct(id); }

References Slic3r::ObjectBase::id().

+ Here is the call graph for this function:

◆ make_try_cancel()

PrintTryCancel Slic3r::PrintBase::make_try_cancel ( ) const
inlineprotectedinherited
546{ return PrintTryCancel(this); }
friend PrintTryCancel
Definition PrintBase.hpp:571

References Slic3r::PrintBase::PrintTryCancel.

Referenced by Slic3r::Print::process().

+ Here is the caller graph for this function:

◆ material_config()

const SLAMaterialConfig & Slic3r::SLAPrint::material_config ( ) const
inline
484{ return m_material_config; }

Referenced by Slic3r::GUI::GLCanvas3D::_render_sla_slices(), Slic3r::GUI::Preview::load_print_as_sla(), Slic3r::SLAPrint::Steps::merge_slices_and_eval_stats(), and relative_correction().

+ Here is the caller graph for this function:

◆ model()

const Model & Slic3r::PrintBase::model ( ) const
inlineinherited
433{ return m_model; }

References Slic3r::PrintBase::m_model.

Referenced by Slic3r::ToolOrdering::ToolOrdering(), Slic3r::GUI::Plater::priv::actualize_object_warnings(), apply(), Slic3r::ToolOrdering::assign_custom_gcodes(), Slic3r::GUI::GLCanvas3D::reload_scene(), Slic3r::sort_object_instances_by_model_order(), and Slic3r::DoExport::validate_custom_gcode().

+ Here is the caller graph for this function:

◆ objects()

◆ output_filename() [1/2]

std::string Slic3r::SLAPrint::output_filename ( const std::string &  filename_base = std::string()) const
overridevirtual

Implements Slic3r::PrintBase.

535{
536 DynamicConfig config = this->finished() ? this->print_statistics().config() : this->print_statistics().placeholders();
537 std::string default_ext = get_default_extension(m_printer_config.sla_archive_format.value.c_str());
538 if (default_ext.empty())
539 default_ext = "sl1";
540
541 default_ext.insert(default_ext.begin(), '.');
542
543 config.set_key_value("default_output_extension",
544 new ConfigOptionString(default_ext));
545
546 return this->PrintBase::output_filename(m_print_config.output_filename_format.value, default_ext, filename_base, &config);
547}
virtual std::string output_filename(const std::string &filename_base=std::string()) const =0
bool finished() const override
Definition SLAPrint.hpp:466
const SLAPrintStatistics & print_statistics() const
Definition SLAPrint.hpp:495
const char * get_default_extension(const char *formatid)
Definition SLAArchiveFormatRegistry.cpp:132
static DynamicConfig placeholders()
Definition SLAPrint.cpp:1136
DynamicConfig config() const
Definition SLAPrint.cpp:1124

References Slic3r::SLAPrintStatistics::config(), finished(), Slic3r::get_default_extension(), m_print_config, m_printer_config, Slic3r::PrintBase::output_filename(), Slic3r::SLAPrintStatistics::placeholders(), print_statistics(), and Slic3r::DynamicConfig::set_key_value().

+ Here is the call graph for this function:

◆ output_filename() [2/2]

std::string Slic3r::PrintBase::output_filename ( const std::string &  format,
const std::string &  default_ext,
const std::string &  filename_base,
const DynamicConfig config_override = nullptr 
) const
protectedinherited
61{
62 DynamicConfig cfg;
63 if (config_override != nullptr)
64 cfg = *config_override;
65 cfg.set_key_value("version", new ConfigOptionString(std::string(SLIC3R_VERSION)));
67 this->update_object_placeholders(cfg, default_ext);
68 if (! filename_base.empty()) {
69 cfg.set_key_value("input_filename", new ConfigOptionString(filename_base + default_ext));
70 cfg.set_key_value("input_filename_base", new ConfigOptionString(filename_base));
71 }
72 try {
73 boost::filesystem::path filename = format.empty() ?
74 cfg.opt_string("input_filename_base") + default_ext :
75 this->placeholder_parser().process(format, 0, &cfg);
76 if (filename.extension().empty())
77 filename = boost::filesystem::change_extension(filename, default_ext);
78 return filename.string();
79 } catch (std::runtime_error &err) {
80 throw Slic3r::PlaceholderParserError(_u8L("Failed processing of the output_filename_format template.") + "\n" + err.what());
81 }
82}
std::string process(const std::string &templ, unsigned int current_extruder_id, const DynamicConfig *config_override, DynamicConfig *config_outputs, ContextData *context) const
Definition PlaceholderParser.cpp:2344
void update_timestamp()
Definition PlaceholderParser.hpp:72
void update_object_placeholders(DynamicConfig &config, const std::string &default_ext) const
Definition PrintBase.cpp:20
const PlaceholderParser & placeholder_parser() const
Definition PrintBase.hpp:522

References _u8L, Slic3r::format(), Slic3r::ConfigBase::opt_string(), Slic3r::PrintBase::placeholder_parser(), Slic3r::PlaceholderParser::process(), Slic3r::DynamicConfig::set_key_value(), Slic3r::PrintBase::update_object_placeholders(), and Slic3r::PlaceholderParser::update_timestamp().

+ Here is the call graph for this function:

◆ output_filepath()

std::string Slic3r::PrintBase::output_filepath ( const std::string &  path,
const std::string &  filename_base = std::string() 
) const
inherited
85{
86 // if we were supplied no path, generate an automatic one based on our first object's input file
87 if (path.empty())
88 // get the first input file name
89 return (boost::filesystem::path(m_model.propose_export_file_name_and_path()).parent_path() / this->output_filename(filename_base)).make_preferred().string();
90
91 // if we were supplied a directory, use it and append our automatically generated filename
92 boost::filesystem::path p(path);
93 if (boost::filesystem::is_directory(p))
94 return (p / this->output_filename(filename_base)).make_preferred().string();
95
96 // if we were supplied a file which is not a directory, use it
97 return path;
98}
std::string propose_export_file_name_and_path() const
Definition Model.cpp:585

References Slic3r::PrintBase::m_model, Slic3r::PrintBase::output_filename(), and Slic3r::Model::propose_export_file_name_and_path().

Referenced by Slic3r::Print::export_gcode(), Slic3r::BackgroundSlicingProcess::output_filepath_for_project(), and Slic3r::CLI::run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ placeholder_parser()

const PlaceholderParser & Slic3r::PrintBase::placeholder_parser ( ) const
inlineinherited
522{ return m_placeholder_parser; }

References Slic3r::PrintBase::m_placeholder_parser.

Referenced by Slic3r::GCode::_do_export(), and Slic3r::PrintBase::output_filename().

+ Here is the caller graph for this function:

◆ print_config()

const SLAPrintConfig & Slic3r::SLAPrint::print_config ( ) const
inline
482{ return m_print_config; }

References Slic3r::SLAPrintConfig.

◆ print_layers()

const std::vector< PrintLayer > & Slic3r::SLAPrint::print_layers ( ) const
inline
539{ return m_printer_input; }

◆ print_object_ids()

std::vector< ObjectID > Slic3r::SLAPrint::print_object_ids ( ) const
overridevirtual

Implements Slic3r::PrintBase.

191{
192 std::vector<ObjectID> out;
193 // Reserve one more for the caller to append the ID of the Print itself.
194 out.reserve(m_objects.size() + 1);
195 for (const SLAPrintObject *print_object : m_objects)
196 out.emplace_back(print_object->id());
197 return out;
198}

References m_objects.

◆ print_statistics()

◆ printer_config()

const SLAPrinterConfig & Slic3r::SLAPrint::printer_config ( ) const
inline
483{ return m_printer_config; }

References Slic3r::SLAPrinterConfig.

Referenced by Slic3r::SLAPrint::Steps::merge_slices_and_eval_stats(), and relative_correction().

+ Here is the caller graph for this function:

◆ process()

void Slic3r::SLAPrint::process ( )
overridevirtual

Implements Slic3r::PrintBase.

626{
627 if (m_objects.empty())
628 return;
629
631
632 // Assumption: at this point the print objects should be populated only with
633 // the model objects we have to process and the instances are also filtered
634
635 Steps printsteps(this);
636
637 // We want to first process all objects...
638 std::vector<SLAPrintObjectStep> level1_obj_steps = {
640 };
641
642 // and then slice all supports to allow preview to be displayed ASAP
643 std::vector<SLAPrintObjectStep> level2_obj_steps = {
645 };
646
648
649 double st = Steps::min_objstatus;
650
651 BOOST_LOG_TRIVIAL(info) << "Start slicing process.";
652
653#ifdef SLAPRINT_DO_BENCHMARK
654 Benchmark bench;
655#else
656 struct {
657 void start() {} void stop() {} double getElapsedSec() { return .0; }
658 } bench;
659#endif
660
661 std::array<double, slaposCount + slapsCount> step_times {};
662
663 auto apply_steps_on_objects =
664 [this, &st, &printsteps, &step_times, &bench]
665 (const std::vector<SLAPrintObjectStep> &steps)
666 {
667 double incr = 0;
668 for (SLAPrintObject *po : m_objects) {
669 for (SLAPrintObjectStep step : steps) {
670
671 // Cancellation checking. Each step will check for
672 // cancellation on its own and return earlier gracefully.
673 // Just after it returns execution gets to this point and
674 // throws the canceled signal.
676
677 st += incr;
678
679 if (po->set_started(step)) {
680 m_report_status(*this, st, printsteps.label(step));
681 bench.start();
682 printsteps.execute(step, *po);
683 bench.stop();
684 step_times[step] += bench.getElapsedSec();
686 po->set_done(step);
687 }
688
689 incr = printsteps.progressrange(step);
690 }
691 }
692 };
693
694 apply_steps_on_objects(level1_obj_steps);
695 apply_steps_on_objects(level2_obj_steps);
696
698 for(SLAPrintStep currentstep : print_steps) {
700
701 if (set_started(currentstep)) {
702 m_report_status(*this, st, printsteps.label(currentstep));
703 bench.start();
704 printsteps.execute(currentstep);
705 bench.stop();
706 step_times[slaposCount + currentstep] += bench.getElapsedSec();
708 set_done(currentstep);
709 }
710
711 st += printsteps.progressrange(currentstep);
712 }
713
714 // If everything vent well
715 m_report_status(*this, 100, _u8L("Slicing done"));
716
717#ifdef SLAPRINT_DO_BENCHMARK
718 std::string csvbenchstr;
719 for (size_t i = 0; i < size_t(slaposCount); ++i)
720 csvbenchstr += printsteps.label(SLAPrintObjectStep(i)) + ";";
721
722 for (size_t i = 0; i < size_t(slapsCount); ++i)
723 csvbenchstr += printsteps.label(SLAPrintStep(i)) + ";";
724
725 csvbenchstr += "\n";
726 for (double t : step_times) csvbenchstr += std::to_string(t) + ";";
727
728 std::cout << "Performance stats: \n" << csvbenchstr << std::endl;
729#endif
730
731}
Definition benchmark.h:26
double getElapsedSec()
Definition benchmark.h:54
void stop()
Definition benchmark.h:48
void start()
Definition benchmark.h:43
void throw_if_canceled() const
Definition PrintBase.hpp:544
bool set_started(PrintStepEnum step)
Definition PrintBase.hpp:588
PrintStateBase::TimeStamp set_done(PrintStepEnum step)
Definition PrintBase.hpp:589
static const constexpr unsigned max_objstatus
Definition SLAPrintSteps.hpp:21
static const constexpr unsigned min_objstatus
Definition SLAPrintSteps.hpp:20
class Slic3r::SLAPrint::StatusReporter m_report_status
@ slaposCount
Definition SLAPrint.hpp:36
@ slaposPad
Definition SLAPrint.hpp:34
@ slaposHollowing
Definition SLAPrint.hpp:29
@ slaposAssembly
Definition SLAPrint.hpp:28
@ slaposSupportTree
Definition SLAPrint.hpp:33
void name_tbb_thread_pool_threads_set_locale()
Definition Thread.cpp:222
@ slapsCount
Definition SLAPrint.hpp:24
std::string to_string(const Vec2crd &pt)
Definition Point.hpp:139
STL namespace.

References _u8L, Slic3r::SLAPrint::Steps::execute(), Benchmark::getElapsedSec(), Slic3r::SLAPrint::Steps::label(), m_objects, m_report_status, Slic3r::SLAPrint::Steps::max_objstatus, Slic3r::SLAPrint::Steps::min_objstatus, Slic3r::name_tbb_thread_pool_threads_set_locale(), Slic3r::SLAPrint::Steps::progressrange(), Slic3r::PrintBaseWithState< SLAPrintStep, slapsCount >::set_done(), Slic3r::PrintBaseWithState< SLAPrintStep, slapsCount >::set_started(), Slic3r::slaposAssembly, Slic3r::slaposCount, Slic3r::slaposDrillHoles, Slic3r::slaposHollowing, Slic3r::slaposObjectSlice, Slic3r::slaposPad, Slic3r::slaposSliceSupports, Slic3r::slaposSupportPoints, Slic3r::slaposSupportTree, Slic3r::slapsCount, Slic3r::slapsMergeSlicesAndEval, Slic3r::slapsRasterize, Benchmark::start(), Benchmark::stop(), and Slic3r::PrintBase::throw_if_canceled().

+ Here is the call graph for this function:

◆ relative_correction()

Vec3d Slic3r::SLAPrint::relative_correction ( ) const
1005{
1006 Vec3d corr(1., 1., 1.);
1007
1008 if(printer_config().relative_correction.values.size() >= 2) {
1009 corr.x() = printer_config().relative_correction_x.value;
1010 corr.y() = printer_config().relative_correction_y.value;
1011 corr.z() = printer_config().relative_correction_z.value;
1012 }
1013
1014 if(material_config().material_correction.values.size() >= 2) {
1015 corr.x() *= material_config().material_correction_x.value;
1016 corr.y() *= material_config().material_correction_y.value;
1017 corr.z() *= material_config().material_correction_z.value;
1018 }
1019
1020 return corr;
1021}
const SLAMaterialConfig & material_config() const
Definition SLAPrint.hpp:484
const SLAPrinterConfig & printer_config() const
Definition SLAPrint.hpp:483
Vec3d relative_correction() const
Definition SLAPrint.cpp:1004
Eigen::Matrix< double, 3, 1, Eigen::DontAlign > Vec3d
Definition Point.hpp:52

References material_config(), printer_config(), and relative_correction().

Referenced by relative_correction(), Slic3r::GUI::GLCanvas3D::reload_scene(), and sla_trafo().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ restart()

void Slic3r::PrintBase::restart ( )
inlineinherited

References Slic3r::PrintBase::m_cancel_status, and Slic3r::PrintBase::NOT_CANCELED.

Referenced by Slic3r::PrintBase::PrintBase(), and Slic3r::BackgroundSlicingProcess::thread_proc().

+ Here is the caller graph for this function:

◆ serialize()

template<class Archive >
void Slic3r::ObjectBase::serialize ( Archive &  ar)
inlineprivateinherited
92{ ar(m_id); }

References Slic3r::ObjectBase::m_id.

◆ set_cancel_callback()

void Slic3r::PrintBase::set_cancel_callback ( cancel_callback_type  cancel_callback)
inlineinherited

References Slic3r::PrintBase::cancel_callback(), and Slic3r::PrintBase::m_cancel_callback.

Referenced by Slic3r::BackgroundSlicingProcess::start(), Slic3r::BackgroundSlicingProcess::stop(), and Slic3r::BackgroundSlicingProcess::stop_internal().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set_done()

PrintStateBase::TimeStamp Slic3r::PrintBaseWithState< SLAPrintStep , COUNT >::set_done ( PrintStepEnum  step)
inlineprotectedinherited
589 {
590 std::pair<PrintStateBase::TimeStamp, bool> status = m_state.set_done(step, this->state_mutex(), [this](){ this->throw_if_canceled(); });
591 if (status.second)
592 this->status_update_warnings(static_cast<int>(step), PrintStateBase::WarningLevel::NON_CRITICAL, std::string());
593 return status.first;
594 }
std::pair< TimeStamp, bool > set_done(StepType step, std::mutex &mtx, ThrowIfCanceled throw_if_canceled)
Definition PrintBase.hpp:202

◆ set_invalid_id()

void Slic3r::ObjectBase::set_invalid_id ( )
inlineprotectedinherited
74{ m_id = 0; }

References Slic3r::ObjectBase::m_id.

Referenced by Slic3r::CutObjectBase::invalidate().

+ Here is the caller graph for this function:

◆ set_new_unique_id()

void Slic3r::ObjectBase::set_new_unique_id ( )
inlineprotectedinherited
73{ m_id = generate_new_id(); }
static ObjectID generate_new_id()
Definition ObjectID.hpp:84

References Slic3r::ObjectBase::generate_new_id(), and Slic3r::ObjectBase::m_id.

Referenced by Slic3r::ModelVolume::ModelVolume(), Slic3r::Model::assign_new_unique_ids_recursive(), Slic3r::ObjectBase::assign_new_unique_ids_recursive(), Slic3r::ModelObject::assign_new_unique_ids_recursive(), Slic3r::CutObjectBase::init(), Slic3r::ModelMaterial::set_new_unique_id(), Slic3r::ModelObject::set_new_unique_id(), and Slic3r::ModelVolume::set_new_unique_id().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set_started()

bool Slic3r::PrintBaseWithState< SLAPrintStep , COUNT >::set_started ( PrintStepEnum  step)
inlineprotectedinherited
588{ return m_state.set_started(step, this->state_mutex(), [this](){ this->throw_if_canceled(); }); }
bool set_started(StepType step, std::mutex &mtx, ThrowIfCanceled throw_if_canceled)
Definition PrintBase.hpp:169

◆ set_status()

void Slic3r::PrintBase::set_status ( int  percent,
const std::string &  message,
unsigned int  flags = SlicingStatus::DEFAULT 
)
inlineinherited
492 {
493 if (m_status_callback) m_status_callback(SlicingStatus(percent, message, flags));
494 else printf("%d => %s\n", percent, message.c_str());
495 }
status_callback_type m_status_callback
Definition PrintBase.hpp:558

References Slic3r::PrintBase::m_status_callback.

Referenced by Slic3r::Print::alert_when_supports_needed(), Slic3r::Print::export_gcode(), Slic3r::BackgroundSlicingProcess::finalize_gcode(), Slic3r::PrintObject::make_perimeters(), Slic3r::SLAPrint::StatusReporter::operator()(), Slic3r::BackgroundSlicingProcess::prepare_upload(), Slic3r::Print::process(), Slic3r::BackgroundSlicingProcess::process_fff(), and Slic3r::BackgroundSlicingProcess::process_sla().

+ Here is the caller graph for this function:

◆ set_status_callback()

void Slic3r::PrintBase::set_status_callback ( status_callback_type  cb)
inlineinherited
490{ m_status_callback = cb; }

References Slic3r::PrintBase::m_status_callback.

Referenced by Slic3r::CLI::run().

+ Here is the caller graph for this function:

◆ set_status_default()

void Slic3r::PrintBase::set_status_default ( )
inlineinherited

◆ set_status_silent()

void Slic3r::PrintBase::set_status_silent ( )
inlineinherited
488{ m_status_callback = [](const SlicingStatus&){}; }

References Slic3r::PrintBase::m_status_callback.

◆ set_task()

void Slic3r::SLAPrint::set_task ( const TaskParams params)
inlineoverridevirtual

Implements Slic3r::PrintBase.

void set_task_impl(const TaskParams &params, std::vector< PrintObject * > &print_objects)
Definition PrintBase.hpp:620

◆ set_task_impl()

void Slic3r::PrintBaseWithState< SLAPrintStep , COUNT >::set_task_impl ( const TaskParams params,
std::vector< PrintObject * > &  print_objects 
)
inlineprotectedinherited
621 {
622 static constexpr const auto PrintObjectStepEnumSize = int(PrintObject::PrintObjectStepEnumSize);
623 using PrintObjectStepEnum = typename PrintObject::PrintObjectStepEnum;
624 // Grab the lock for the Print / PrintObject milestones.
625 std::scoped_lock<std::mutex> lock(this->state_mutex());
626
627 int n_object_steps = int(params.to_object_step) + 1;
628 if (n_object_steps == 0)
629 n_object_steps = PrintObjectStepEnumSize;
630
631 if (params.single_model_object.valid()) {
632 // Find the print object to be processed with priority.
633 PrintObject *print_object = nullptr;
634 size_t idx_print_object = 0;
635 for (; idx_print_object < print_objects.size(); ++ idx_print_object)
636 if (print_objects[idx_print_object]->model_object()->id() == params.single_model_object) {
637 print_object = print_objects[idx_print_object];
638 break;
639 }
640 assert(print_object != nullptr);
641 // Find out whether the priority print object is being currently processed.
642 bool running = false;
643 for (int istep = 0; istep < n_object_steps; ++ istep) {
644 if (! print_object->is_step_enabled_unguarded(PrintObjectStepEnum(istep)))
645 // Step was skipped, cancel.
646 break;
647 if (print_object->is_step_started_unguarded(PrintObjectStepEnum(istep))) {
648 // No step was skipped, and a wanted step is being processed. Don't cancel.
649 running = true;
650 break;
651 }
652 }
653 if (! running)
654 this->call_cancel_callback();
655
656 // Now the background process is either stopped, or it is inside one of the print object steps to be calculated anyway.
657 if (params.single_model_instance_only) {
658 // Suppress all the steps of other instances.
659 for (PrintObject *po : print_objects)
660 for (size_t istep = 0; istep < PrintObjectStepEnumSize; ++ istep)
661 po->enable_step_unguarded(PrintObjectStepEnum(istep), false);
662 } else if (! running) {
663 // Swap the print objects, so that the selected print_object is first in the row.
664 // At this point the background processing must be stopped, so it is safe to shuffle print objects.
665 if (idx_print_object != 0)
666 std::swap(print_objects.front(), print_objects[idx_print_object]);
667 }
668 // and set the steps for the current object.
669 for (int istep = 0; istep < n_object_steps; ++ istep)
670 print_object->enable_step_unguarded(PrintObjectStepEnum(istep), true);
671 for (int istep = n_object_steps; istep < PrintObjectStepEnumSize; ++ istep)
672 print_object->enable_step_unguarded(PrintObjectStepEnum(istep), false);
673 } else {
674 // Slicing all objects.
675 bool running = false;
676 for (PrintObject *print_object : print_objects)
677 for (int istep = 0; istep < n_object_steps; ++ istep) {
678 if (! print_object->is_step_enabled_unguarded(PrintObjectStepEnum(istep))) {
679 // Step may have been skipped. Restart.
680 goto loop_end;
681 }
682 if (print_object->is_step_started_unguarded(PrintObjectStepEnum(istep))) {
683 // This step is running, and the state cannot be changed due to the this->state_mutex() being locked.
684 // It is safe to manipulate m_stepmask of other PrintObjects and Print now.
685 running = true;
686 goto loop_end;
687 }
688 }
689 loop_end:
690 if (! running)
691 this->call_cancel_callback();
692 for (PrintObject *po : print_objects) {
693 for (int istep = 0; istep < n_object_steps; ++ istep)
694 po->enable_step_unguarded(PrintObjectStepEnum(istep), true);
695 for (int istep = n_object_steps; istep < PrintObjectStepEnumSize; ++ istep)
696 po->enable_step_unguarded(PrintObjectStepEnum(istep), false);
697 }
698 }
699
700 if (params.to_object_step != -1 || params.to_print_step != -1) {
701 // Limit the print steps.
702 size_t istep = (params.to_object_step != -1) ? 0 : size_t(params.to_print_step) + 1;
703 for (; istep < PrintStepEnumSize; ++ istep)
705 }
706 }
SLAPrintStep PrintStepEnum
Definition PrintBase.hpp:578
static constexpr const size_t PrintStepEnumSize
Definition PrintBase.hpp:579
void enable_unguarded(StepType step, bool enable)
Definition PrintBase.hpp:150

◆ sla_trafo()

Transform3d Slic3r::SLAPrint::sla_trafo ( const ModelObject model_object) const
162{
163 ModelInstance &model_instance = *model_object.instances.front();
164 auto trafo = Transform3d::Identity();
165 trafo.translate(Vec3d{ 0., 0., model_instance.get_offset().z() * this->relative_correction().z() });
166 trafo.linear() = Eigen::DiagonalMatrix<double, 3, 3>(this->relative_correction()) * model_instance.get_matrix().linear();
167 if (model_instance.is_left_handed())
168 trafo = Eigen::Scaling(Vec3d(-1., 1., 1.)) * trafo;
169 return trafo;
170}
Represents a diagonal matrix with its storage.
Definition DiagonalMatrix.h:118
static EIGEN_DEVICE_FUNC const Transform Identity()
Returns an identity transformation.
Definition Transform.h:539
UniformScaling< float > Scaling(float s)
Definition Scaling.h:121

References Slic3r::ModelInstance::get_matrix(), Slic3r::ModelInstance::get_offset(), Eigen::Transform< double, 3, Eigen::Affine, Eigen::DontAlign >::Identity(), Slic3r::ModelObject::instances, Slic3r::ModelInstance::is_left_handed(), Eigen::Transform< _Scalar, _Dim, _Mode, _Options >::linear(), relative_correction(), and Eigen::Scaling().

Referenced by apply().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ state_mutex()

◆ status_update_warnings()

void Slic3r::PrintBase::status_update_warnings ( int  step,
PrintStateBase::WarningLevel  warning_level,
const std::string &  message,
const PrintObjectBase print_object = nullptr 
)
protectedinherited
101{
102 if (m_status_callback) {
103 auto status = print_object ? SlicingStatus(*print_object, step) : SlicingStatus(*this, step);
104 m_status_callback(status);
105 }
106 else if (! message.empty())
107 printf("%s warning: %s\n", print_object ? "print_object" : "print", message.c_str());
108}

References Slic3r::PrintBase::m_status_callback.

Referenced by Slic3r::PrintBaseWithState< PrintStepEnumType, COUNT >::active_step_add_warning(), Slic3r::PrintBaseWithState< PrintStepEnumType, COUNT >::set_done(), and Slic3r::PrintObjectBase::status_update_warnings().

+ Here is the caller graph for this function:

◆ step_state_with_timestamp()

PrintStateBase::StateWithTimeStamp Slic3r::PrintBaseWithState< SLAPrintStep , COUNT >::step_state_with_timestamp ( PrintStepEnum  step) const
inlineinherited
584{ return m_state.state_with_timestamp(step, this->state_mutex()); }
StateWithTimeStamp state_with_timestamp(StepType step, std::mutex &mtx) const
Definition PrintBase.hpp:118

◆ step_state_with_warnings()

PrintStateBase::StateWithWarnings Slic3r::PrintBaseWithState< SLAPrintStep , COUNT >::step_state_with_warnings ( PrintStepEnum  step) const
inlineinherited
585{ return m_state.state_with_warnings(step, this->state_mutex()); }
StateWithWarnings state_with_warnings(StepType step, std::mutex &mtx) const
Definition PrintBase.hpp:124

◆ technology()

PrinterTechnology Slic3r::SLAPrint::technology ( ) const
inlineoverridevirtualnoexcept

Implements Slic3r::PrintBase.

452{ return ptSLA; }
@ ptSLA
Definition Config.hpp:209

References Slic3r::ptSLA.

◆ throw_if_canceled()

◆ timestamp()

virtual Timestamp Slic3r::ObjectBase::timestamp ( ) const
inlinevirtualinherited

Reimplemented in Slic3r::ModelConfigObject, and Slic3r::ObjectWithTimestamp.

60{ return 0; }

Referenced by Slic3r::GUI::Plater::priv::undo_redo_to().

+ Here is the caller graph for this function:

◆ update_object_placeholders()

void Slic3r::PrintBase::update_object_placeholders ( DynamicConfig config,
const std::string &  default_ext 
) const
protectedinherited
21{
22 // get the first input file name
23 std::string input_file;
24 std::vector<std::string> v_scale;
25 int num_objects = 0;
26 int num_instances = 0;
27 for (const ModelObject *model_object : m_model.objects) {
28 ModelInstance *printable = nullptr;
29 for (ModelInstance *model_instance : model_object->instances)
30 if (model_instance->is_printable()) {
31 printable = model_instance;
32 ++ num_instances;
33 }
34 if (printable) {
35 ++ num_objects;
36 // CHECK_ME -> Is the following correct ?
37 v_scale.push_back("x:" + boost::lexical_cast<std::string>(printable->get_scaling_factor(X) * 100) +
38 "% y:" + boost::lexical_cast<std::string>(printable->get_scaling_factor(Y) * 100) +
39 "% z:" + boost::lexical_cast<std::string>(printable->get_scaling_factor(Z) * 100) + "%");
40 if (input_file.empty())
41 input_file = model_object->name.empty() ? model_object->input_file : model_object->name;
42 }
43 }
44
45 config.set_key_value("num_objects", new ConfigOptionInt(num_objects));
46 config.set_key_value("num_instances", new ConfigOptionInt(num_instances));
47
48 config.set_key_value("scale", new ConfigOptionStrings(v_scale));
49 if (! input_file.empty()) {
50 // get basename with and without suffix
51 const std::string input_filename = boost::filesystem::path(input_file).filename().string();
52 const std::string input_filename_base = input_filename.substr(0, input_filename.find_last_of("."));
53 config.set_key_value("input_filename", new ConfigOptionString(input_filename_base + default_ext));
54 config.set_key_value("input_filename_base", new ConfigOptionString(input_filename_base));
55 }
56}
@ Y
Definition libslic3r.h:99
@ Z
Definition libslic3r.h:100
@ X
Definition libslic3r.h:98

References Slic3r::ModelInstance::get_scaling_factor(), Slic3r::PrintBase::m_model, Slic3r::Model::objects, Slic3r::DynamicConfig::set_key_value(), Slic3r::X, Slic3r::Y, and Slic3r::Z.

Referenced by Slic3r::GCode::_do_export(), and Slic3r::PrintBase::output_filename().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ validate()

std::string Slic3r::SLAPrint::validate ( std::vector< std::string > *  warnings = nullptr) const
overridevirtual

Reimplemented from Slic3r::PrintBase.

550{
551 for(SLAPrintObject * po : m_objects) {
552
553 const ModelObject *mo = po->model_object();
554 bool supports_en = po->config().supports_enable.getBool();
555
556 if(supports_en &&
557 mo->sla_points_status == sla::PointsStatus::UserModified &&
558 mo->sla_support_points.empty())
559 return _u8L("Cannot proceed without support points! "
560 "Add support points or disable support generation.");
561
562 sla::SupportTreeConfig cfg = make_support_cfg(po->config());
563
564 double elv = cfg.object_elevation_mm;
565
566 sla::PadConfig padcfg = make_pad_cfg(po->config());
567 sla::PadConfig::EmbedObject &builtinpad = padcfg.embed_object;
568
569 if(supports_en && !builtinpad.enabled && elv < cfg.head_fullwidth())
570 return _u8L(
571 "Elevation is too low for object. Use the \"Pad around "
572 "object\" feature to print the object without elevation.");
573
574 if(supports_en && builtinpad.enabled &&
575 cfg.pillar_base_safety_distance_mm < builtinpad.object_gap_mm) {
576 return _u8L(
577 "The endings of the support pillars will be deployed on the "
578 "gap between the object and the pad. 'Support base safety "
579 "distance' has to be greater than the 'Pad object gap' "
580 "parameter to avoid this.");
581 }
582
583 std::string pval = padcfg.validate();
584 if (!pval.empty()) return pval;
585 }
586
587 double expt_max = m_printer_config.max_exposure_time.getFloat();
588 double expt_min = m_printer_config.min_exposure_time.getFloat();
589 double expt_cur = m_material_config.exposure_time.getFloat();
590
591 if (expt_cur < expt_min || expt_cur > expt_max)
592 return _u8L("Exposition time is out of printer profile bounds.");
593
594 double iexpt_max = m_printer_config.max_initial_exposure_time.getFloat();
595 double iexpt_min = m_printer_config.min_initial_exposure_time.getFloat();
596 double iexpt_cur = m_material_config.initial_exposure_time.getFloat();
597
598 if (iexpt_cur < iexpt_min || iexpt_cur > iexpt_max)
599 return _u8L("Initial exposition time is out of printer profile bounds.");
600
601 return "";
602}
sla::SupportTreeConfig make_support_cfg(const SLAPrintObjectConfig &c)
Definition SLAPrint.cpp:40
sla::PadConfig make_pad_cfg(const SLAPrintObjectConfig &c)
Definition SLAPrint.cpp:125

References _u8L, Slic3r::ModelObject::config, Slic3r::sla::PadConfig::embed_object, Slic3r::sla::PadConfig::EmbedObject::enabled, Slic3r::sla::SupportTreeConfig::head_fullwidth(), m_material_config, m_objects, m_printer_config, Slic3r::make_pad_cfg(), Slic3r::make_support_cfg(), Slic3r::sla::SupportTreeConfig::object_elevation_mm, Slic3r::sla::PadConfig::EmbedObject::object_gap_mm, Slic3r::sla::SupportTreeConfig::pillar_base_safety_distance_mm, Slic3r::ModelObject::sla_points_status, Slic3r::ModelObject::sla_support_points, Slic3r::sla::UserModified, and Slic3r::sla::PadConfig::validate().

+ Here is the call graph for this function:

Member Data Documentation

◆ m_archiver

std::unique_ptr<SLAArchiveWriter> Slic3r::SLAPrint::m_archiver
private

Referenced by apply(), and export_print().

◆ m_cancel_callback

◆ m_cancel_status

◆ m_default_object_config

SLAPrintObjectConfig Slic3r::SLAPrint::m_default_object_config
private

Referenced by apply().

◆ m_full_print_config

DynamicPrintConfig Slic3r::PrintBase::m_full_print_config
protectedinherited

◆ m_id

◆ m_material_config

SLAMaterialConfig Slic3r::SLAPrint::m_material_config
private

Referenced by apply(), and validate().

◆ m_model

◆ m_objects

◆ m_placeholder_parser

PlaceholderParser Slic3r::PrintBase::m_placeholder_parser
protectedinherited

◆ m_print_config

SLAPrintConfig Slic3r::SLAPrint::m_print_config
private

Referenced by apply(), and output_filename().

◆ m_print_statistics

SLAPrintStatistics Slic3r::SLAPrint::m_print_statistics
private

Referenced by apply().

◆ m_printer_config

SLAPrinterConfig Slic3r::SLAPrint::m_printer_config
private

◆ m_printer_input

std::vector<PrintLayer> Slic3r::SLAPrint::m_printer_input
private

Referenced by apply().

◆ m_report_status

◆ m_state

PrintState<PrintStepEnum, COUNT> Slic3r::PrintBaseWithState< SLAPrintStep , COUNT >::m_state
privateinherited

◆ m_state_mutex

std::mutex Slic3r::PrintBase::m_state_mutex
mutableprivateinherited

◆ m_status_callback

◆ PrintStepEnumSize

constexpr const size_t Slic3r::PrintBaseWithState< SLAPrintStep , COUNT >::PrintStepEnumSize
staticconstexprinherited

◆ PrintTryCancel

friend Slic3r::PrintBase::PrintTryCancel
privateinherited

◆ s_last_id

size_t Slic3r::ObjectBase::s_last_id = 0
staticprivateinherited

◆ SLAPrintObject

friend Slic3r::SLAPrint::SLAPrintObject
private

Referenced by apply().


The documentation for this class was generated from the following files: