From f337fdcc62fa8872b3a0b2257e5cd2d06df9ac80 Mon Sep 17 00:00:00 2001 From: ElectroQuanta Date: Sat, 1 Sep 2018 04:22:49 +0100 Subject: [PATCH] FIX: check bounds for fill->min_spacing causing fill_density<100 to abort (#4524) * FIX: check bounds for fill->min_spacing causing fill_density<100 to abort * Added time-stamping to SVG files * Delete .gitignore * Revert "Added time-stamping to SVG files" This reverts commit 625ad15b50fc0b5acc3011cfb1dfdc826ba78a4e. * Set a sane default instead of aborting. * Don't return status If there's an exceptional condition, should use exceptions instead. * Changing to not return bool. --- src/slic3r.cpp | 13 +++++++------ xs/src/libslic3r/SLAPrint.cpp | 6 +++++- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/slic3r.cpp b/src/slic3r.cpp index b0b311e04..b7556eae4 100644 --- a/src/slic3r.cpp +++ b/src/slic3r.cpp @@ -154,12 +154,13 @@ main(int argc, char **argv) boost::nowide::cout << "File exported to " << outfile << std::endl; } else if (cli_config.export_svg) { std::string outfile = cli_config.output.value; - if (outfile.empty()) outfile = model.objects.front()->input_file + ".svg"; - - SLAPrint print(&model); - print.config.apply(print_config, true); - print.slice(); - print.write_svg(outfile); + if (outfile.empty()) + outfile = model.objects.front()->input_file + ".svg"; + + SLAPrint print(&model); // initialize print with model + print.config.apply(print_config, true); // apply configuration + print.slice(); // slice file + print.write_svg(outfile); // write SVG boost::nowide::cout << "SVG file exported to " << outfile << std::endl; } else if (cli_config.export_3mf) { std::string outfile = cli_config.output.value; diff --git a/xs/src/libslic3r/SLAPrint.cpp b/xs/src/libslic3r/SLAPrint.cpp index ceb89018e..f6fd69844 100644 --- a/xs/src/libslic3r/SLAPrint.cpp +++ b/xs/src/libslic3r/SLAPrint.cpp @@ -63,7 +63,11 @@ SLAPrint::slice() fill->min_spacing = this->config.get_abs_value("infill_extrusion_width", this->config.layer_height.value); fill->angle = Geometry::deg2rad(this->config.fill_angle.value); fill->density = this->config.fill_density.value/100; - + + // Minimum spacing has a lower bound of > 0. Set to a sane default + // if the user gets an invalid value here. + fill->min_spacing = (fill->min_spacing <= 0 ? 0.5 : fill->min_spacing); + parallelize( 0, this->layers.size()-1,