mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-11 08:47:52 -06:00
Fix of G-code invalidation on "wipe_into_object" "wipe_into_infill"
changes. WIP: Fix of "levitating objects cannot be sliced".
This commit is contained in:
parent
2be23c8b14
commit
506cbcb4a7
3 changed files with 27 additions and 10 deletions
|
@ -17,6 +17,16 @@ Layer::~Layer()
|
||||||
m_regions.clear();
|
m_regions.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Test whether whether there are any slices assigned to this layer.
|
||||||
|
bool Layer::empty() const
|
||||||
|
{
|
||||||
|
for (const LayerRegion *layerm : m_regions)
|
||||||
|
if (layerm != nullptr && ! layerm->slices.empty())
|
||||||
|
// Non empty layer.
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
LayerRegion* Layer::add_region(PrintRegion* print_region)
|
LayerRegion* Layer::add_region(PrintRegion* print_region)
|
||||||
{
|
{
|
||||||
m_regions.emplace_back(new LayerRegion(this, print_region));
|
m_regions.emplace_back(new LayerRegion(this, print_region));
|
||||||
|
|
|
@ -114,7 +114,8 @@ public:
|
||||||
LayerRegion* get_region(int idx) { return m_regions[idx]; }
|
LayerRegion* get_region(int idx) { return m_regions[idx]; }
|
||||||
LayerRegion* add_region(PrintRegion* print_region);
|
LayerRegion* add_region(PrintRegion* print_region);
|
||||||
const LayerRegionPtrs& regions() const { return m_regions; }
|
const LayerRegionPtrs& regions() const { return m_regions; }
|
||||||
|
// Test whether whether there are any slices assigned to this layer.
|
||||||
|
bool empty() const;
|
||||||
void make_slices();
|
void make_slices();
|
||||||
void merge_slices();
|
void merge_slices();
|
||||||
template <class T> bool any_internal_region_slice_contains(const T &item) const {
|
template <class T> bool any_internal_region_slice_contains(const T &item) const {
|
||||||
|
|
|
@ -384,6 +384,12 @@ void PrintObject::generate_support_material()
|
||||||
m_print->set_status(85, "Generating support material");
|
m_print->set_status(85, "Generating support material");
|
||||||
this->_generate_support_material();
|
this->_generate_support_material();
|
||||||
m_print->throw_if_canceled();
|
m_print->throw_if_canceled();
|
||||||
|
} else {
|
||||||
|
// Printing without supports. Empty layer means some objects or object parts are levitating,
|
||||||
|
// therefore they cannot be printed without supports.
|
||||||
|
for (const Layer *layer : m_layers)
|
||||||
|
if (layer->empty())
|
||||||
|
throw std::runtime_error("Levitating objects cannot be printed without supports.");
|
||||||
}
|
}
|
||||||
this->set_done(posSupportMaterial);
|
this->set_done(posSupportMaterial);
|
||||||
}
|
}
|
||||||
|
@ -522,11 +528,13 @@ bool PrintObject::invalidate_state_by_config_options(const std::vector<t_config_
|
||||||
|| opt_key == "perimeter_speed"
|
|| opt_key == "perimeter_speed"
|
||||||
|| opt_key == "small_perimeter_speed"
|
|| opt_key == "small_perimeter_speed"
|
||||||
|| opt_key == "solid_infill_speed"
|
|| opt_key == "solid_infill_speed"
|
||||||
|| opt_key == "top_solid_infill_speed"
|
|| opt_key == "top_solid_infill_speed") {
|
||||||
|| opt_key == "wipe_into_infill" // when these these two are changed, we only need to invalidate the wipe tower,
|
invalidated |= m_print->invalidate_step(psGCodeExport);
|
||||||
|| opt_key == "wipe_into_objects" // which we already did at the very beginning - nothing more to be done
|
} else if (
|
||||||
) {
|
opt_key == "wipe_into_infill"
|
||||||
// these options only affect G-code export, so nothing to invalidate
|
|| opt_key == "wipe_into_objects") {
|
||||||
|
invalidated |= m_print->invalidate_step(psWipeTower);
|
||||||
|
invalidated |= m_print->invalidate_step(psGCodeExport);
|
||||||
} else {
|
} else {
|
||||||
// for legacy, if we can't handle this option let's invalidate all steps
|
// for legacy, if we can't handle this option let's invalidate all steps
|
||||||
this->invalidate_all_steps();
|
this->invalidate_all_steps();
|
||||||
|
@ -1463,10 +1471,8 @@ void PrintObject::_slice()
|
||||||
BOOST_LOG_TRIVIAL(debug) << "Slicing objects - removing top empty layers";
|
BOOST_LOG_TRIVIAL(debug) << "Slicing objects - removing top empty layers";
|
||||||
while (! m_layers.empty()) {
|
while (! m_layers.empty()) {
|
||||||
const Layer *layer = m_layers.back();
|
const Layer *layer = m_layers.back();
|
||||||
for (size_t region_id = 0; region_id < this->region_volumes.size(); ++ region_id)
|
if (! layer->empty())
|
||||||
if (layer->m_regions[region_id] != nullptr && ! layer->m_regions[region_id]->slices.empty())
|
goto end;
|
||||||
// Non empty layer.
|
|
||||||
goto end;
|
|
||||||
delete layer;
|
delete layer;
|
||||||
m_layers.pop_back();
|
m_layers.pop_back();
|
||||||
if (! m_layers.empty())
|
if (! m_layers.empty())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue