diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index cbb01672d1b..a2ee8abd80d 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -3170,7 +3170,7 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato } } if (activate_air_filtration_during_print) - file.write(m_writer.set_exhaust_fan(during_print_exhaust_fan_speed, true)); + file.write(m_writer.set_exhaust_fan(during_print_exhaust_fan_speed)); print.throw_if_canceled(); @@ -3478,7 +3478,7 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato } } if (activate_air_filtration_on_completion) - file.write(m_writer.set_exhaust_fan(complete_print_exhaust_fan_speed, true)); + file.write(m_writer.set_exhaust_fan(complete_print_exhaust_fan_speed)); // adds tags for time estimators file.write_format(";%s\n", GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Last_Line_M73_Placeholder).c_str()); file.write_format("; EXECUTABLE_BLOCK_END\n\n"); @@ -5098,7 +5098,7 @@ LayerResult GCode::process_layer( for (unsigned int extruder_id : layer_tools.extruders) { if (print.config().skirt_type == stCombined && !print.skirt().empty()) - gcode += generate_skirt(print, print.skirt(), Point(0, 0), layer.object()->config().skirt_start_angle, layer_tools, layer, + gcode += generate_skirt(print, print.skirt(), Point(0, 0), layer.object()->config().skirt_start_angle.value, layer_tools, layer, extruder_id); if (print.config().print_sequence == PrintSequence::ByLayer && m_enable_exclude_object && print.config().support_object_skip_flush.value) { @@ -5196,7 +5196,7 @@ LayerResult GCode::process_layer( m_skirt_done.erase(m_skirt_done.begin()+1,m_skirt_done.end()); const Point& offset = instance_to_print.print_object.instances()[instance_to_print.instance_id].shift; - gcode += generate_skirt(print, instance_to_print.print_object.object_skirt(), offset, instance_to_print.print_object.config().skirt_start_angle, layer_tools, layer, extruder_id); + gcode += generate_skirt(print, instance_to_print.print_object.object_skirt(), offset, instance_to_print.print_object.config().skirt_start_angle.value, layer_tools, layer, extruder_id); } } @@ -5583,7 +5583,7 @@ void GCode::set_origin(const Vec2d &pointf) scale_(m_origin(0) - pointf(0)), scale_(m_origin(1) - pointf(1)) ); - m_last_pos += translate; + m_last_pos += Point3(translate, 0); m_wipe.path.translate(translate); m_origin = pointf; } @@ -10021,7 +10021,7 @@ std::optional GCode::texture_mapping_seam_hiding_hint(const double segment_t, double arc_mm, double span_mm) -> std::optional { - const Points &points = path.polyline.points; + const Points3 &points = path.polyline.points; if (segment_index == 0 || segment_index >= points.size()) return std::nullopt; @@ -10170,7 +10170,7 @@ std::optional GCode::texture_mapping_seam_hiding_hint(const float(m_config.texture_mapping_outer_wall_gradient_max_line_width.value)); const float base_outer_width_mm = vertex_color_match_mode ? texture_mapping_max_outer_width_mm : path_outer_width_mm; const float sample_step_mm = std::clamp(0.5f * base_outer_width_mm, 0.15f, 0.5f); - const Points &points = path.polyline.points; + const Points3 &points = path.polyline.points; const size_t path_index = external_path_idx; double path_arc_start_mm = total_length_mm; @@ -10710,7 +10710,7 @@ std::string GCode::extrude_infill(const Print &print, const std::vector(fill); if (eec) { @@ -10745,7 +10745,7 @@ std::string GCode::extrude_support(const ExtrusionEntityCollection &support_fill if (extrusions.empty()) return gcode; - chain_and_reorder_extrusion_entities(extrusions, &m_last_pos); + { Point _lp = m_last_pos.to_point(); chain_and_reorder_extrusion_entities(extrusions, &_lp); } const double support_speed = m_config.support_speed.value; const double support_interface_speed = m_config.get_abs_value("support_interface_speed"); @@ -11220,7 +11220,7 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description, }; size_t texture_path_segment_idx = 0; - for (const Line &line : path.polyline.lines()) { + for (const Line3 &line : path.polyline.lines()) { if (!outer_wall_gradient_dynamic_ctx.enabled) break; @@ -12591,7 +12591,7 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description, (outer_wall_gradient_dynamic_ctx.object_center_mode || outer_wall_gradient_dynamic_ctx.vertex_color_match_mode); size_t line_idx = 0; - for (const Line &line : path.polyline.lines()) { + for (const Line3 &line : path.polyline.lines()) { const size_t segment_idx = line_idx++; const double line_length = line.length() * SCALING_FACTOR; if (!std::isfinite(line_length) || line_length < EPSILON) diff --git a/src/libslic3r/GCode.hpp b/src/libslic3r/GCode.hpp index 059a9e92ace..9fa221f34ca 100644 --- a/src/libslic3r/GCode.hpp +++ b/src/libslic3r/GCode.hpp @@ -21,7 +21,6 @@ #include "GCode/ThumbnailData.hpp" #include "libslic3r/ObjectID.hpp" #include "GCode/ExtrusionProcessor.hpp" -#include "ColorSolver.hpp" #include "GCode/PressureEqualizer.hpp" #include "GCode/SmallAreaInfillFlowCompensator.hpp" @@ -30,85 +29,21 @@ #include "GCode/TimelapsePosPicker.hpp" -#include -#include #include #include -#include #include #include -#include -#include #include namespace Slic3r { // Forward declarations. class GCode; -class ModelVolume; namespace CustomGCode{ struct Item; } struct PrintInstance; class ConstPrintObjectPtrsAdaptor; -using GCodeGenericMixCandidateSet = ColorSolverCandidateSet; - -struct VertexColorOverhangWeightField { - float min_x_mm { 0.f }; - float min_y_mm { 0.f }; - float bucket_width_mm { 1.f }; - float bucket_height_mm { 1.f }; - int bucket_width { 0 }; - int bucket_height { 0 }; - size_t component_count { 0 }; - std::vector sample_x_mm; - std::vector sample_y_mm; - std::vector sample_weight; - std::vector sample_component_weights; - std::vector> buckets; - std::vector fallback_weights; - bool raw_component_weights_from_texture { false }; - bool binary_dithered { false }; - - bool empty() const - { - return bucket_width <= 0 || - bucket_height <= 0 || - component_count == 0 || - sample_x_mm.empty() || - sample_y_mm.size() != sample_x_mm.size() || - sample_weight.size() != sample_x_mm.size() || - sample_component_weights.size() != sample_x_mm.size() * component_count; - } -}; - -struct GCodeUVTextureTriangleMetadata { - const ModelVolume *volume { nullptr }; - Vec3d p0; - Vec3d p1; - Vec3d p2; - std::array uv; - float min_z { 0.f }; - float max_z { 0.f }; - float max_uv_edge_texel { 0.f }; - float max_world_edge_mm { 0.f }; - double area_mm2 { 0.0 }; -}; - -struct GCodeUVTextureVolumeMetadata { - const ModelVolume *volume { nullptr }; - std::vector triangles; - std::vector> z_bins; - std::vector fallback_triangle_indices; - float min_z { 0.f }; - float max_z { 0.f }; - float z_bin_step_mm { 1.f }; -}; - -struct GCodeUVTextureTriangleCache { - std::vector volumes; -}; - class OozePrevention { public: bool enable; @@ -195,7 +130,6 @@ private: // Postprocesses gcode: rotates and moves G1 extrusions and returns result std::string post_process_wipe_tower_moves(const WipeTower::ToolChangeResult& tcr, const Vec2f& translation, float angle) const; - Vec2f offset_for_extruder(int extruder_id) const; // Left / right edges of the wipe tower, for the planning of wipe moves. const float m_left; const float m_right; @@ -305,10 +239,8 @@ public: bool enable_cooling_markers() const { return m_enable_cooling_markers; } std::string extrusion_role_to_string_for_parser(const ExtrusionRole &); - // Calculate the interpolated value for the current layer between start_value and end_value. - // Step will create equal layers steps from first to last value. - // Step = 0 means gradual interpolation finishing at last value. - float interpolate_value_across_layers(float start_value, float end_value, float step = 0.0f) const; + // Calculate the interpolated value for the current layer between start_value and end_value + float interpolate_value_across_layers(float start_value, float end_value) const; // For Perl bindings, to be used exclusively by unit tests. unsigned int layer_count() const { return m_layer_count; } @@ -409,16 +341,7 @@ private: const float skirt_start_angle, const LayerTools &layer_tools, const Layer& layer, - unsigned int extruder_id, - std::vector &skirt_done); - std::string generate_object_skirt_group(const Print &print, - const PrintObject &object, - const LayerTools &layer_tools, - const Layer& layer, unsigned int extruder_id); - std::string generate_object_brim(const Print &print, - const PrintObject &object, - bool first_layer); LayerResult process_layer( const Print &print, @@ -470,18 +393,18 @@ private: // Orca: pass the complete collection of region perimeters to the extrude loop to check whether the wipe before external loop // should be executed std::string extrude_entity(const ExtrusionEntity& entity, - const std::string& description = "", + std::string description = "", double speed = -1., const ExtrusionEntitiesPtr& region_perimeters = ExtrusionEntitiesPtr()); // Orca: pass the complete collection of region perimeters to the extrude loop to check whether the wipe before external loop // should be executed - std::string extrude_loop(const ExtrusionLoop& loop, - const std::string& description, + std::string extrude_loop(ExtrusionLoop loop, + std::string description, double speed = -1., const ExtrusionEntitiesPtr& region_perimeters = ExtrusionEntitiesPtr(), const Point* start_point = nullptr); - std::string extrude_multi_path(const ExtrusionMultiPath& multipath, const std::string& description = "", double speed = -1.); - std::string extrude_path(const ExtrusionPath& path, const std::string& description = "", double speed = -1.); + std::string extrude_multi_path(ExtrusionMultiPath multipath, std::string description = "", double speed = -1.); + std::string extrude_path(ExtrusionPath path, std::string description = "", double speed = -1.); // Orca: Adaptive PA variables // Used for adaptive PA when extruding paths with multiple, varying flow segments. @@ -566,7 +489,6 @@ private: std::string extrude_support(const ExtrusionEntityCollection& support_fills, const ExtrusionRole support_extrusion_role); // BBS - bool object_has_top_surface_coloring_shell_infill(const PrintObject &object); LiftType to_lift_type(ZHopType z_hop_types); std::set m_objsWithBrim; // indicates the objs with brim @@ -576,12 +498,6 @@ private: ExtrusionQualityEstimator m_extrusion_quality_estimator; - std::map, VertexColorOverhangWeightField> m_vertex_color_overhang_weight_field_cache; - std::map m_uv_texture_triangle_cache; - std::map m_generic_solver_mix_candidate_cache; - std::map m_top_surface_coloring_shell_infill_object_cache; - bool m_warned_texture_mapping_filament_count_mismatch { false }; - std::set m_warned_texture_mapping_color_match_zone_ids; /* Origin of print coordinates expressed in unscaled G-code coordinates. This affects the input arguments supplied to the extrude*() and travel_to() @@ -641,7 +557,6 @@ private: std::string _encode_label_ids_to_base64(std::vector ids); // ORCA: Add support for role based fan speed control std::array m_is_role_based_fan_on; - std::array m_role_based_fan_marker_layer; // Markers for the Pressure Equalizer to recognize the extrusion type. // The Pressure Equalizer removes the markers from the final G-code. bool m_enable_extrusion_role_markers; @@ -691,8 +606,8 @@ private: std::unique_ptr m_small_area_infill_flow_compensator; - // Heights (print_z) at which each grouped skirt has already been extruded. - std::vector> m_skirt_group_done; + // Heights (print_z) at which the skirt has already been extruded. + std::vector m_skirt_done; // Has the brim been extruded already? Brim is being extruded only for the first object of a multi-object print. bool m_brim_done; // Flag indicating whether the nozzle temperature changes from 1st to 2nd layer were performed. @@ -734,7 +649,6 @@ private: double calc_max_volumetric_speed(const double layer_height, const double line_width, const std::string co_str); std::string _extrude(const ExtrusionPath &path, std::string description = "", double speed = -1); - std::optional texture_mapping_seam_hiding_hint(const ExtrusionLoop &loop); bool _needSAFC(const ExtrusionPath &path); void print_machine_envelope(GCodeOutputStream& file, Print& print); void _print_first_layer_bed_temperature(GCodeOutputStream &file, Print &print, const std::string &gcode, unsigned int first_printing_extruder_id, bool wait);