This commit is contained in:
bubnikv 2019-09-27 09:52:57 +02:00
commit 4b35ebe6e5
49 changed files with 360 additions and 347 deletions

View file

@ -618,19 +618,21 @@ void arrange(ArrangePolygons & arrangables,
items.reserve(arrangables.size());
// Create Item from Arrangeable
auto process_arrangeable =
[](const ArrangePolygon &arrpoly, std::vector<Item> &outp)
auto process_arrangeable = [](const ArrangePolygon &arrpoly,
std::vector<Item> & outp)
{
Polygon p = arrpoly.poly.contour;
const Vec2crd & offs = arrpoly.translation;
double rotation = arrpoly.rotation;
Polygon p = arrpoly.poly.contour;
const Vec2crd &offs = arrpoly.translation;
double rotation = arrpoly.rotation;
if (p.is_counter_clockwise()) p.reverse();
clppr::Polygon clpath(Slic3rMultiPoint_to_ClipperPath(p));
auto firstp = clpath.Contour.front();
clpath.Contour.emplace_back(firstp);
if (!clpath.Contour.empty()) {
auto firstp = clpath.Contour.front();
clpath.Contour.emplace_back(firstp);
}
outp.emplace_back(std::move(clpath));
outp.back().rotation(rotation);

View file

@ -249,7 +249,7 @@ ConfigOption* ConfigOptionDef::create_default_option() const
// Special case: For a DynamicConfig, convert a templated enum to a generic enum.
new ConfigOptionEnumGeneric(this->enum_keys_map, this->default_value->getInt()) :
this->default_value->clone();
return this->create_empty_option();
return this->create_empty_option();
}
// Assignment of the serialization IDs is not thread safe. The Defs shall be initialized from the main thread!

View file

@ -353,7 +353,7 @@ public:
bool apply_override(const ConfigOption *rhs) override {
if (this->nullable())
throw std::runtime_error("Cannot override a nullable ConfigOption.");
if (rhs->type() != this->type())
if (rhs->type() != this->type())
throw std::runtime_error("ConfigOptionVector.apply_override() applied to different types.");
auto rhs_vec = static_cast<const ConfigOptionVector<T>*>(rhs);
if (! rhs->nullable()) {
@ -461,7 +461,7 @@ public:
for (const double &v : this->values) {
if (&v != &this->values.front())
ss << ",";
serialize_single_value(ss, v);
serialize_single_value(ss, v);
}
return ss.str();
}
@ -607,7 +607,7 @@ public:
for (const int &v : this->values) {
if (&v != &this->values.front())
ss << ",";
serialize_single_value(ss, v);
serialize_single_value(ss, v);
}
return ss.str();
}

View file

@ -15,40 +15,39 @@ namespace Slic3r {
struct SurfaceFillParams
{
SurfaceFillParams() : flow(0.f, 0.f, 0.f, false) { memset(this, 0, sizeof(*this)); }
// Zero based extruder ID.
unsigned int extruder;
unsigned int extruder = 0;
// Infill pattern, adjusted for the density etc.
InfillPattern pattern;
InfillPattern pattern = InfillPattern(0);
// FillBase
// in unscaled coordinates
coordf_t spacing;
coordf_t spacing = 0.;
// infill / perimeter overlap, in unscaled coordinates
coordf_t overlap;
coordf_t overlap = 0.;
// Angle as provided by the region config, in radians.
float angle;
float angle = 0.f;
// Non-negative for a bridge.
float bridge_angle;
float bridge_angle = 0.f;
// FillParams
float density;
float density = 0.f;
// Don't connect the fill lines around the inner perimeter.
bool dont_connect;
bool dont_connect = false;
// Don't adjust spacing to fill the space evenly.
bool dont_adjust;
bool dont_adjust = false;
// width, height of extrusion, nozzle diameter, is bridge
// For the output, for fill generator.
Flow flow;
Flow flow = Flow(0.f, 0.f, 0.f, false);
// For the output
ExtrusionRole extrusion_role;
ExtrusionRole extrusion_role = ExtrusionRole(0);
// Various print settings?
// Index of this entry in a linear vector.
size_t idx;
size_t idx = 0;
bool operator<(const SurfaceFillParams &rhs) const {

View file

@ -979,7 +979,7 @@ bool store_amf(const char *path, Model *model, const DynamicPrintConfig *config)
stream << layer_height_profile.front();
for (size_t i = 1; i < layer_height_profile.size(); ++i)
stream << ";" << layer_height_profile[i];
stream << "\n </metadata>\n";
stream << "\n </metadata>\n";
}
// Export layer height ranges including the layer range specific config overrides.

View file

@ -246,7 +246,7 @@ static void extract_model_from_archive(
sscanf(normal_buf[2], "%f", &facet.normal(2)) != 1) {
// Normal was mangled. Maybe denormals or "not a number" were stored?
// Just reset the normal and silently ignore it.
memset(&facet.normal, 0, sizeof(facet.normal));
facet.normal = stl_normal::Zero();
}
facets.emplace_back(facet);
}
@ -278,7 +278,7 @@ static void extract_model_from_archive(
instance->set_rotation(instance_rotation);
instance->set_scaling_factor(instance_scaling_factor);
instance->set_offset(instance_offset);
if (group_id != (size_t)-1)
if (group_id != (unsigned int)(-1))
group_to_model_object[group_id] = model_object;
} else {
// This is not the 1st mesh of a group. Add it to the ModelObject.

View file

@ -660,7 +660,7 @@ void GCode::do_export(Print *print, const char *path, GCodePreviewData *preview_
if (print->is_step_done(psGCodeExport) && boost::filesystem::exists(boost::filesystem::path(path)))
return;
print->set_started(psGCodeExport);
print->set_started(psGCodeExport);
BOOST_LOG_TRIVIAL(info) << "Exporting G-code..." << log_memory_info();
@ -1412,7 +1412,7 @@ static bool custom_gcode_sets_temperature(const std::string &gcode, const int mc
// Skip the rest of the line.
for (; *ptr != 0 && *ptr != '\r' && *ptr != '\n'; ++ ptr);
// Skip the end of line indicators.
for (; *ptr == '\r' || *ptr == '\n'; ++ ptr);
for (; *ptr == '\r' || *ptr == '\n'; ++ ptr);
}
return temp_set_by_gcode;
}

View file

@ -359,7 +359,7 @@ std::string GCodePreviewData::get_legend_title() const
case Extrusion::Feedrate:
return L("Speed (mm/s)");
case Extrusion::VolumetricRate:
return L("Volumetric flow rate (mm3/s)");
return L("Volumetric flow rate (mm³/s)");
case Extrusion::Tool:
return L("Tool");
case Extrusion::ColorPrint:

View file

@ -308,7 +308,7 @@ void ToolOrdering::fill_wipe_tower_partitions(const PrintConfig &config, coordf_
LayerTools lt_new(0.5f * (lt.print_z + lt_object.print_z));
// Find the 1st layer above lt_new.
for (j = i + 1; j < m_layer_tools.size() && m_layer_tools[j].print_z < lt_new.print_z - EPSILON; ++ j);
if (std::abs(m_layer_tools[j].print_z - lt_new.print_z) < EPSILON) {
if (std::abs(m_layer_tools[j].print_z - lt_new.print_z) < EPSILON) {
m_layer_tools[j].has_wipe_tower = true;
} else {
LayerTools &lt_extra = *m_layer_tools.insert(m_layer_tools.begin() + j, lt_new);

View file

@ -698,7 +698,7 @@ WipeTower::ToolChangeResult WipeTower::tool_change(size_t tool, bool last_in_lay
writer.append(std::string("; material : " + (m_current_tool < m_filpar.size() ? m_filpar[m_current_tool].material : "(NONE)") + " -> " + m_filpar[tool].material + "\n").c_str())
.append(";--------------------\n");
writer.speed_override_backup();
writer.speed_override_backup();
writer.speed_override(100);
Vec2f initial_position = cleaning_box.ld + Vec2f(0.f, m_depth_traversed);
@ -748,7 +748,7 @@ WipeTower::ToolChangeResult WipeTower::tool_change(size_t tool, bool last_in_lay
if (m_current_tool < m_used_filament_length.size())
m_used_filament_length[m_current_tool] += writer.get_and_reset_used_filament_length();
ToolChangeResult result;
ToolChangeResult result;
result.priming = false;
result.initial_tool = int(old_tool);
result.new_tool = int(m_current_tool);
@ -806,7 +806,7 @@ WipeTower::ToolChangeResult WipeTower::toolchange_Brim(bool sideOnly, float y_of
if (m_current_tool < m_used_filament_length.size())
m_used_filament_length[m_current_tool] += writer.get_and_reset_used_filament_length();
ToolChangeResult result;
ToolChangeResult result;
result.priming = false;
result.initial_tool = int(old_tool);
result.new_tool = int(m_current_tool);
@ -1163,7 +1163,7 @@ WipeTower::ToolChangeResult WipeTower::finish_layer()
writer.extrude(box.rd.x() - m_perimeter_width / 2.f, writer.y() + 0.5f * step);
writer.extrude(box.ld.x() + m_perimeter_width / 2.f, writer.y());
}
writer.travel(box.rd.x()-m_perimeter_width/2.f,writer.y()); // wipe the nozzle
writer.travel(box.rd.x()-m_perimeter_width/2.f,writer.y()); // wipe the nozzle
}
else { // Extrude a sparse infill to support the material to be printed above.
const float dy = (fill_box.lu.y() - fill_box.ld.y() - m_perimeter_width);
@ -1196,7 +1196,7 @@ WipeTower::ToolChangeResult WipeTower::finish_layer()
if (m_current_tool < m_used_filament_length.size())
m_used_filament_length[m_current_tool] += writer.get_and_reset_used_filament_length();
ToolChangeResult result;
ToolChangeResult result;
result.priming = false;
result.initial_tool = int(old_tool);
result.new_tool = int(m_current_tool);

View file

@ -144,7 +144,7 @@ void LayerRegion::process_external_surfaces(const Layer *lower_layer, const Poly
}
if (! lower_layer_covered->empty())
voids = diff(voids, *lower_layer_covered);
fill_boundaries = diff(fill_boundaries, voids);
fill_boundaries = diff(fill_boundaries, voids);
}
}
@ -473,4 +473,4 @@ void LayerRegion::export_region_fill_surfaces_to_svg_debug(const char *name) con
}
}

View file

@ -1462,7 +1462,7 @@ stl_stats ModelObject::get_object_stl_stats() const
return this->volumes[0]->mesh().stl.stats;
stl_stats full_stats;
memset(&full_stats, 0, sizeof(stl_stats));
full_stats.volume = 0.f;
// fill full_stats from all objet's meshes
for (ModelVolume* volume : this->volumes)

View file

@ -253,7 +253,7 @@ bool Print::is_step_done(PrintObjectStep step) const
{
if (m_objects.empty())
return false;
tbb::mutex::scoped_lock lock(this->state_mutex());
tbb::mutex::scoped_lock lock(this->state_mutex());
for (const PrintObject *object : m_objects)
if (! object->is_step_done_unguarded(step))
return false;

View file

@ -268,8 +268,7 @@ public:
std::string text;
// Bitmap of flags.
enum FlagBits {
DEFAULT,
NO_RELOAD_SCENE = 0,
DEFAULT = 0,
RELOAD_SCENE = 1 << 1,
RELOAD_SLA_SUPPORT_POINTS = 1 << 2,
RELOAD_SLA_PREVIEW = 1 << 3,

View file

@ -1475,7 +1475,7 @@ SlicingParameters PrintObject::slicing_parameters(const DynamicPrintConfig& full
if (object_max_z <= 0.f)
object_max_z = (float)model_object.raw_bounding_box().size().z();
return SlicingParameters::create_from_config(print_config, object_config, object_max_z, object_extruders);
return SlicingParameters::create_from_config(print_config, object_config, object_max_z, object_extruders);
}
// returns 0-based indices of extruders used to print the object (without brim, support and other helper extrusions)

View file

@ -783,7 +783,7 @@ namespace SupportMaterialInternal {
for (const ExtrusionPath &ep : loop.paths)
if (ep.role() == erOverhangPerimeter && ! ep.polyline.empty())
return ep.size() >= (ep.is_closed() ? 3 : 2);
return false;
return false;
}
static bool has_bridging_perimeters(const ExtrusionEntityCollection &perimeters)
{
@ -2125,7 +2125,7 @@ void PrintObjectSupportMaterial::trim_support_layers_by_object(
}
// $layer->slices contains the full shape of layer, thus including
// perimeter's width. $support contains the full shape of support
// material, thus including the width of its foremost extrusion.
// material, thus including the width of its foremost extrusion.
// We leave a gap equal to a full extrusion width.
support_layer.polygons = diff(support_layer.polygons, polygons_trimming);
}
@ -2934,20 +2934,13 @@ void PrintObjectSupportMaterial::generate_toolpaths(
// Prepare fillers.
SupportMaterialPattern support_pattern = m_object_config->support_material_pattern;
bool with_sheath = m_object_config->support_material_with_sheath;
InfillPattern infill_pattern;
InfillPattern infill_pattern = (support_pattern == smpHoneycomb ? ipHoneycomb : ipRectilinear);
std::vector<float> angles;
angles.push_back(base_angle);
switch (support_pattern) {
case smpRectilinearGrid:
if (support_pattern == smpRectilinearGrid)
angles.push_back(interface_angle);
// fall through
case smpRectilinear:
infill_pattern = ipRectilinear;
break;
case smpHoneycomb:
infill_pattern = ipHoneycomb;
break;
}
BoundingBox bbox_object(Point(-scale_(1.), -scale_(1.0)), Point(scale_(1.), scale_(1.)));
// const coordf_t link_max_length_factor = 3.;
@ -3217,7 +3210,7 @@ void PrintObjectSupportMaterial::generate_toolpaths(
density = 0.5f;
flow = m_first_layer_flow;
// use the proper spacing for first layer as we don't need to align
// its pattern to the other layers
// its pattern to the other layers
//FIXME When paralellizing, each thread shall have its own copy of the fillers.
filler->spacing = flow.spacing();
filler->link_max_length = coord_t(scale_(filler->spacing * link_max_length_factor / density));