mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-14 02:05:56 +08:00
end fix enum visibility
thanks to hmflash for the help.
This commit is contained in:
parent
1afaa6ef49
commit
3e517ac50b
@ -425,8 +425,8 @@ int CLI::run(int argc, char **argv)
|
|||||||
fff_print.auto_assign_extruders(mo);
|
fff_print.auto_assign_extruders(mo);
|
||||||
}
|
}
|
||||||
print->apply(model, m_print_config);
|
print->apply(model, m_print_config);
|
||||||
std::pair<PrintValidationError, std::string> err = print->validate();
|
std::pair<PrintBase::PrintValidationError, std::string> err = print->validate();
|
||||||
if (! err.first == PrintValidationError::None) {
|
if (err.first != PrintBase::PrintValidationError::None) {
|
||||||
boost::nowide::cerr << err.second << std::endl;
|
boost::nowide::cerr << err.second << std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include "MillingPostProcess.hpp"
|
#include "MillingPostProcess.hpp"
|
||||||
#include "../Layer.hpp"
|
#include "../Layer.hpp"
|
||||||
#include "../ClipperUtils.hpp"
|
#include "../ClipperUtils.hpp"
|
||||||
|
#include "../BoundingBox.hpp"
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
|
|
||||||
|
@ -229,12 +229,7 @@ public:
|
|||||||
// or after apply() over a model, where no object is printable (all outside the print volume).
|
// or after apply() over a model, where no object is printable (all outside the print volume).
|
||||||
virtual bool empty() const = 0;
|
virtual bool empty() const = 0;
|
||||||
|
|
||||||
enum PrintValidationError {
|
enum class PrintValidationError {None,WrongPosition,NoPrint,WrongSettings};
|
||||||
None,
|
|
||||||
WrongPosition,
|
|
||||||
NoPrint,
|
|
||||||
WrongSettings,
|
|
||||||
};
|
|
||||||
|
|
||||||
// Validate the print, return empty string if valid, return error if process() cannot (or should not) be started.
|
// Validate the print, return empty string if valid, return error if process() cannot (or should not) be started.
|
||||||
virtual std::pair<PrintValidationError, std::string> validate() const { return { PrintValidationError::None, std::string() }; }
|
virtual std::pair<PrintValidationError, std::string> validate() const { return { PrintValidationError::None, std::string() }; }
|
||||||
|
@ -612,7 +612,7 @@ std::pair<PrintBase::PrintValidationError, std::string> SLAPrint::validate() con
|
|||||||
if(supports_en &&
|
if(supports_en &&
|
||||||
mo->sla_points_status == sla::PointsStatus::UserModified &&
|
mo->sla_points_status == sla::PointsStatus::UserModified &&
|
||||||
mo->sla_support_points.empty())
|
mo->sla_support_points.empty())
|
||||||
return { PrintValidationError::WrongSettings, L("Cannot proceed without support points! "
|
return { PrintBase::PrintValidationError::WrongSettings, L("Cannot proceed without support points! "
|
||||||
"Add support points or disable support generation.") };
|
"Add support points or disable support generation.") };
|
||||||
|
|
||||||
sla::SupportConfig cfg = make_support_cfg(po->config());
|
sla::SupportConfig cfg = make_support_cfg(po->config());
|
||||||
@ -623,13 +623,13 @@ std::pair<PrintBase::PrintValidationError, std::string> SLAPrint::validate() con
|
|||||||
sla::PadConfig::EmbedObject &builtinpad = padcfg.embed_object;
|
sla::PadConfig::EmbedObject &builtinpad = padcfg.embed_object;
|
||||||
|
|
||||||
if(supports_en && !builtinpad.enabled && elv < cfg.head_fullwidth())
|
if(supports_en && !builtinpad.enabled && elv < cfg.head_fullwidth())
|
||||||
return { PrintValidationError::WrongSettings, L(
|
return { PrintBase::PrintValidationError::WrongSettings, L(
|
||||||
"Elevation is too low for object. Use the \"Pad around "
|
"Elevation is too low for object. Use the \"Pad around "
|
||||||
"object\" feature to print the object without elevation.") };
|
"object\" feature to print the object without elevation.") };
|
||||||
|
|
||||||
if(supports_en && builtinpad.enabled &&
|
if(supports_en && builtinpad.enabled &&
|
||||||
cfg.pillar_base_safety_distance_mm < builtinpad.object_gap_mm) {
|
cfg.pillar_base_safety_distance_mm < builtinpad.object_gap_mm) {
|
||||||
return { PrintValidationError::WrongSettings, L(
|
return { PrintBase::PrintValidationError::WrongSettings, L(
|
||||||
"The endings of the support pillars will be deployed on the "
|
"The endings of the support pillars will be deployed on the "
|
||||||
"gap between the object and the pad. 'Support base safety "
|
"gap between the object and the pad. 'Support base safety "
|
||||||
"distance' has to be greater than the 'Pad object gap' "
|
"distance' has to be greater than the 'Pad object gap' "
|
||||||
@ -637,7 +637,7 @@ std::pair<PrintBase::PrintValidationError, std::string> SLAPrint::validate() con
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string pval = padcfg.validate();
|
std::string pval = padcfg.validate();
|
||||||
if (!pval.empty()) return { PrintValidationError::WrongSettings, pval };
|
if (!pval.empty()) return { PrintBase::PrintValidationError::WrongSettings, pval };
|
||||||
}
|
}
|
||||||
|
|
||||||
double expt_max = m_printer_config.max_exposure_time.getFloat();
|
double expt_max = m_printer_config.max_exposure_time.getFloat();
|
||||||
@ -645,16 +645,16 @@ std::pair<PrintBase::PrintValidationError, std::string> SLAPrint::validate() con
|
|||||||
double expt_cur = m_material_config.exposure_time.getFloat();
|
double expt_cur = m_material_config.exposure_time.getFloat();
|
||||||
|
|
||||||
if (expt_cur < expt_min || expt_cur > expt_max)
|
if (expt_cur < expt_min || expt_cur > expt_max)
|
||||||
return { PrintValidationError::WrongSettings, L("Exposition time is out of printer profile bounds.") };
|
return { PrintBase::PrintValidationError::WrongSettings, L("Exposition time is out of printer profile bounds.") };
|
||||||
|
|
||||||
double iexpt_max = m_printer_config.max_initial_exposure_time.getFloat();
|
double iexpt_max = m_printer_config.max_initial_exposure_time.getFloat();
|
||||||
double iexpt_min = m_printer_config.min_initial_exposure_time.getFloat();
|
double iexpt_min = m_printer_config.min_initial_exposure_time.getFloat();
|
||||||
double iexpt_cur = m_material_config.initial_exposure_time.getFloat();
|
double iexpt_cur = m_material_config.initial_exposure_time.getFloat();
|
||||||
|
|
||||||
if (iexpt_cur < iexpt_min || iexpt_cur > iexpt_max)
|
if (iexpt_cur < iexpt_min || iexpt_cur > iexpt_max)
|
||||||
return { PrintValidationError::WrongSettings, L("Initial exposition time is out of printer profile bounds.") };
|
return { PrintBase::PrintValidationError::WrongSettings, L("Initial exposition time is out of printer profile bounds.") };
|
||||||
|
|
||||||
return { PrintValidationError::None, "" };
|
return { PrintBase::PrintValidationError::None, "" };
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SLAPrint::invalidate_step(SLAPrintStep step)
|
bool SLAPrint::invalidate_step(SLAPrintStep step)
|
||||||
|
@ -432,7 +432,7 @@ public:
|
|||||||
|
|
||||||
const SLAPrintStatistics& print_statistics() const { return m_print_statistics; }
|
const SLAPrintStatistics& print_statistics() const { return m_print_statistics; }
|
||||||
|
|
||||||
std::pair<PrintValidationError, std::string> validate() const override;
|
std::pair<PrintBase::PrintValidationError, std::string> validate() const override;
|
||||||
|
|
||||||
// An aggregation of SliceRecord-s from all the print objects for each
|
// An aggregation of SliceRecord-s from all the print objects for each
|
||||||
// occupied layer. Slice record levels dont have to match exactly.
|
// occupied layer. Slice record levels dont have to match exactly.
|
||||||
|
@ -373,7 +373,7 @@ bool BackgroundSlicingProcess::empty() const
|
|||||||
return m_print->empty();
|
return m_print->empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<PrintValidationError, std::string> BackgroundSlicingProcess::validate()
|
std::pair<PrintBase::PrintValidationError, std::string> BackgroundSlicingProcess::validate()
|
||||||
{
|
{
|
||||||
assert(m_print != nullptr);
|
assert(m_print != nullptr);
|
||||||
return m_print->validate();
|
return m_print->validate();
|
||||||
|
@ -94,7 +94,7 @@ public:
|
|||||||
bool empty() const;
|
bool empty() const;
|
||||||
// Validate the print. Returns a {PrintValidationError::None,empty string} if valid, returns an error message if invalid.
|
// Validate the print. Returns a {PrintValidationError::None,empty string} if valid, returns an error message if invalid.
|
||||||
// Call validate before calling start().
|
// Call validate before calling start().
|
||||||
std::pair<PrintValidationError, std::string> validate();
|
std::pair<PrintBase::PrintValidationError, std::string> validate();
|
||||||
|
|
||||||
// Set the export path of the G-code.
|
// Set the export path of the G-code.
|
||||||
// Once the path is set, the G-code
|
// Once the path is set, the G-code
|
||||||
|
@ -2560,7 +2560,7 @@ std::vector<size_t> Plater::priv::load_model_objects(const ModelObjectPtrs &mode
|
|||||||
ModelInstancePtrs new_instances;
|
ModelInstancePtrs new_instances;
|
||||||
#endif /* AUTOPLACEMENT_ON_LOAD */
|
#endif /* AUTOPLACEMENT_ON_LOAD */
|
||||||
for (ModelObject *model_object : model_objects) {
|
for (ModelObject *model_object : model_objects) {
|
||||||
auto *object = model.add_object(*model_object);
|
ModelObject *object = model.add_object(*model_object);
|
||||||
std::string object_name = object->name.empty() ? fs::path(object->input_file).filename().string() : object->name;
|
std::string object_name = object->name.empty() ? fs::path(object->input_file).filename().string() : object->name;
|
||||||
obj_idxs.push_back(obj_count++);
|
obj_idxs.push_back(obj_count++);
|
||||||
|
|
||||||
@ -3166,9 +3166,9 @@ unsigned int Plater::priv::update_background_process(bool force_validation, bool
|
|||||||
// The delayed error message is no more valid.
|
// The delayed error message is no more valid.
|
||||||
this->delayed_error_message.clear();
|
this->delayed_error_message.clear();
|
||||||
// The state of the Print changed, and it is non-zero. Let's validate it and give the user feedback on errors.
|
// The state of the Print changed, and it is non-zero. Let's validate it and give the user feedback on errors.
|
||||||
std::pair<PrintValidationError, std::string> err = this->background_process.validate();
|
std::pair<PrintBase::PrintValidationError, std::string> err = this->background_process.validate();
|
||||||
this->get_current_canvas3D()->show_print_warning("");
|
this->get_current_canvas3D()->show_print_warning("");
|
||||||
if (err.first == PrintValidationError::None) {
|
if (err.first == PrintBase::PrintValidationError::None) {
|
||||||
if (invalidated != Print::APPLY_STATUS_UNCHANGED && this->background_processing_enabled())
|
if (invalidated != Print::APPLY_STATUS_UNCHANGED && this->background_processing_enabled())
|
||||||
return_state |= UPDATE_BACKGROUND_PROCESS_RESTART;
|
return_state |= UPDATE_BACKGROUND_PROCESS_RESTART;
|
||||||
} else {
|
} else {
|
||||||
@ -3178,7 +3178,7 @@ unsigned int Plater::priv::update_background_process(bool force_validation, bool
|
|||||||
while (p->GetParent())
|
while (p->GetParent())
|
||||||
p = p->GetParent();
|
p = p->GetParent();
|
||||||
auto *top_level_wnd = dynamic_cast<wxTopLevelWindow*>(p);
|
auto *top_level_wnd = dynamic_cast<wxTopLevelWindow*>(p);
|
||||||
if ( (err.first == PrintValidationError::WrongPosition || err.first == PrintValidationError::NoPrint) && top_level_wnd && top_level_wnd->IsActive()) {
|
if ( (err.first == PrintBase::PrintValidationError::WrongPosition || err.first == PrintBase::PrintValidationError::NoPrint) && top_level_wnd && top_level_wnd->IsActive()) {
|
||||||
this->get_current_canvas3D()->show_print_warning(err.second);
|
this->get_current_canvas3D()->show_print_warning(err.second);
|
||||||
} else if (!postpone_error_messages && top_level_wnd && top_level_wnd->IsActive()) {
|
} else if (!postpone_error_messages && top_level_wnd && top_level_wnd->IsActive()) {
|
||||||
// The error returned from the Print needs to be translated into the local language.
|
// The error returned from the Print needs to be translated into the local language.
|
||||||
|
@ -293,7 +293,7 @@ void init_print(Print& print, std::initializer_list<TestMesh> meshes, Slic3r::Mo
|
|||||||
}
|
}
|
||||||
print.apply(model, config);
|
print.apply(model, config);
|
||||||
|
|
||||||
std::pair<PrintValidationError, std::string> err = print.validate();
|
std::pair<PrintBase::PrintValidationError, std::string> err = print.validate();
|
||||||
//std::cout << "validate result : " << err << ", mempty print? " << print.empty() << "\n";
|
//std::cout << "validate result : " << err << ", mempty print? " << print.empty() << "\n";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user