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.
This commit is contained in:
ElectroQuanta 2018-09-01 04:22:49 +01:00 committed by Joseph Lenox
parent 37ade98017
commit f337fdcc62
2 changed files with 12 additions and 7 deletions

View File

@ -154,12 +154,13 @@ main(int argc, char **argv)
boost::nowide::cout << "File exported to " << outfile << std::endl; boost::nowide::cout << "File exported to " << outfile << std::endl;
} else if (cli_config.export_svg) { } else if (cli_config.export_svg) {
std::string outfile = cli_config.output.value; std::string outfile = cli_config.output.value;
if (outfile.empty()) outfile = model.objects.front()->input_file + ".svg"; if (outfile.empty())
outfile = model.objects.front()->input_file + ".svg";
SLAPrint print(&model);
print.config.apply(print_config, true); SLAPrint print(&model); // initialize print with model
print.slice(); print.config.apply(print_config, true); // apply configuration
print.write_svg(outfile); print.slice(); // slice file
print.write_svg(outfile); // write SVG
boost::nowide::cout << "SVG file exported to " << outfile << std::endl; boost::nowide::cout << "SVG file exported to " << outfile << std::endl;
} else if (cli_config.export_3mf) { } else if (cli_config.export_3mf) {
std::string outfile = cli_config.output.value; std::string outfile = cli_config.output.value;

View File

@ -63,7 +63,11 @@ SLAPrint::slice()
fill->min_spacing = this->config.get_abs_value("infill_extrusion_width", this->config.layer_height.value); 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->angle = Geometry::deg2rad(this->config.fill_angle.value);
fill->density = this->config.fill_density.value/100; 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<size_t>( parallelize<size_t>(
0, 0,
this->layers.size()-1, this->layers.size()-1,