WIP: Reworked the infill generator to merge areas with the same

properties.

Note for Vojtech:
Review src/libslic3r/Fill/Fill.cpp once again,
add test for G-code generator properties (extrusion speed, cooling?)

Fixes Modifier slice/move efficiency #1005
This commit is contained in:
bubnikv 2019-09-04 16:11:16 +02:00
parent 308f601a99
commit d146a0237e
12 changed files with 376 additions and 259 deletions

View file

@ -34,7 +34,7 @@ Fill* Fill::new_from_type(const InfillPattern type)
case ipArchimedeanChords: return new FillArchimedeanChords();
case ipHilbertCurve: return new FillHilbertCurve();
case ipOctagramSpiral: return new FillOctagramSpiral();
default: throw std::invalid_argument("unknown type");;
default: throw std::invalid_argument("unknown type");
}
}
@ -45,6 +45,24 @@ Fill* Fill::new_from_type(const std::string &type)
return (it == enum_keys_map.end()) ? nullptr : new_from_type(InfillPattern(it->second));
}
// Force initialization of the Fill::use_bridge_flow() internal static map in a thread safe fashion even on compilers
// not supporting thread safe non-static data member initializers.
static bool use_bridge_flow_initializer = Fill::use_bridge_flow(ipGrid);
bool Fill::use_bridge_flow(const InfillPattern type)
{
static std::vector<unsigned char> cached;
if (cached.empty()) {
cached.assign(size_t(ipCount), 0);
for (size_t i = 0; i < cached.size(); ++ i) {
auto *fill = Fill::new_from_type((InfillPattern)i);
cached[i] = fill->use_bridge_flow();
delete fill;
}
}
return cached[type] != 0;
}
Polylines Fill::fill_surface(const Surface *surface, const FillParams &params)
{
// Perform offset.