WIP: Command line slicing for SLA.

Removed some layer height editing bindings from Perl.
This commit is contained in:
bubnikv 2018-12-11 13:16:09 +01:00
parent 5e077c5edf
commit e0cf7ecd22
2 changed files with 26 additions and 17 deletions

View File

@ -27,6 +27,7 @@
#include "libslic3r/Geometry.hpp"
#include "libslic3r/Model.hpp"
#include "libslic3r/Print.hpp"
#include "libslic3r/SLAPrint.hpp"
#include "libslic3r/TriangleMesh.hpp"
#include "libslic3r/Format/3mf.hpp"
#include "libslic3r/Utils.hpp"
@ -105,7 +106,7 @@ int main(int argc, char **argv)
}
// load config files supplied via --load
for (const std::string &file : cli_config.load.values) {
if (!boost::filesystem::exists(file)) {
if (! boost::filesystem::exists(file)) {
boost::nowide::cout << "No such file: " << file << std::endl;
exit(1);
}
@ -206,22 +207,35 @@ int main(int argc, char **argv)
// lower.mesh().write_binary((outfile + "_lower.stl").c_str());
}
} else if (cli_config.slice) {
PrinterTechnology printer_technology = print_config.option<ConfigOptionEnum<PrinterTechnology>>("printer_technology", true)->value;
std::string outfile = cli_config.output.value;
Print print;
Print fff_print;
SLAPrint sla_print;
PrintBase *print = (printer_technology == ptFFF) ? static_cast<PrintBase*>(&fff_print) : static_cast<PrintBase*>(&sla_print);
if (! cli_config.dont_arrange) {
model.arrange_objects(print.config().min_object_distance());
//FIXME make the min_object_distance configurable.
model.arrange_objects(fff_print.config().min_object_distance());
model.center_instances_around_point(cli_config.print_center);
}
if (outfile.empty())
outfile = model.propose_export_file_name() + ".gcode";
for (auto* mo : model.objects)
print.auto_assign_extruders(mo);
if (outfile.empty()) {
outfile = model.propose_export_file_name();
outfile += (printer_technology == ptFFF) ? ".gcode" : ".zip";
}
if (printer_technology == ptFFF) {
for (auto* mo : model.objects)
fff_print.auto_assign_extruders(mo);
}
print_config.normalize();
print.apply(model, print_config);
std::string err = print.validate();
if (err.empty())
print.export_gcode(outfile, nullptr);
else
print->apply(model, print_config);
std::string err = print->validate();
if (err.empty()) {
if (printer_technology == ptFFF) {
fff_print.export_gcode(outfile, nullptr);
} else {
assert(printer_technology == ptSLA);
//FIXME add the output here
}
} else
std::cerr << err << "\n";
} else {
boost::nowide::cerr << "error: command not supported" << std::endl;

View File

@ -211,11 +211,6 @@ ModelMaterial::attributes()
void set_layer_height_ranges(t_layer_height_ranges ranges)
%code%{ THIS->layer_height_ranges = ranges; %};
std::vector<double> layer_height_profile()
%code%{ RETVAL = THIS->layer_height_profile_valid ? THIS->layer_height_profile : std::vector<double>(); %};
void set_layer_height_profile(std::vector<double> profile)
%code%{ THIS->layer_height_profile = profile; THIS->layer_height_profile_valid = true; %};
Ref<Vec3d> origin_translation()
%code%{ RETVAL = &THIS->origin_translation; %};
void set_origin_translation(Vec3d* point)