Fix Compile Warnings (#5963)

* Fix calls to depreciated wxPen constructor

* Fix use of wxTimerEvent

* Fix unrecognized character escape sequence

* Fix signed/unsigned mismatch

At least as much as possible without significantly altering parts of the application

* Clean unreferenced variables

* fix mistyped namespace selector

* Update deprecated calls

* Fix preprocessor statement

* Remove empty switch statements

* Change int vector used as bool to bool vector

* Remove empty control statements and related unused code

* Change multi character constant to string constant

* Fix discarded return value

json::parse was being called on the object, rather than statically like it should be. Also, the value was not being captured.

* Rename ICON_SIZE def used by MultiMachine

By having the definition in the header, it causes issues when other files define ICON_SIZE. By renaming it to MM_ICON_SIZE, this lessens the issue. It would probably be ideal to have the definitions in the respective .cpp that use them, but it would make it less convenient to update the values if needed in the future.

* Remove unused includes

* Fix linux/macOS compilation

* Hide unused-function errors on non-Windows systems

* Disable signed/unsigned comparison mismatch error

* Remove/Disable more unused variables

Still TODO: check double for loop in Print.cpp

* Remove unused variable that was missed

* Remove unused variables in libraries in the src folder

* Apply temporary fix for subobject linkage error

* Remove/Disable last set of unused variables reported by GCC

* remove redundant for loop

* fix misspelled ifdef check

* Update message on dialog

* Fix hard-coded platform specific modifier keys

* Remove duplicate for loop

* Disable -Wmisleading-indentation warning

* disable -Wswitch warning

* Remove unused local typedefs

* Fix -Wunused-value

* Fix pragma error on Windows from subobject linkage fix

* Fix -Waddress

* Fix null conversions (-Wconversion-null)

---------

Co-authored-by: SoftFever <softfeverever@gmail.com>
This commit is contained in:
Ocraftyone 2024-07-29 09:00:26 -04:00 committed by GitHub
parent b40853af94
commit b83e16dbdd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
187 changed files with 494 additions and 1101 deletions

View file

@ -18,9 +18,7 @@
#include <boost/nowide/cenv.hpp>
#include <boost/nowide/fstream.hpp>
#include <boost/property_tree/ini_parser.hpp>
#include <boost/property_tree/ptree_fwd.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/format/format_fwd.hpp>
#include <boost/log/trivial.hpp>
#include <boost/uuid/uuid.hpp>
#include <boost/uuid/uuid_generators.hpp>

View file

@ -1,7 +1,6 @@
//Copyright (c) 2022 Ultimaker B.V.
//CuraEngine is released under the terms of the AGPLv3 or higher.
#include <cassert>
#include "BeadingStrategy.hpp"
#include "Point.hpp"

View file

@ -9,7 +9,6 @@
#include "RedistributeBeadingStrategy.hpp"
#include "OuterWallInsetBeadingStrategy.hpp"
#include <limits>
#include <boost/log/trivial.hpp>
namespace Slic3r::Arachne

View file

@ -3,7 +3,6 @@
#include "RedistributeBeadingStrategy.hpp"
#include <algorithm>
#include <numeric>
namespace Slic3r::Arachne

View file

@ -1595,7 +1595,6 @@ SkeletalTrapezoidation::edge_t* SkeletalTrapezoidation::getQuadMaxRedgeTo(edge_t
void SkeletalTrapezoidation::propagateBeadingsUpward(std::vector<edge_t*>& upward_quad_mids, ptr_vector_t<BeadingPropagation>& node_beadings)
{
const auto _central_filter_dist = central_filter_dist();
for (auto upward_quad_mids_it = upward_quad_mids.rbegin(); upward_quad_mids_it != upward_quad_mids.rend(); ++upward_quad_mids_it)
{
edge_t* upward_edge = *upward_quad_mids_it;
@ -1612,7 +1611,7 @@ void SkeletalTrapezoidation::propagateBeadingsUpward(std::vector<edge_t*>& upwar
{ // Only propagate to places where there is place
continue;
}
assert((upward_edge->from->data.distance_to_boundary != upward_edge->to->data.distance_to_boundary || shorter_then(upward_edge->to->p - upward_edge->from->p, _central_filter_dist)) && "zero difference R edges should always be central");
assert((upward_edge->from->data.distance_to_boundary != upward_edge->to->data.distance_to_boundary || shorter_then(upward_edge->to->p - upward_edge->from->p, central_filter_dist())) && "zero difference R edges should always be central");
coord_t length = (upward_edge->to->p - upward_edge->from->p).cast<int64_t>().norm();
BeadingPropagation upper_beading = lower_beading;
upper_beading.dist_to_bottom_source += length;

View file

@ -7,9 +7,6 @@
#include <boost/log/trivial.hpp>
#include "utils/linearAlg2D.hpp"
#include "../Line.hpp"
namespace Slic3r::Arachne
{

View file

@ -4,7 +4,6 @@
#include <algorithm>
#include "ExtrusionLine.hpp"
#include "linearAlg2D.hpp"
#include "../../VariableWidth.hpp"
namespace Slic3r::Arachne

View file

@ -2,7 +2,6 @@
//CuraEngine is released under the terms of the AGPLv3 or higher.
#include "SquareGrid.hpp"
#include "../../Point.hpp"
using namespace Slic3r::Arachne;

View file

@ -199,23 +199,19 @@ void update_selected_items_axis_align(ArrangePolygons& selected, const DynamicPr
}
if (std::abs(a00) > EPSILON) {
double db1_2, db1_6, db1_12, db1_24, db1_20, db1_60;
double m00, m10, m01, m20, m11, m02, m30, m21, m12, m03;
double db1_2, db1_6, db1_12, db1_24;
double m00, m10, m01, m20, m11, m02;
if (a00 > 0) {
db1_2 = 0.5;
db1_6 = 0.16666666666666666666666666666667;
db1_12 = 0.083333333333333333333333333333333;
db1_24 = 0.041666666666666666666666666666667;
db1_20 = 0.05;
db1_60 = 0.016666666666666666666666666666667;
}
else {
db1_2 = -0.5;
db1_6 = -0.16666666666666666666666666666667;
db1_12 = -0.083333333333333333333333333333333;
db1_24 = -0.041666666666666666666666666666667;
db1_20 = -0.05;
db1_60 = -0.016666666666666666666666666666667;
}
m00 = a00 * db1_2;
m10 = a10 * db1_6;
@ -223,10 +219,6 @@ void update_selected_items_axis_align(ArrangePolygons& selected, const DynamicPr
m20 = a20 * db1_12;
m11 = a11 * db1_24;
m02 = a02 * db1_12;
m30 = a30 * db1_20;
m21 = a21 * db1_60;
m12 = a12 * db1_60;
m03 = a03 * db1_20;
double cx = m10 / m00;
double cy = m01 / m00;

View file

@ -1,6 +1,5 @@
#include "BlacklistedLibraryCheck.hpp"
#include <cstdio>
#include <boost/nowide/convert.hpp>
#ifdef WIN32

View file

@ -576,7 +576,6 @@ double getadhesionCoeff(const PrintObject* printObject)
auto& insts = printObject->instances();
auto objectVolumes = insts[0].model_instance->get_object()->volumes;
auto print = printObject->print();
std::vector<size_t> extrudersFirstLayer;
auto firstLayerRegions = printObject->layers().front()->regions();
if (!firstLayerRegions.empty()) {
@ -901,8 +900,7 @@ static ExPolygons outer_inner_brim_area(const Print& print,
Polygons holes_object;
Polygons holes_support;
if (objectWithExtruder.second == extruderNo && brimToWrite.at(object->id()).obj) {
double deltaT = getTemperatureFromExtruder(object);
double adhesion = getadhesionCoeff(object);
double adhension = getadhesionCoeff(object);
double maxSpeed = Model::findMaxSpeed(object->model_object());
// BBS: brims are generated by volume groups
for (const auto& volumeGroup : object->firstLayerObjGroups()) {
@ -1585,7 +1583,6 @@ static void make_inner_brim(const Print& print, const ConstPrintObjectPtrs& top_
//BBS: generate out brim by offseting ExPolygons 'islands_area_ex'
Polygons tryExPolygonOffset(const ExPolygons islandAreaEx, const Print& print)
{
const auto scaled_resolution = scaled<double>(print.config().resolution.value);
Polygons loops;
ExPolygons islands_ex;
Flow flow = print.brim_flow();
@ -1660,7 +1657,6 @@ void make_brim(const Print& print, PrintTryCancel try_cancel, Polygons& islands_
std::map<ObjectID, ExPolygons> brimAreaMap;
std::map<ObjectID, ExPolygons> supportBrimAreaMap;
Flow flow = print.brim_flow();
const auto scaled_resolution = scaled<double>(print.config().resolution.value);
ExPolygons islands_area_ex = outer_inner_brim_area(print,
float(flow.scaled_spacing()), brimAreaMap, supportBrimAreaMap, objPrintVec, printExtruders);

View file

@ -28,7 +28,7 @@ bool model_to_csgmesh(const ModelObject &mo,
{
bool do_positives = parts_to_include & mpartsPositive;
bool do_negatives = parts_to_include & mpartsNegative;
bool do_drillholes = parts_to_include & mpartsDrillHoles;
// bool do_drillholes = parts_to_include & mpartsDrillHoles;
bool do_splits = parts_to_include & mpartsDoSplits;
bool has_splitable_volume = false;

View file

@ -775,10 +775,9 @@ ConfigSubstitutions ConfigBase::load(const std::string &file, ForwardCompatibili
//BBS: add json support
ConfigSubstitutions ConfigBase::load_from_json(const std::string &file, ForwardCompatibilitySubstitutionRule compatibility_rule, std::map<std::string, std::string>& key_values, std::string& reason)
{
int ret = 0;
ConfigSubstitutionContext substitutions_ctxt(compatibility_rule);
ret = load_from_json(file, substitutions_ctxt, true, key_values, reason);
load_from_json(file, substitutions_ctxt, true, key_values, reason);
return std::move(substitutions_ctxt.substitutions);
}

View file

@ -2,7 +2,6 @@
#include "ShortestPath.hpp"
#include <algorithm>
#include <cmath>
#include <map>
namespace Slic3r {

View file

@ -1,6 +1,3 @@
#include "../ClipperUtils.hpp"
#include "../ExPolygon.hpp"
#include "../Surface.hpp"
#include "../VariableWidth.hpp"
#include "Arachne/WallToolPaths.hpp"

View file

@ -1,6 +1,4 @@
#include "../ClipperUtils.hpp"
#include "../ShortestPath.hpp"
#include "../Surface.hpp"
#include <cmath>
#include "FillCrossHatch.hpp"
@ -65,7 +63,6 @@ static Polylines generate_transform_pattern(double inprogress, int direction, co
odd_poly.points.reserve(num_of_cycle * one_cycle.size());
// replicate to odd line
Point translate = Point(0, 0);
for (size_t i = 0; i < num_of_cycle; i++) {
Polyline odd_points;
odd_points = Polyline(one_cycle);
@ -152,7 +149,6 @@ static Polylines generate_infill_layers(coordf_t z_height, double repeat_ratio,
coordf_t period = trans_layer_size + repeat_layer_size;
coordf_t remains = z_height - std::floor(z_height / period) * period;
coordf_t trans_z = remains - repeat_layer_size; // put repeat layer first.
coordf_t repeat_z = remains;
int phase = fmod(z_height, period * 2) - (period - 1); // add epsilon
int direction = phase <= 0 ? -1 : 1;

View file

@ -4,7 +4,6 @@
#include "Generator.hpp"
#include "TreeNode.hpp"
#include "../../ClipperUtils.hpp"
#include "../../Layer.hpp"
#include "../../Print.hpp"
@ -35,7 +34,7 @@ static std::string get_svg_filename(std::string layer_nr_or_z, std::string tag
rand_init = true;
}
int rand_num = rand() % 1000000;
// int rand_num = rand() % 1000000;
//makedir("./SVG");
std::string prefix = "./SVG/";
std::string suffix = ".svg";

View file

@ -1,5 +1,4 @@
#include <cmath>
#include <assert.h>
#include "slic3r/Utils/ColorSpaceConvert.hpp"
#include "FlushVolCalc.hpp"

View file

@ -298,7 +298,6 @@ bool PrusaFileParser::check_3mf_from_prusa(const std::string filename)
const std::string model_file = "3D/3dmodel.model";
int model_file_index = mz_zip_reader_locate_file(&archive, model_file.c_str(), nullptr, 0);
if (model_file_index != -1) {
int depth = 0;
m_parser = XML_ParserCreate(nullptr);
XML_SetUserData(m_parser, (void *) this);
XML_SetElementHandler(m_parser, start_element_handler, nullptr);

View file

@ -100,7 +100,6 @@ bool load_obj(const char *path, TriangleMesh *meshptr, ObjInfo& obj_info, std::s
obj_info.is_single_mtl = data.usemtls.size() == 1 && mtl_data.new_mtl_unmap.size() == 1;
obj_info.face_colors.reserve(num_faces + num_quads);
}
bool has_color = data.has_vertex_color;
for (size_t i = 0; i < num_vertices; ++ i) {
size_t j = i * OBJ_VERTEX_LENGTH;
its.vertices.emplace_back(data.coordinates[j], data.coordinates[j + 1], data.coordinates[j + 2]);

View file

@ -878,7 +878,6 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
bool extract_object_model()
{
mz_zip_archive archive;
mz_zip_archive_file_stat stat;
mz_zip_zero_struct(&archive);
if (!open_zip_reader(&archive, zip_path)) {
@ -1617,9 +1616,9 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
}
else {
_extract_xml_from_archive(archive, sub_rels, _handle_start_relationships_element, _handle_end_relationships_element);
int index = 0;
#if 0
int index = 0;
for (auto path : m_sub_model_paths) {
if (proFn) {
proFn(IMPORT_STAGE_READ_FILES, ++index, 3 + m_sub_model_paths.size(), cb_cancel);
@ -2219,7 +2218,6 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
bool _BBS_3MF_Importer::_extract_from_archive(mz_zip_archive& archive, std::string const & path, std::function<bool (mz_zip_archive& archive, const mz_zip_archive_file_stat& stat)> extract, bool restore)
{
mz_uint num_entries = mz_zip_reader_get_num_files(&archive);
mz_zip_archive_file_stat stat;
std::string path2 = path;
if (path2.front() == '/') path2 = path2.substr(1);
@ -3319,9 +3317,9 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
// Adjust backup object/volume id
std::istringstream iss(m_curr_object->uuid);
int backup_id;
bool need_replace = false;
// bool need_replace = false;
if (iss >> std::hex >> backup_id) {
need_replace = (m_curr_object->id != backup_id);
// need_replace = (m_curr_object->id != backup_id);
m_curr_object->id = backup_id;
}
if (!m_curr_object->components.empty())
@ -4994,9 +4992,9 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
if (is_bbl_3mf && boost::ends_with(current_object->uuid, OBJECT_UUID_SUFFIX) && top_importer->m_load_restore) {
std::istringstream iss(current_object->uuid);
int backup_id;
bool need_replace = false;
// bool need_replace = false;
if (iss >> std::hex >> backup_id) {
need_replace = (current_object->id != backup_id);
// need_replace = (current_object->id != backup_id);
current_object->id = backup_id;
}
//if (need_replace)
@ -5991,8 +5989,6 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
auto src_gcode_file = plate_data->gcode_file;
boost::filesystem::ifstream ifs(src_gcode_file, std::ios::binary);
std::string buf(64 * 1024, 0);
const std::size_t & size = boost::filesystem::file_size(src_gcode_file);
std::size_t left_size = size;
while (ifs) {
ifs.read(buf.data(), buf.size());
int read_bytes = ifs.gcount();
@ -6230,7 +6226,6 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
bool _BBS_3MF_Exporter::_add_bbox_file_to_archive(mz_zip_archive& archive, const PlateBBoxData& id_bboxes, int index)
{
bool res = false;
nlohmann::json j;
id_bboxes.to_json(j);
std::string out = j.dump();
@ -6620,7 +6615,6 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
auto iter = objects_data.find(objects[i]);
ObjectToObjectDataMap objects_data2;
objects_data2.insert(*iter);
auto & object = *iter->second.object;
mz_zip_archive archive;
mz_zip_zero_struct(&archive);
mz_zip_writer_init_heap(&archive, 0, 1024 * 1024);
@ -7537,7 +7531,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
if (!m_skip_model && instance_size > 0)
{
for (unsigned int j = 0; j < instance_size; ++j)
for (int j = 0; j < instance_size; ++j)
{
stream << " <" << INSTANCE_TAG << ">\n";
int obj_id = plate_data->objects_and_instances[j].first;

View file

@ -113,9 +113,6 @@ double get_profile_area(std::vector<std::pair<gp_Pnt, gp_Pnt>> profile_line_poin
double area = 0;
for (auto line_points : profile_line_points) {
bool flag = true;
if (line_points.second.Y() < line_points.first.Y()) flag = false;
area += (line_points.second.X() + line_points.first.X() - 2 * min_x) * (line_points.second.Y() - line_points.first.Y()) / 2;
}
@ -137,8 +134,6 @@ bool get_svg_profile(const char *path, std::vector<Element_Info> &element_infos,
int name_index = 1;
for (NSVGshape *shape = svg_data->shapes; shape; shape = shape->next) {
char * id = shape->id;
int interpolation_precision = 10; // Number of interpolation points
float step = 1.0f / float(interpolation_precision - 1);
@ -384,7 +379,6 @@ bool load_svg(const char *path, Model *model, std::string &message)
ModelObject *new_object = model->add_object();
// new_object->name ?
new_object->input_file = path;
auto stage_unit3 = stl.size() / LOAD_STEP_STAGE_UNIT_NUM + 1;
for (size_t i = 0; i < stl.size(); i++) {
// BBS: maybe mesh is empty from step file. Don't add
if (stl[i].stats.number_of_facets > 0) {

View file

@ -116,7 +116,6 @@ static std::vector<Vec2d> get_path_of_change_filament(const Print& print)
if (excluse_area.size() != 4)
return out_points;
double cutter_area_x = excluse_area[2].x() + 2;
double cutter_area_y = excluse_area[2].y() + 2;
double start_x_position = start_point.x();
@ -2587,7 +2586,6 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
m_avoid_crossing_perimeters.use_external_mp_once();
// BBS. change tool before moving to origin point.
if (m_writer.need_toolchange(initial_extruder_id)) {
const PrintObjectConfig& object_config = object.config();
coordf_t initial_layer_print_height = print.config().initial_layer_print_height.value;
file.write(this->set_extruder(initial_extruder_id, initial_layer_print_height, true));
prime_extruder = true;
@ -3370,14 +3368,17 @@ namespace ProcessLayer
const PrintConfig &config)
{
std::string gcode;
// BBS
bool single_filament_print = config.filament_diameter.size() == 1;
if (custom_gcode != nullptr) {
// Extruder switches are processed by LayerTools, they should be filtered out.
assert(custom_gcode->type != CustomGCode::ToolChange);
CustomGCode::Type gcode_type = custom_gcode->type;
//BBS: inserting color gcode is removed
#if 0
// BBS
bool single_filament_print = config.filament_diameter.size() == 1;
bool color_change = gcode_type == CustomGCode::ColorChange;
bool tool_change = gcode_type == CustomGCode::ToolChange;
// Tool Change is applied as Color Change for a single extruder printer only.
@ -3389,8 +3390,7 @@ namespace ProcessLayer
m600_extruder_before_layer = custom_gcode->extruder - 1;
else if (gcode_type == CustomGCode::PausePrint)
pause_print_msg = custom_gcode->extra;
//BBS: inserting color gcode is removed
#if 0
// we should add or not colorprint_change in respect to nozzle_diameter count instead of really used extruders count
if (color_change || tool_change)
{
@ -3453,8 +3453,8 @@ namespace Skirt {
{
// Prime all extruders printing over the 1st layer over the skirt lines.
size_t n_loops = print.skirt().entities.size();
size_t n_tools = layer_tools.extruders.size();
size_t lines_per_extruder = (n_loops + n_tools - 1) / n_tools;
// size_t n_tools = layer_tools.extruders.size();
// size_t lines_per_extruder = (n_loops + n_tools - 1) / n_tools;
// BBS. Extrude skirt with first extruder if min_skirt_length is zero
//ORCA: Always extrude skirt with first extruder, independantly of if the minimum skirt length is zero or not. The code below
@ -3809,7 +3809,8 @@ LayerResult GCode::process_layer(
Skirt::make_skirt_loops_per_extruder_other_layers(print, layer_tools, m_skirt_done);
// BBS: get next extruder according to flush and soluble
auto get_next_extruder = [&](int current_extruder,const std::vector<unsigned int>&extruders) {
// Orca: Left unused due to removed code below
/* auto get_next_extruder = [&](int current_extruder,const std::vector<unsigned int>&extruders) {
std::vector<float> flush_matrix(cast<float>(m_config.flush_volumes_matrix.values));
const unsigned int number_of_extruders = (unsigned int)(sqrt(flush_matrix.size()) + EPSILON);
// Extract purging volumes for each extruder pair:
@ -3827,7 +3828,7 @@ LayerResult GCode::process_layer(
}
}
return next_extruder;
};
}; */
if (m_config.enable_overhang_speed && !m_config.overhang_speed_classic) {
for (const auto &layer_to_print : layers) {
@ -4960,8 +4961,8 @@ std::string GCode::extrude_support(const ExtrusionEntityCollection &support_fill
std::string gcode;
if (! support_fills.entities.empty()) {
const double support_speed = m_config.support_speed.value;
const double support_interface_speed = m_config.get_abs_value("support_interface_speed");
// const double support_speed = m_config.support_speed.value;
// const double support_interface_speed = m_config.get_abs_value("support_interface_speed");
for (const ExtrusionEntity *ee : support_fills.entities) {
ExtrusionRole role = ee->role();
assert(role == erSupportMaterial || role == erSupportMaterialInterface || role == erSupportTransition);
@ -6127,7 +6128,6 @@ bool GCode::needs_retraction(const Polyline &travel, ExtrusionRole role, LiftTyp
for (int i = 0; i < m_config.z_hop.size(); i++)
max_z_hop = std::max(max_z_hop, (float)m_config.z_hop.get_at(i));
float travel_len_thresh = scale_(max_z_hop / tan(this->writer().extruder()->travel_slope()));
float accum_len = 0.f;
Polyline clipped_travel;
clipped_travel.append(Polyline(travel.points[0], travel.points[1]));
@ -6229,7 +6229,6 @@ std::string GCode::retract(bool toolchange, bool is_last_retraction, LiftType li
}
if (needs_lift && can_lift) {
size_t extruder_id = m_writer.extruder()->id();
gcode += m_writer.lift(!m_spiral_vase ? lift_type : LiftType::NormalLift);
}

View file

@ -28,7 +28,6 @@ inline Grids line_rasterization(const Line &line, int64_t xdist = scale_(1), int
Point rayStart = line.a;
Point rayEnd = line.b;
IndexPair currentVoxel = point_map_grid_index(rayStart, xdist, ydist);
IndexPair firstVoxel = currentVoxel;
IndexPair lastVoxel = point_map_grid_index(rayEnd, xdist, ydist);
Point ray = rayEnd - rayStart;

View file

@ -3454,7 +3454,6 @@ void GCodeProcessor::process_G2_G3(const GCodeReader::GCodeLine& line)
arc_length = ((int)line.p()) * 2 * PI * (start_point - m_arc_center).norm();
//BBS: Attention! arc_onterpolation does not support P mode while P is not 1.
arc_interpolation(start_point, end_point, m_arc_center, (m_move_path_type == EMovePathType::Arc_move_ccw));
float radian = ArcSegment::calc_arc_radian(start_point, end_point, m_arc_center, (m_move_path_type == EMovePathType::Arc_move_ccw));
Vec3f start_dir = Circle::calc_tangential_vector(start_point, m_arc_center, (m_move_path_type == EMovePathType::Arc_move_ccw));
Vec3f end_dir = Circle::calc_tangential_vector(end_point, m_arc_center, (m_move_path_type == EMovePathType::Arc_move_ccw));

View file

@ -1,6 +1,4 @@
#include "../ClipperUtils.hpp"
#include "../Layer.hpp"
#include "../Polyline.hpp"
#include "RetractWhenCrossingPerimeters.hpp"

View file

@ -9,6 +9,14 @@
namespace Slic3r {
#ifndef _WIN32
// Currently on Linux/macOS, this class spits out large amounts of subobject linkage
// warnings because of the flowModel field. tk::spline is in an anonymous namespace which
// causes this issue. Until the issue can be solved, this is a temporary solution.
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsubobject-linkage"
#endif
class SmallAreaInfillFlowCompensator
{
public:
@ -31,6 +39,10 @@ private:
double max_modified_length() { return eLengths.back(); }
};
#ifndef _WIN32
#pragma GCC diagnostic pop
#endif
} // namespace Slic3r
#endif /* slic3r_GCode_SmallAreaInfillFlowCompensator_hpp_ */

View file

@ -307,7 +307,6 @@ ToolOrdering::ToolOrdering(const Print &print, unsigned int first_extruder, bool
std::vector<unsigned int> ToolOrdering::generate_first_layer_tool_order(const Print& print)
{
std::vector<unsigned int> tool_order;
int initial_extruder_id = -1;
std::map<int, double> min_areas_per_extruder;
for (auto object : print.objects()) {
@ -336,7 +335,6 @@ std::vector<unsigned int> ToolOrdering::generate_first_layer_tool_order(const Pr
}
}
double max_minimal_area = 0.;
for (auto ape : min_areas_per_extruder) {
auto iter = tool_order.begin();
for (; iter != tool_order.end(); iter++) {
@ -369,7 +367,6 @@ std::vector<unsigned int> ToolOrdering::generate_first_layer_tool_order(const Pr
std::vector<unsigned int> ToolOrdering::generate_first_layer_tool_order(const PrintObject& object)
{
std::vector<unsigned int> tool_order;
int initial_extruder_id = -1;
std::map<int, double> min_areas_per_extruder;
auto first_layer = object.get_layer(0);
for (auto layerm : first_layer->regions()) {
@ -394,7 +391,6 @@ std::vector<unsigned int> ToolOrdering::generate_first_layer_tool_order(const Pr
}
}
double max_minimal_area = 0.;
for (auto ape : min_areas_per_extruder) {
auto iter = tool_order.begin();
for (; iter != tool_order.end(); iter++) {

View file

@ -1072,8 +1072,6 @@ void WipeTower::toolchange_Wipe(
const float target_speed = is_first_layer() ? std::min(m_first_layer_speed * 60.f, 4800.f) : 4800.f;
float wipe_speed = 0.33f * target_speed;
float start_y = writer.y();
#if 0
// if there is less than 2.5*m_perimeter_width to the edge, advance straightaway (there is likely a blob anyway)
if ((m_left_to_right ? xr-writer.x() : writer.x()-xl) < 2.5f*m_perimeter_width) {
@ -1132,8 +1130,6 @@ void WipeTower::toolchange_Wipe(
m_left_to_right = !m_left_to_right;
}
float end_y = writer.y();
// We may be going back to the model - wipe the nozzle. If this is followed
// by finish_layer, this wipe path will be overwritten.
//writer.add_wipe_point(writer.x(), writer.y())
@ -1422,7 +1418,6 @@ void WipeTower::plan_tower()
// If wipe tower height is between the current and next member, set the min_depth as linear interpolation between them
auto next_height_to_depth = *iter;
if (next_height_to_depth.first > m_wipe_tower_height) {
float height_base = curr_height_to_depth.first;
float height_diff = next_height_to_depth.first - curr_height_to_depth.first;
float min_depth_base = curr_height_to_depth.second;
float depth_diff = next_height_to_depth.second - curr_height_to_depth.second;

View file

@ -4,21 +4,14 @@
#include "ClipperUtils.hpp"
#include "ExPolygon.hpp"
#include "Line.hpp"
#include "clipper.hpp"
#include <algorithm>
#include <cassert>
#include <cmath>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <utility>
#include <stack>
#include <vector>
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp>
#include <boost/log/trivial.hpp>
#if defined(_MSC_VER) && defined(__clang__)
#define BOOST_NO_CXX17_HDR_STRING_VIEW

View file

@ -1,7 +1,5 @@
#include "Circle.hpp"
#include "../Polygon.hpp"
#include <numeric>
#include <random>
#include <boost/log/trivial.hpp>

View file

@ -2,7 +2,6 @@
#include "libslic3r/Arachne/utils/PolygonsSegmentIndex.hpp"
#include "libslic3r/Geometry/VoronoiUtils.hpp"
#include "libslic3r/Geometry/VoronoiUtilsCgal.hpp"
#include "libslic3r/MultiMaterialSegmentation.hpp"
#include <boost/log/trivial.hpp>

View file

@ -1,4 +1,3 @@
#include <boost/next_prior.hpp>
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Arr_segment_traits_2.h>
#include <CGAL/Surface_sweep_2_algorithms.h>

View file

@ -1,26 +1,18 @@
#include "JumpPointSearch.hpp"
#include "BoundingBox.hpp"
#include "ExPolygon.hpp"
#include "Point.hpp"
#include "libslic3r/AStar.hpp"
#include "libslic3r/KDTreeIndirect.hpp"
#include "libslic3r/Polygon.hpp"
#include "libslic3r/Polyline.hpp"
#include "libslic3r/libslic3r.h"
#include <algorithm>
#include <cmath>
#include <cstddef>
#include <cstdint>
#include <cstdlib>
#include <iterator>
#include <limits>
#include <optional>
#include <string>
#include <unordered_map>
#include <vector>
#include <oneapi/tbb/scalable_allocator.h>
//#define DEBUG_FILES
#ifdef DEBUG_FILES
#include "libslic3r/SVG.hpp"

View file

@ -1,9 +1,7 @@
#include "Geometry.hpp"
#include "Line.hpp"
#include "Polyline.hpp"
#include <algorithm>
#include <cmath>
#include <sstream>
namespace Slic3r {

View file

@ -330,7 +330,7 @@ void segment(CGALMesh& src, std::vector<CGALMesh>& dst, double smoothing_alpha =
// fill holes
typedef boost::graph_traits<_EpicMesh>::halfedge_descriptor halfedge_descriptor;
typedef boost::graph_traits<_EpicMesh>::vertex_descriptor vertex_descriptor;
// typedef boost::graph_traits<_EpicMesh>::vertex_descriptor vertex_descriptor;
std::vector<halfedge_descriptor> border_cycles;
CGAL::Polygon_mesh_processing::extract_boundary_cycles(out, std::back_inserter(border_cycles));
for (halfedge_descriptor h : border_cycles)
@ -693,7 +693,7 @@ bool do_boolean_single(McutMesh &srcMesh, const McutMesh &cutMesh, const std::st
McutMesh outMesh;
int N_vertices = 0;
// traversal of all connected components
for (int n = 0; n < numConnComps; ++n) {
for (unsigned int n = 0; n < numConnComps; ++n) {
// query the data of each connected component from MCUT
McConnectedComponent connComp = connectedComponents[n];

View file

@ -442,7 +442,7 @@ ModelObject* Model::add_object(const ModelObject &other)
this->objects.push_back(new_object);
// BBS: backup
if (need_backup) {
if (auto model = other.get_model()) {
if (other.get_model()) {
auto iter = object_backup_id_map.find(other.id().id);
if (iter != object_backup_id_map.end()) {
object_backup_id_map.emplace(new_object->id().id, iter->second);
@ -2615,7 +2615,7 @@ size_t ModelVolume::split(unsigned int max_extruders)
size_t ivolume = std::find(this->object->volumes.begin(), this->object->volumes.end(), this) - this->object->volumes.begin();
const std::string name = this->name;
unsigned int extruder_counter = 0;
// unsigned int extruder_counter = 0;
const Vec3d offset = this->get_offset();
for (TriangleMesh &mesh : meshes) {
@ -2930,9 +2930,6 @@ bool Model::obj_import_vertex_color_deal(const std::vector<unsigned char> &verte
std::cout << "error";
}
};
auto calc_tri_area = [](const Vec3f &v0, const Vec3f &v1, const Vec3f &v2) {
return std::abs((v0 - v1).cross(v0 - v2).norm()) / 2;
};
auto volume = obj->volumes[0];
volume->config.set("extruder", first_extruder_id);
auto face_count = volume->mesh().its.indices.size();
@ -3032,7 +3029,6 @@ bool Model::obj_import_face_color_deal(const std::vector<unsigned char> &face_fi
volume->mmu_segmentation_facets.reserve(face_count);
if (volume->mesh().its.indices.size() != face_filament_ids.size()) { return false; }
for (size_t i = 0; i < volume->mesh().its.indices.size(); i++) {
auto face = volume->mesh().its.indices[i];
auto filament_id = face_filament_ids[i];
if (filament_id <= 1) { continue; }
std::string result;

View file

@ -167,7 +167,6 @@ ArrangePolygon get_instance_arrange_poly(ModelInstance* instance, const Slic3r::
auto support_type_ptr = obj->get_config_value<ConfigOptionEnum<SupportType>>(config, "support_type");
auto support_type = support_type_ptr->value;
auto enable_support = supp_type_ptr->getBool();
int support_int = support_type_ptr->getInt();
if (enable_support && (support_type == stNormalAuto || support_type == stNormal))
ap.brim_width = 6.0;

View file

@ -338,7 +338,6 @@ static std::vector<std::vector<const MMU_Graph::Arc *>> get_all_next_arcs(
if (arc.type == MMU_Graph::ARC_TYPE::BORDER && arc.color != color) continue;
Vec2d arc_line = graph.nodes[arc.to_idx].point - graph.nodes[arc.from_idx].point;
next_continue_arc.emplace_back(&arc);
all_next_arcs.emplace_back(next_continue_arc);
}
@ -1286,7 +1285,6 @@ static void cut_segmented_layers(const std::vector<ExPolygons> &input_exp
const std::function<void()> &throw_on_cancel_callback)
{
BOOST_LOG_TRIVIAL(debug) << "MM segmentation - cutting segmented layers in parallel - begin";
const float interlocking_cut_width = interlocking_depth > 0.f ? std::max(cut_width - interlocking_depth, 0.f) : 0.f;
tbb::parallel_for(tbb::blocked_range<size_t>(0, segmented_regions.size()),
[&segmented_regions, &input_expolygons, &cut_width, &interlocking_depth, &throw_on_cancel_callback](const tbb::blocked_range<size_t> &range) {
for (size_t layer_idx = range.begin(); layer_idx < range.end(); ++layer_idx) {

View file

@ -138,8 +138,6 @@ public:
auto cost_items = get_features(orientation, params.min_volume);
float unprintability = target_function(cost_items, params.min_volume);
results[orientation] = cost_items;
BOOST_LOG_TRIVIAL(info) << std::fixed << std::setprecision(4) << "orientation:" << orientation.transpose() << ", cost:" << std::fixed << std::setprecision(4) << cost_items.field_values();
@ -230,10 +228,10 @@ public:
{
std::unordered_map<stl_normal, float, VecHash> alignments;
// init to 0
for (size_t i = 0; i < areas_.size(); i++)
for (Eigen::Index i = 0; i < areas_.size(); i++)
alignments.insert(std::pair(normals_.row(i), 0));
// cumulate areas
for (size_t i = 0; i < areas_.size(); i++)
for (Eigen::Index i = 0; i < areas_.size(); i++)
{
alignments[normals_.row(i)] += areas_(i);
}
@ -257,11 +255,11 @@ public:
Vec3f n1 = { 0, 0, 0 };
std::vector<float> current_areas = {0, 0};
// init to 0
for (size_t i = 0; i < areas_.size(); i++) {
for (Eigen::Index i = 0; i < areas_.size(); i++) {
alignments_.insert(std::pair(quantize_normals_.row(i), std::pair(current_areas, n1)));
}
// cumulate areas
for (size_t i = 0; i < areas_.size(); i++)
for (Eigen::Index i = 0; i < areas_.size(); i++)
{
alignments_[quantize_normals_.row(i)].first[1] += areas_(i);
if (areas_(i) > alignments_[quantize_normals_.row(i)].first[0]){
@ -339,7 +337,7 @@ public:
z_max_hull.resize(mesh_convex_hull.facets_count(), 1);
its = mesh_convex_hull.its;
for (size_t i = 0; i < z_max_hull.rows(); i++)
for (Eigen::Index i = 0; i < z_max_hull.rows(); i++)
{
float z0 = its.get_vertex(i,0).dot(orientation);
float z1 = its.get_vertex(i,1).dot(orientation);
@ -393,7 +391,7 @@ public:
// filter overhang
Eigen::VectorXf normal_projection(normals.rows(), 1);// = this->normals.dot(orientation);
for (size_t i = 0; i < normals.rows(); i++)
for (Eigen::Index i = 0; i < normals.rows(); i++)
{
normal_projection(i) = normals.row(i).dot(orientation);
}
@ -459,7 +457,6 @@ public:
cost = params.TAR_A * (overhang + params.TAR_B) + params.RELATIVE_F * (/*costs.volume/100*/overhang*params.TAR_C + params.TAR_D + params.TAR_LAF * costs.area_laf * params.use_low_angle_face) / (params.TAR_D + params.CONTOUR_F * costs.contour + params.BOTTOM_F * bottom + params.BOTTOM_HULL_F * bottom_hull + params.TAR_E * overhang + params.TAR_PROJ_AREA * costs.area_projected);
}
else {
float overhang = costs.overhang;
cost = params.RELATIVE_F * (costs.overhang * params.TAR_C + params.TAR_D + params.TAR_LAF * costs.area_laf * params.use_low_angle_face) / (params.TAR_D + params.CONTOUR_F * costs.contour + params.BOTTOM_F * bottom + params.BOTTOM_HULL_F * bottom_hull + params.TAR_PROJ_AREA * costs.area_projected);
}
cost += (costs.bottom < params.BOTTOM_MIN) * 100;// +(costs.height_to_bottom_hull_ratio > params.height_to_bottom_hull_ratio_MIN) * 110;

View file

@ -242,12 +242,10 @@ static std::deque<PolylineWithDegree> split_polyline_by_degree(const Polyline &p
Polyline right;
Polyline temp_copy = polyline_with_insert_points;
size_t poly_size = polyline_with_insert_points.size();
// BBS: merge degree in limited range
//find first degee base
double degree_base = int(points_overhang[points_overhang.size() - 1] / min_degree_gap) * min_degree_gap + min_degree_gap;
degree_base = degree_base > max_overhang_degree ? max_overhang_degree : degree_base;
double short_poly_len = 0;
for (int point_idx = points_overhang.size() - 2; point_idx > 0; --point_idx) {
double degree = points_overhang[point_idx];
@ -940,7 +938,6 @@ static ExtrusionEntityCollection traverse_extrusions(const PerimeterGenerator& p
if (perimeter_generator.config->overhang_speed_classic && perimeter_generator.config->enable_overhang_speed && perimeter_generator.config->fuzzy_skin == FuzzySkinType::None) {
Flow flow = is_external ? perimeter_generator.ext_perimeter_flow : perimeter_generator.perimeter_flow;
std::map<double, std::vector<Polygons>> clipper_serise;
std::map<double,ExtrusionPaths> recognization_paths;
@ -2253,7 +2250,6 @@ void PerimeterGenerator::process_no_bridge(Surfaces& all_surfaces, coord_t perim
if (!unsupported.empty()) {
//only consider the part that can be bridged (really, by the bridge algorithm)
//first, separate into islands (ie, each ExPlolygon)
int numploy = 0;
//only consider the bottom layer that intersect unsupported, to be sure it's only on our island.
ExPolygonCollection lower_island(support);
//a detector per island
@ -2371,7 +2367,6 @@ void PerimeterGenerator::process_no_bridge(Surfaces& all_surfaces, coord_t perim
//ExPolygons no_bridge = diff_ex(offset_ex(unbridgeable, ext_perimeter_width * 3 / 2), last);
//bridges_temp = diff_ex(bridges_temp, no_bridge);
coordf_t offset_to_do = bridged_infill_margin;
bool first = true;
unbridgeable = diff_ex(unbridgeable, offset_ex(bridges_temp, ext_perimeter_width));
while (offset_to_do > ext_perimeter_width * 1.5) {
unbridgeable = offset2_ex(unbridgeable, -ext_perimeter_width / 4, ext_perimeter_width * 2.25, ClipperLib::jtSquare);
@ -2379,7 +2374,6 @@ void PerimeterGenerator::process_no_bridge(Surfaces& all_surfaces, coord_t perim
bridges_temp = offset_ex(bridges_temp, ext_perimeter_width, ClipperLib::jtMiter, 6.);
unbridgeable = diff_ex(unbridgeable, offset_ex(bridges_temp, ext_perimeter_width));
offset_to_do -= ext_perimeter_width;
first = false;
}
unbridgeable = offset_ex(unbridgeable, ext_perimeter_width + offset_to_do, ClipperLib::jtSquare);
bridges_temp = diff_ex(bridges_temp, unbridgeable);

View file

@ -355,8 +355,6 @@ Polygon Polygon::transform(const Transform3d& trafo) const
if (vertices_count == 0)
return dstpoly;
unsigned int data_size = 3 * vertices_count * sizeof(float);
Eigen::MatrixXd src(3, vertices_count);
for (size_t i = 0; i < vertices_count; i++)
{

View file

@ -51,7 +51,6 @@ void Polyline::reverse()
// removes the given distance from the end of the polyline
void Polyline::clip_end(double distance)
{
bool last_point_inserted = false;
size_t remove_after_index = MultiPoint::size();
while (distance > 0) {
Vec2d last_point = this->last_point().cast<double>();
@ -65,7 +64,6 @@ void Polyline::clip_end(double distance)
double lsqr = v.squaredNorm();
if (lsqr > distance * distance) {
this->points.emplace_back((last_point + v * (distance / sqrt(lsqr))).cast<coord_t>());
last_point_inserted = true;
break;
}
distance -= sqrt(lsqr);

View file

@ -1572,7 +1572,6 @@ bool PresetCollection::load_user_preset(std::string name, std::map<std::string,
// Store the loaded presets into a new vector, otherwise the binary search for already existing presets would be broken.
// (see the "Preset already present, not loading" message).
//std::deque<Preset> presets_loaded;
int count = 0;
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(" enter, name %1% , total value counts %2%")%name %preset_values.size();

View file

@ -1853,7 +1853,7 @@ void PresetBundle::export_selections(AppConfig &config)
// BBS
void PresetBundle::set_num_filaments(unsigned int n, std::string new_color)
{
int old_filament_count = this->filament_presets.size();
size_t old_filament_count = this->filament_presets.size();
if (n > old_filament_count && old_filament_count != 0)
filament_presets.resize(n, filament_presets.back());
else {
@ -1867,7 +1867,7 @@ void PresetBundle::set_num_filaments(unsigned int n, std::string new_color)
//BBS set new filament color to new_color
if (old_filament_count < n) {
if (!new_color.empty()) {
for (int i = old_filament_count; i < n; i++) {
for (size_t i = old_filament_count; i < n; i++) {
filament_color->values[i] = new_color;
}
}
@ -2054,7 +2054,7 @@ bool PresetBundle::check_filament_temp_equation_by_printer_type_and_nozzle_for_m
//BBS: check whether this is the only edited filament
bool PresetBundle::is_the_only_edited_filament(unsigned int filament_index)
{
int n = this->filament_presets.size();
size_t n = this->filament_presets.size();
if (filament_index >= n)
return false;
@ -2117,7 +2117,6 @@ DynamicPrintConfig PresetBundle::full_fff_config() const
// BBS
size_t num_filaments = this->filament_presets.size();
auto* extruder_diameter = dynamic_cast<const ConfigOptionFloats*>(out.option("nozzle_diameter"));
// Collect the "compatible_printers_condition" and "inherits" values over all presets (print, filaments, printers) into a single vector.
std::vector<std::string> compatible_printers_condition;
std::vector<std::string> compatible_prints_condition;
@ -2472,7 +2471,7 @@ void PresetBundle::load_config_file_config(const std::string &name_or_path, bool
std::vector<std::string> filament_ids = std::move(config.option<ConfigOptionStrings>("filament_ids", true)->values);
std::vector<std::string> print_compatible_printers = std::move(config.option<ConfigOptionStrings>("print_compatible_printers", true)->values);
//BBS: add different settings check logic
bool has_different_settings_to_system = config.option("different_settings_to_system")?true:false;
// bool has_different_settings_to_system = config.option("different_settings_to_system")?true:false;
std::vector<std::string> different_values = std::move(config.option<ConfigOptionStrings>("different_settings_to_system", true)->values);
std::string &compatible_printers_condition = Preset::compatible_printers_condition(config);
std::string &compatible_prints_condition = Preset::compatible_prints_condition(config);

View file

@ -823,7 +823,6 @@ StringObjectException Print::sequential_print_clearance_valid(const Print &print
for (int i = k+1; i < print_instance_count; i++)
{
auto& p = print_instance_with_bounding_box[i].print_instance;
auto bbox2 = print_instance_with_bounding_box[i].bounding_box;
auto py1 = bbox2.min.y();
auto py2 = bbox2.max.y();
@ -1391,32 +1390,30 @@ StringObjectException Print::validate(StringObjectException *warning, Polygons*
const ConfigOptionDef* bed_type_def = print_config_def.get("curr_bed_type");
assert(bed_type_def != nullptr);
if (is_BBL_printer()) {
if (is_BBL_printer()) {
const t_config_enum_values* bed_type_keys_map = bed_type_def->enum_keys_map;
const ConfigOptionInts* bed_temp_opt = m_config.option<ConfigOptionInts>(get_bed_temp_key(m_config.curr_bed_type));
for (unsigned int extruder_id : extruders) {
const ConfigOptionInts* bed_temp_opt = m_config.option<ConfigOptionInts>(get_bed_temp_key(m_config.curr_bed_type));
for (unsigned int extruder_id : extruders) {
int curr_bed_temp = bed_temp_opt->get_at(extruder_id);
if (curr_bed_temp == 0 && bed_type_keys_map != nullptr) {
std::string bed_type_name;
for (auto item : *bed_type_keys_map) {
if (item.second == m_config.curr_bed_type) {
bed_type_name = item.first;
break;
}
int curr_bed_temp = bed_temp_opt->get_at(extruder_id);
if (curr_bed_temp == 0 && bed_type_keys_map != nullptr) {
std::string bed_type_name;
for (auto item : *bed_type_keys_map) {
if (item.second == m_config.curr_bed_type) {
bed_type_name = item.first;
break;
}
}
StringObjectException except;
except.string = Slic3r::format(L("Plate %d: %s does not support filament %s"), this->get_plate_index() + 1, L(bed_type_name), extruder_id + 1);
except.string += "\n";
except.type = STRING_EXCEPT_FILAMENT_NOT_MATCH_BED_TYPE;
except.params.push_back(std::to_string(this->get_plate_index() + 1));
except.params.push_back(L(bed_type_name));
except.params.push_back(std::to_string(extruder_id+1));
except.object = nullptr;
return except;
}
}
StringObjectException except;
except.string = Slic3r::format(L("Plate %d: %s does not support filament %s"), this->get_plate_index() + 1, L(bed_type_name), extruder_id + 1);
except.string += "\n";
except.type = STRING_EXCEPT_FILAMENT_NOT_MATCH_BED_TYPE;
except.params.push_back(std::to_string(this->get_plate_index() + 1));
except.params.push_back(L(bed_type_name));
except.params.push_back(std::to_string(extruder_id+1));
except.object = nullptr;
return except;
}
}
}
@ -1433,7 +1430,7 @@ StringObjectException Print::validate(StringObjectException *warning, Polygons*
}
return warning_key;
};
auto check_motion_ability_region_setting = [&](const std::vector<std::string>& keys_to_check, double limit) -> std::string {
/* auto check_motion_ability_region_setting = [&](const std::vector<std::string>& keys_to_check, double limit) -> std::string {
std::string warning_key;
for (const auto& key : keys_to_check) {
if (m_default_region_config.get_abs_value(key) > limit) {
@ -1442,7 +1439,7 @@ StringObjectException Print::validate(StringObjectException *warning, Polygons*
}
}
return warning_key;
};
}; */
std::string warning_key;
// check jerk
@ -2035,8 +2032,7 @@ void Print::process(long long *time_cost_with_cache, bool use_cache)
//BBS: get the objects' indices when GCodes are generated
ToolOrdering tool_ordering;
unsigned int initial_extruder_id = (unsigned int)-1;
unsigned int final_extruder_id = (unsigned int)-1;
bool has_wipe_tower = false;
// bool has_wipe_tower = false;
std::vector<const PrintInstance*> print_object_instances_ordering;
std::vector<const PrintInstance*>::const_iterator print_object_instance_sequential_active;
std::vector<std::pair<coordf_t, std::vector<GCode::LayerToPrint>>> layers_to_print = GCode::collect_layers_to_print(*this);
@ -2056,9 +2052,9 @@ void Print::process(long long *time_cost_with_cache, bool use_cache)
else {
tool_ordering = this->tool_ordering();
tool_ordering.assign_custom_gcodes(*this);
has_wipe_tower = this->has_wipe_tower() && tool_ordering.has_wipe_tower();
//BBS: have no single_extruder_multi_material_priming
#if 0
has_wipe_tower = this->has_wipe_tower() && tool_ordering.has_wipe_tower();
initial_extruder_id = (has_wipe_tower && !this->config().single_extruder_multi_material_priming) ?
// The priming towers will be skipped.
tool_ordering.all_extruders().back() :
@ -2646,7 +2642,7 @@ void Print::_make_wipe_tower()
for (auto &layer_tools : m_wipe_tower_data.tool_ordering.layer_tools()) { // for all layers
if (!layer_tools.has_wipe_tower)
continue;
bool first_layer = &layer_tools == &m_wipe_tower_data.tool_ordering.front();
// bool first_layer = &layer_tools == &m_wipe_tower_data.tool_ordering.front();
wipe_tower.plan_toolchange((float) layer_tools.print_z, (float) layer_tools.wipe_tower_layer_height, current_extruder_id,
current_extruder_id);
@ -2740,7 +2736,7 @@ void Print::_make_wipe_tower()
for (auto &layer_tools : m_wipe_tower_data.tool_ordering.layer_tools()) { // for all layers
if (!layer_tools.has_wipe_tower)
continue;
bool first_layer = &layer_tools == &m_wipe_tower_data.tool_ordering.front();
// bool first_layer = &layer_tools == &m_wipe_tower_data.tool_ordering.front();
wipe_tower.plan_toolchange((float) layer_tools.print_z, (float) layer_tools.wipe_tower_layer_height, current_extruder_id,
current_extruder_id, false);
for (const auto extruder_id : layer_tools.extruders) {

View file

@ -677,7 +677,6 @@ void PrintObject::estimate_curled_extrusions()
[](const PrintRegion *region) { return region->config().enable_overhang_speed.getBool(); })) {
// Estimate curling of support material and add it to the malformaition lines of each layer
float support_flow_width = support_material_flow(this, this->config().layer_height).width();
SupportSpotsGenerator::Params params{this->print()->m_config.filament_type.values,
float(this->print()->default_object_config().inner_wall_acceleration.getFloat()),
this->config().raft_layers.getInt(), this->config().brim_type.value,
@ -2949,16 +2948,16 @@ struct POProfiler
void PrintObject::generate_support_preview()
{
POProfiler profiler;
// POProfiler profiler;
boost::posix_time::ptime ts1 = boost::posix_time::microsec_clock::local_time();
// boost::posix_time::ptime ts1 = boost::posix_time::microsec_clock::local_time();
this->slice();
boost::posix_time::ptime ts2 = boost::posix_time::microsec_clock::local_time();
profiler.duration1 = (ts2 - ts1).total_milliseconds();
// boost::posix_time::ptime ts2 = boost::posix_time::microsec_clock::local_time();
// profiler.duration1 = (ts2 - ts1).total_milliseconds();
this->generate_support_material();
boost::posix_time::ptime ts3 = boost::posix_time::microsec_clock::local_time();
profiler.duration2 = (ts3 - ts2).total_milliseconds();
// boost::posix_time::ptime ts3 = boost::posix_time::microsec_clock::local_time();
// profiler.duration2 = (ts3 - ts2).total_milliseconds();
}
void PrintObject::update_slicing_parameters()
@ -3668,7 +3667,6 @@ template void PrintObject::remove_bridges_from_contacts<Polygons>(
SupportNecessaryType PrintObject::is_support_necessary()
{
static const double super_overhang_area_threshold = SQ(scale_(5.0));
const double cantilevel_dist_thresh = scale_(6);
#if 0
double threshold_rad = (m_config.support_threshold_angle.value < EPSILON ? 30 : m_config.support_threshold_angle.value + 1) * M_PI / 180.;

View file

@ -151,8 +151,8 @@ static std::vector<VolumeSlices> slice_volumes_inner(
params_base.mode_below = params_base.mode;
// BBS
const size_t num_extruders = print_config.filament_diameter.size();
const bool is_mm_painted = num_extruders > 1 && std::any_of(model_volumes.cbegin(), model_volumes.cend(), [](const ModelVolume *mv) { return mv->is_mm_painted(); });
// const size_t num_extruders = print_config.filament_diameter.size();
// const bool is_mm_painted = num_extruders > 1 && std::any_of(model_volumes.cbegin(), model_volumes.cend(), [](const ModelVolume *mv) { return mv->is_mm_painted(); });
// BBS: don't do size compensation when slice volume.
// Will handle contour and hole size compensation seperately later.
//const auto extra_offset = is_mm_painted ? 0.f : std::max(0.f, float(print_object_config.xy_contour_compensation.value));
@ -336,7 +336,8 @@ static std::vector<std::vector<ExPolygons>> slices_to_regions(
};
// BBS
auto trim_overlap = [](ExPolygons& expolys_a, ExPolygons& expolys_b) {
// Orca: unused
/* auto trim_overlap = [](ExPolygons& expolys_a, ExPolygons& expolys_b) {
ExPolygons trimming_a;
ExPolygons trimming_b;
@ -361,7 +362,7 @@ static std::vector<std::vector<ExPolygons>> slices_to_regions(
expolys_a = diff_ex(expolys_a, trimming_a);
expolys_b = diff_ex(expolys_b, trimming_b);
};
}; */
std::vector<RegionSlice> temp_slices;
for (size_t zs_complex_idx = range.begin(); zs_complex_idx < range.end(); ++ zs_complex_idx) {

View file

@ -99,8 +99,6 @@ std::vector<std::string> init_occt_fonts()
static bool TextToBRep(const char* text, const char* font, const float theTextHeight, Font_FontAspect& theFontAspect, TopoDS_Shape& theShape, double& text_width)
{
Standard_Integer anArgIt = 1;
Standard_CString aName = "text_shape";
Standard_CString aText = text;
Font_BRepFont aFont;

View file

@ -2,7 +2,6 @@
#include "libslic3r/NormalUtils.hpp"
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <algorithm>

View file

@ -1,8 +1,5 @@
#include <numeric>
#include "SlicesToTriangleMesh.hpp"
//#include "libslic3r/MTUtils.hpp"
#include "libslic3r/Execution/ExecutionTBB.hpp"
#include "libslic3r/ClipperUtils.hpp"
#include "libslic3r/Tesselate.hpp"

View file

@ -1,12 +1,6 @@
#include "OrganicSupport.hpp"
#include "SupportCommon.hpp"
#include "../AABBTreeLines.hpp"
#include "../ClipperUtils.hpp"
#include "../Polygon.hpp"
#include "../Polyline.hpp"
#include "../MutablePolygon.hpp"
#include "../TriangleMeshSlicer.hpp"
#include <cassert>

View file

@ -1,6 +1,4 @@
#include "../Print.hpp"
#include "../PrintConfig.hpp"
#include "../Slicing.hpp"
#include "SupportParameters.hpp"
namespace Slic3r::FFFSupport {

View file

@ -338,7 +338,7 @@ static std::string get_svg_filename(std::string layer_nr_or_z, std::string tag
rand_init = true;
}
int rand_num = rand() % 1000000;
// int rand_num = rand() % 1000000;
//makedir("./SVG");
std::string prefix = "./SVG/";
std::string suffix = ".svg";
@ -1554,7 +1554,6 @@ static inline ExPolygons detect_overhangs(
double thresh_angle = object_config.support_threshold_angle.value > 0 ? object_config.support_threshold_angle.value + 1 : 0;
thresh_angle = std::min(thresh_angle, 89.); // BBS should be smaller than 90
const double threshold_rad = Geometry::deg2rad(thresh_angle);
const coordf_t max_bridge_length = scale_(object_config.max_bridge_length.value);
const bool bridge_no_support = object_config.bridge_no_support.value;
const coordf_t xy_expansion = scale_(object_config.support_expansion.value);
@ -1577,7 +1576,6 @@ static inline ExPolygons detect_overhangs(
{
// Generate overhang / contact_polygons for non-raft layers.
const Layer &lower_layer = *layer.lower_layer;
const bool has_enforcer = !annotations.enforcers_layers.empty() && !annotations.enforcers_layers[layer_id].empty();
// Can't directly use lower_layer.lslices, or we'll miss some very sharp tails.
// Filter out areas whose diameter that is smaller than extrusion_width. Do not use offset2() for this purpose!
// FIXME if there are multiple regions with different extrusion width, the following code may not be right.
@ -1689,7 +1687,6 @@ static inline ExPolygons detect_overhangs(
// check cantilever
if (layer.lower_layer) {
for (ExPolygon& poly : overhang_areas) {
float fw = float(layer.regions().front()->flow(frExternalPerimeter).scaled_width());
auto cluster_boundary_ex = intersection_ex(poly, offset_ex(layer.lower_layer->lslices, scale_(0.5)));
Polygons cluster_boundary = to_polygons(cluster_boundary_ex);
if (cluster_boundary.empty()) continue;
@ -1734,7 +1731,6 @@ static inline std::tuple<Polygons, Polygons, double> detect_contacts(
Polygons enforcer_polygons;
// BBS.
const bool auto_normal_support = object_config.support_type.value == stNormalAuto;
const bool buildplate_only = !annotations.buildplate_covered.empty();
float no_interface_offset = 0.f;
@ -1748,8 +1744,6 @@ static inline std::tuple<Polygons, Polygons, double> detect_contacts(
// Generate overhang / contact_polygons for non-raft layers.
const Layer& lower_layer = *layer.lower_layer;
const bool has_enforcer = !annotations.enforcers_layers.empty() && !annotations.enforcers_layers[layer_id].empty();
const ExPolygons& lower_layer_expolys = lower_layer.lslices;
const ExPolygons& lower_layer_sharptails = lower_layer.sharp_tails;
// Cache support trimming polygons derived from lower layer polygons, possible merged with "on build plate only" trimming polygons.
auto slices_margin_update =
@ -2187,7 +2181,6 @@ struct OverhangCluster {
static OverhangCluster* add_overhang(std::vector<OverhangCluster>& clusters, ExPolygon* overhang, int layer_nr, coordf_t offset_scaled) {
OverhangCluster* cluster = nullptr;
bool found = false;
for (int i = 0; i < clusters.size(); i++) {
auto cluster_i = &clusters[i];
if (cluster_i->intersects(*overhang, layer_nr)) {
@ -3546,13 +3539,13 @@ std::pair<PrintObjectSupportMaterial::MyLayersPtr, PrintObjectSupportMaterial::M
// distinguish between interface and base interface layers
// Contact layer is considered an interface layer, therefore run the following block only if support_interface_top_layers > 1.
// Contact layer needs a base_interface layer, therefore run the following block if support_interface_top_layers > 0, has soluble support and extruders are different.
bool soluble_interface_non_soluble_base =
// Zero z-gap between the overhangs and the support interface.
m_slicing_params.soluble_interface &&
// Interface extruder soluble.
m_object_config->support_interface_filament.value > 0 && m_print_config->filament_soluble.get_at(m_object_config->support_interface_filament.value - 1) &&
// Base extruder: Either "print with active extruder" not soluble.
(m_object_config->support_filament.value == 0 || ! m_print_config->filament_soluble.get_at(m_object_config->support_filament.value - 1));
// bool soluble_interface_non_soluble_base =
// // Zero z-gap between the overhangs and the support interface.
// m_slicing_params.soluble_interface &&
// // Interface extruder soluble.
// m_object_config->support_interface_filament.value > 0 && m_print_config->filament_soluble.get_at(m_object_config->support_interface_filament.value - 1) &&
// // Base extruder: Either "print with active extruder" not soluble.
// (m_object_config->support_filament.value == 0 || ! m_print_config->filament_soluble.get_at(m_object_config->support_filament.value - 1));
bool snug_supports = m_object_config->support_style.value == smsSnug;
// BBS: if support interface and support base do not use the same filament, add a base layer to improve their adhesion
bool differnt_support_interface_filament = m_object_config->support_interface_filament.value != m_object_config->support_filament.value;
@ -4628,7 +4621,6 @@ void PrintObjectSupportMaterial::generate_toolpaths(
if (object_layer != nullptr) {
float biggest_bridge_area = 0.f;
const Polygons& top_contact_polys = top_contact_layer.polygons_to_extrude();
for (auto layerm : object_layer->regions()) {
for (auto bridge_surface : layerm->fill_surfaces.filter_by_type(stBottomBridge)) {
float bs_area = bridge_surface->area();

View file

@ -5,7 +5,6 @@
#include "Print.hpp"
#include "Layer.hpp"
#include "Fill/FillBase.hpp"
#include "Fill/FillConcentric.hpp"
#include "CurveAnalyzer.hpp"
#include "SVG.hpp"
#include "ShortestPath.hpp"
@ -13,7 +12,6 @@
#include <libnest2d/backends/libslic3r/geometries.hpp>
#include <boost/log/trivial.hpp>
#include <tbb/blocked_range.h>
#include <tbb/parallel_for.h>
#define _L(s) Slic3r::I18N::translate(s)
@ -469,7 +467,6 @@ static bool move_inside_expolys(const ExPolygons& polygons, Point& from, double
Point ret = from;
std::vector<Point> valid_pts;
double bestDist2 = std::numeric_limits<double>::max();
unsigned int bestPoly = NO_INDEX;
bool is_already_on_correct_side_of_boundary = false; // whether [from] is already on the right side of the boundary
Point inward_dir;
for (unsigned int poly_idx = 0; poly_idx < polygons.size(); poly_idx++)
@ -510,7 +507,6 @@ static bool move_inside_expolys(const ExPolygons& polygons, Point& from, double
if (dist2 < bestDist2)
{
bestDist2 = dist2;
bestPoly = poly_idx;
if (distance == 0) { ret = x; }
else
{
@ -547,7 +543,6 @@ static bool move_inside_expolys(const ExPolygons& polygons, Point& from, double
if (dist2 < bestDist2)
{
bestDist2 = dist2;
bestPoly = poly_idx;
if (distance == 0) { ret = x; }
else
{
@ -632,7 +627,6 @@ static bool is_inside_ex(const ExPolygons &polygons, const Point &pt)
static bool move_out_expolys(const ExPolygons& polygons, Point& from, double distance, double max_move_distance)
{
Point from0 = from;
ExPolygons polys_dilated = union_ex(offset_ex(polygons, scale_(distance)));
Point pt = projection_onto(polys_dilated, from);// find_closest_ex(from, polys_dilated);
Point outward_dir = pt - from;
@ -734,16 +728,12 @@ void TreeSupport::detect_overhangs(bool detect_first_sharp_tail_only)
const coordf_t extrusion_width = config.get_abs_value("line_width", nozzle_diameter);
const coordf_t extrusion_width_scaled = scale_(extrusion_width);
const coordf_t max_bridge_length = scale_(config.max_bridge_length.value);
const bool bridge_no_support = max_bridge_length > 0;
const bool support_critical_regions_only = config.support_critical_regions_only.value;
const bool config_remove_small_overhangs = config.support_remove_small_overhang.value;
const int enforce_support_layers = config.enforce_support_layers.value;
const double area_thresh_well_supported = SQ(scale_(6));
const double length_thresh_well_supported = scale_(6);
static const double sharp_tail_max_support_height = 16.f;
// a region is considered well supported if the number of layers below it exceeds this threshold
const int thresh_layers_below = 10 / config.layer_height;
double obj_height = m_object->size().z();
// +1 makes the threshold inclusive
double thresh_angle = config.support_threshold_angle.value > EPSILON ? config.support_threshold_angle.value + 1 : 30;
thresh_angle = std::min(thresh_angle, 89.); // should be smaller than 90
@ -1406,7 +1396,6 @@ void TreeSupport::generate_toolpaths()
const PrintObjectConfig &object_config = m_object->config();
coordf_t support_extrusion_width = m_support_params.support_extrusion_width;
coordf_t nozzle_diameter = print_config.nozzle_diameter.get_at(object_config.support_filament - 1);
coordf_t layer_height = object_config.layer_height.value;
const size_t wall_count = object_config.tree_support_wall_count.value;
// Check if set to zero, use default if so.
@ -1420,8 +1409,6 @@ void TreeSupport::generate_toolpaths()
coordf_t interface_density = std::min(1., m_support_material_interface_flow.spacing() / interface_spacing);
coordf_t bottom_interface_density = std::min(1., m_support_material_interface_flow.spacing() / bottom_interface_spacing);
const coordf_t branch_radius = object_config.tree_support_branch_diameter.value / 2;
const coordf_t branch_radius_scaled = scale_(branch_radius);
if (m_object->support_layers().empty())
return;
@ -2126,7 +2113,6 @@ void TreeSupport::draw_circles(const std::vector<std::vector<Node*>>& contact_no
const bool with_lightning_infill = m_support_params.base_fill_pattern == ipLightning;
coordf_t support_extrusion_width = m_support_params.support_extrusion_width;
const size_t wall_count = config.tree_support_wall_count.value;
const PrintObjectConfig& object_config = m_object->config();
BOOST_LOG_TRIVIAL(info) << "draw_circles for object: " << m_object->model_object()->name;
@ -2377,7 +2363,7 @@ void TreeSupport::draw_circles(const std::vector<std::vector<Node*>>& contact_no
ExPolygons& base_areas = ts_layer->base_areas;
int layer_nr_lower = layer_nr - 1;
for (layer_nr_lower; layer_nr_lower >= 0; layer_nr_lower--) {
for (;layer_nr_lower >= 0; layer_nr_lower--) {
if (!m_object->get_support_layer(layer_nr_lower + m_raft_layers)->area_groups.empty()) break;
}
if (layer_nr_lower <= 0) continue;
@ -2467,7 +2453,7 @@ void TreeSupport::draw_circles(const std::vector<std::vector<Node*>>& contact_no
if (ts_layer->area_groups.empty()) continue;
int layer_nr_lower = layer_nr - 1;
for (layer_nr_lower; layer_nr_lower >= 0; layer_nr_lower--) {
for (;layer_nr_lower >= 0; layer_nr_lower--) {
if (!m_object->get_support_layer(layer_nr_lower + m_raft_layers)->area_groups.empty()) break;
}
if (layer_nr_lower < 0) continue;
@ -2582,15 +2568,10 @@ void TreeSupport::drop_nodes(std::vector<std::vector<Node*>>& contact_nodes)
const coordf_t radius_sample_resolution = m_ts_data->m_radius_sample_resolution;
const bool support_on_buildplate_only = config.support_on_build_plate_only.value;
const size_t bottom_interface_layers = config.support_interface_bottom_layers.value;
const size_t top_interface_layers = config.support_interface_top_layers.value;
float DO_NOT_MOVER_UNDER_MM = is_slim ? 0 : 5; // do not move contact points under 5mm
const auto nozzle_diameter = m_object->print()->config().nozzle_diameter.get_at(m_object->config().support_interface_filament-1);
const auto support_line_width = config.support_line_width.get_abs_value(nozzle_diameter);
auto get_branch_angle = [this,&config](coordf_t radius) {
if (config.tree_support_branch_angle.value < 30.0) return config.tree_support_branch_angle.value;
return (radius - MIN_BRANCH_RADIUS) / (MAX_BRANCH_RADIUS - MIN_BRANCH_RADIUS) * (config.tree_support_branch_angle.value - 30.0) + 30.0;
};
auto get_max_move_dist = [this, &config, branch_radius, tip_layers, diameter_angle_scale_factor, wall_count, support_extrusion_width, support_line_width](const Node *node, int power = 1) {
double move_dist = node->max_move_dist;
if (node->max_move_dist == 0) {
@ -3202,7 +3183,6 @@ void TreeSupport::adjust_layer_heights(std::vector<std::vector<Node*>>& contact_
const coordf_t layer_height = config.layer_height.value;
const coordf_t max_layer_height = m_slicing_params.max_layer_height;
const size_t bot_intf_layers = config.support_interface_bottom_layers.value;
const size_t top_intf_layers = config.support_interface_top_layers.value;
// if already using max layer height, no need to adjust
if (layer_height == max_layer_height) return;
@ -3324,7 +3304,6 @@ std::vector<LayerHeightData> TreeSupport::plan_layer_heights(std::vector<std::ve
// Insert intermediate layers.
size_t n_layers_extra = size_t(ceil(dist / (m_slicing_params.max_suport_layer_height + EPSILON)));
int actual_internel_layers = extr2_layer_nr - extr1_layer_nr - 1;
int extr_layers_left = extr2_layer_nr - extr1_layer_nr - n_layers_extra - 1;
if (n_layers_extra < 1)
continue;

View file

@ -173,7 +173,7 @@ static FacetSliceType slice_facet(
// (external on the right of the line)
for (int j = 0; j < 3; ++ j) { // loop through facet edges
int edge_id;
const stl_vertex *a, *b, *c;
const stl_vertex *a, *b/* , *c */;
int a_id, b_id;
{
int k = (idx_vertex_lowest + j) % 3;
@ -183,7 +183,7 @@ static FacetSliceType slice_facet(
a = vertices + k;
b_id = indices[l];
b = vertices + l;
c = vertices + (k + 2) % 3;
// c = vertices + (k + 2) % 3;
}
// Is edge or face aligned with the cutting plane?

View file

@ -2,7 +2,6 @@
#include <map>
#include <random>
#include <tbb/parallel_for.h>
#include <tbb/blocked_range.h>
namespace Slic3r {

View file

@ -1,5 +1,5 @@
#include "TriangulateWall.hpp"
#include "MTUtils.hpp"
//#include "TriangulateWall.hpp"
//#include "MTUtils.hpp"
namespace Slic3r {

View file

@ -1,6 +1,10 @@
#include "Triangulation.hpp"
#include "IntersectionPoints.hpp"
#ifndef _WIN32
// On linux and macOS, this include is required
#include <boost/next_prior.hpp>
#endif // _WIN32
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Constrained_Delaunay_triangulation_2.h>
#include <CGAL/Triangulation_vertex_base_with_info_2.h>

View file

@ -465,8 +465,9 @@ std::string CalibPressureAdvanceLine::print_pa_lines(double start_x, double star
const double e_per_mm = CalibPressureAdvance::e_per_mm(m_line_width, m_height_layer, m_nozzle_diameter, filament_diameter,
print_flow_ratio);
const double thin_e_per_mm = CalibPressureAdvance::e_per_mm(m_thin_line_width, m_height_layer, m_nozzle_diameter, filament_diameter,
print_flow_ratio);
// Orca: Unused due to skip drawing indicator lines
// const double thin_e_per_mm = CalibPressureAdvance::e_per_mm(m_thin_line_width, m_height_layer, m_nozzle_diameter, filament_diameter,
// print_flow_ratio);
const double number_e_per_mm = CalibPressureAdvance::e_per_mm(m_number_line_width, m_height_layer, m_nozzle_diameter, filament_diameter,
print_flow_ratio);

View file

@ -3,19 +3,12 @@
#include <atomic>
#include <locale>
#include <ctime>
#include <cstdarg>
#include <stdio.h>
#include "format.hpp"
#include "Platform.hpp"
#include "Time.hpp"
#include "libslic3r.h"
#ifdef __APPLE__
#include "MacUtils.hpp"
#endif
#ifdef WIN32
#include <windows.h>
#include <psapi.h>
@ -32,6 +25,7 @@
#ifdef __APPLE__
#include <mach/mach.h>
#include <libproc.h>
#include "MacUtils.hpp"
#endif
#ifdef __linux__
#include <sys/stat.h>
@ -39,6 +33,7 @@
#include <sys/sendfile.h>
#include <dirent.h>
#include <stdio.h>
#include "Platform.hpp"
#endif
#endif
@ -59,7 +54,6 @@
#include <boost/filesystem/path.hpp>
#include <boost/nowide/fstream.hpp>
#include <boost/nowide/convert.hpp>
#include <boost/nowide/cstdio.hpp>
// We are using quite an old TBB 2017 U7, which does not support global control API officially.
// Before we update our build servers, let's use the old API, which is deprecated in up to date TBB.
@ -1489,8 +1483,6 @@ bool bbl_calc_md5(std::string &filename, std::string &md5_out)
MD5_Init(&ctx);
boost::nowide::ifstream ifs(filename, std::ios::binary);
std::string buf(64 * 1024, 0);
const std::size_t & size = boost::filesystem::file_size(filename);
std::size_t left_size = size;
while (ifs) {
ifs.read(buf.data(), buf.size());
int read_bytes = ifs.gcount();