diff --git a/resources/profiles/PrusaResearch.idx b/resources/profiles/PrusaResearch.idx index a2d416fa4d..99f7f0ba31 100644 --- a/resources/profiles/PrusaResearch.idx +++ b/resources/profiles/PrusaResearch.idx @@ -1,4 +1,5 @@ min_slic3r_version = 2.1.0-alpha0 +1.0.0-beta1 Updated color for the ASA filaments to differ from the other filaments. Single extruder printers now have no extruder color assigned, obects and toolpaths will be colored with the color of the active filament. 1.0.0-beta0 Printer model checks in start G-codes, ASA filament profiles, limits on min / max SL1 exposition times 1.0.0-alpha0 Filament specific retract for PET and similar copolymers, and for FLEX min_slic3r_version = 1.42.0-alpha6 diff --git a/resources/profiles/PrusaResearch.ini b/resources/profiles/PrusaResearch.ini index 2c28e6df0c..6e44143e4e 100644 --- a/resources/profiles/PrusaResearch.ini +++ b/resources/profiles/PrusaResearch.ini @@ -5,7 +5,7 @@ name = Prusa Research # Configuration version of this file. Config file will only be installed, if the config_version differs. # This means, the server may force the PrusaSlicer configuration to be downgraded. -config_version = 1.0.0-beta0 +config_version = 1.0.0-beta1 # Where to get the updates from? config_update_url = http://files.prusa3d.com/wp-content/uploads/repository/PrusaSlicer-settings-master/live/PrusaResearch/ changelog_url = http://files.prusa3d.com/?latest=slicer-profiles&lng=%1% @@ -1223,7 +1223,7 @@ bed_temperature = 110 min_fan_speed = 20 disable_fan_first_layers = 4 filament_type = ASA -filament_colour = #484848 +filament_colour = #FFF2EC start_filament_gcode = "M900 K{if printer_notes=~/.*PRINTER_HAS_BOWDEN.*/}200{elsif nozzle_diameter[0]==0.6}12{else}20{endif} ; Filament gcode" [filament:Fillamentum CPE] @@ -1341,7 +1341,7 @@ filament_cooling_final_speed = 2 filament_cooling_initial_speed = 3 filament_cooling_moves = 1 filament_type = ASA -filament_colour = #484848 +filament_colour = #FFF2EC start_filament_gcode = "M900 K{if printer_notes=~/.*PRINTER_HAS_BOWDEN.*/}200{elsif nozzle_diameter[0]==0.6}12{else}20{endif} ; Filament gcode" [filament:Prusa ABS MMU2] @@ -2184,7 +2184,6 @@ before_layer_gcode = ;BEFORE_LAYER_CHANGE\nG92 E0.0\n;[layer_z]\n\n between_objects_gcode = deretract_speed = 0 end_gcode = G4 ; wait\nM104 S0 ; turn off temperature\nM140 S0 ; turn off heatbed\nM107 ; turn off fan\n{if layer_z < max_print_height}G1 Z{z_offset+min(layer_z+30, max_print_height)}{endif} ; Move print head up\nG1 X0 Y200 F3000 ; home X axis\nM84 ; disable motors -extruder_colour = #FFFF00 extruder_offset = 0x0 gcode_flavor = marlin silent_mode = 0 diff --git a/src/libslic3r/EdgeGrid.cpp b/src/libslic3r/EdgeGrid.cpp index f40d499de1..a97210da63 100644 --- a/src/libslic3r/EdgeGrid.cpp +++ b/src/libslic3r/EdgeGrid.cpp @@ -290,9 +290,10 @@ void EdgeGrid::Grid::create_from_m_contours(coord_t resolution) size_t j; } visitor(m_cell_data, m_cells, m_cols); + assert(visitor.i == 0); for (; visitor.i < m_contours.size(); ++ visitor.i) { const Slic3r::Points &pts = *m_contours[visitor.i]; - for (; visitor.j < pts.size(); ++ visitor.j) + for (visitor.j = 0; visitor.j < pts.size(); ++ visitor.j) this->visit_cells_intersecting_line(pts[visitor.j], pts[(visitor.j + 1 == pts.size()) ? 0 : visitor.j + 1], visitor); } } diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index 008cad940b..5ff8c4dce8 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -24,6 +24,8 @@ #include "SVG.hpp" +#include + #include #if 0 @@ -48,7 +50,12 @@ static inline void check_add_eol(std::string &gcode) if (! gcode.empty() && gcode.back() != '\n') gcode += '\n'; } - + +void AvoidCrossingPerimeters::init_external_mp(const Print &print) +{ + m_external_mp = Slic3r::make_unique(union_ex(this->collect_contours_all_layers(print.objects()))); +} + // Plan a travel move while minimizing the number of perimeter crossings. // point is in unscaled coordinates, in the coordinate system of the current active object // (set by gcodegen.set_origin()). @@ -65,6 +72,72 @@ Polyline AvoidCrossingPerimeters::travel_to(const GCode &gcodegen, const Point & return result; } +// Collect outer contours of all objects over all layers. +// Discard objects only containing thin walls (offset would fail on an empty polygon). +// Used by avoid crossing perimeters feature. +Polygons AvoidCrossingPerimeters::collect_contours_all_layers(const PrintObjectPtrs& objects) +{ + Polygons islands; + for (const PrintObject *object : objects) { + // Reducing all the object slices into the Z projection in a logarithimc fashion. + // First reduce to half the number of layers. + std::vector polygons_per_layer((object->layers().size() + 1) / 2); + tbb::parallel_for(tbb::blocked_range(0, object->layers().size() / 2), + [&object, &polygons_per_layer](const tbb::blocked_range &range) { + for (size_t i = range.begin(); i < range.end(); ++ i) { + const Layer* layer1 = object->layers()[i * 2]; + const Layer* layer2 = object->layers()[i * 2 + 1]; + Polygons polys; + polys.reserve(layer1->slices.expolygons.size() + layer2->slices.expolygons.size()); + for (const ExPolygon &expoly : layer1->slices.expolygons) + //FIXME no holes? + polys.emplace_back(expoly.contour); + for (const ExPolygon &expoly : layer2->slices.expolygons) + //FIXME no holes? + polys.emplace_back(expoly.contour); + polygons_per_layer[i] = union_(polys); + } + }); + if (object->layers().size() & 1) { + const Layer *layer = object->layers().back(); + Polygons polys; + polys.reserve(layer->slices.expolygons.size()); + for (const ExPolygon &expoly : layer->slices.expolygons) + //FIXME no holes? + polys.emplace_back(expoly.contour); + polygons_per_layer.back() = union_(polys); + } + // Now reduce down to a single layer. + size_t cnt = polygons_per_layer.size(); + while (cnt > 1) { + tbb::parallel_for(tbb::blocked_range(0, cnt / 2), + [&polygons_per_layer](const tbb::blocked_range &range) { + for (size_t i = range.begin(); i < range.end(); ++ i) { + Polygons polys; + polys.reserve(polygons_per_layer[i * 2].size() + polygons_per_layer[i * 2 + 1].size()); + polygons_append(polys, polygons_per_layer[i * 2]); + polygons_append(polys, polygons_per_layer[i * 2 + 1]); + polygons_per_layer[i * 2] = union_(polys); + } + }); + for (size_t i = 0; i < cnt / 2; ++ i) + polygons_per_layer[i] = std::move(polygons_per_layer[i * 2]); + if (cnt & 1) + polygons_per_layer[cnt / 2] = std::move(polygons_per_layer[cnt - 1]); + cnt = (cnt + 1) / 2; + } + // And collect copies of the objects. + for (const Point © : object->copies()) { + // All the layers were reduced to the 1st item of polygons_per_layer. + size_t i = islands.size(); + polygons_append(islands, polygons_per_layer.front()); + for (; i < islands.size(); ++ i) + islands[i].translate(copy); + } + } + return islands; +} + std::string OozePrevention::pre_toolchange(GCode &gcodegen) { std::string gcode; @@ -940,21 +1013,10 @@ void GCode::_do_export(Print &print, FILE *file) // Initialize a motion planner for object-to-object travel moves. if (print.config().avoid_crossing_perimeters.value) { - // Collect outer contours of all objects over all layers. - // Discard objects only containing thin walls (offset would fail on an empty polygon). - Polygons islands; - for (const PrintObject *object : print.objects()) - for (const Layer *layer : object->layers()) - for (const ExPolygon &expoly : layer->slices.expolygons) - for (const Point © : object->copies()) { - islands.emplace_back(expoly.contour); - islands.back().translate(copy); - } - //FIXME Mege the islands in parallel. - m_avoid_crossing_perimeters.init_external_mp(union_ex(islands)); + m_avoid_crossing_perimeters.init_external_mp(print); print.throw_if_canceled(); } - + // Calculate wiping points if needed if (print.config().ooze_prevention.value && ! print.config().single_extruder_multi_material) { Points skirt_points; diff --git a/src/libslic3r/GCode.hpp b/src/libslic3r/GCode.hpp index f2a67f600b..4baf000f3f 100644 --- a/src/libslic3r/GCode.hpp +++ b/src/libslic3r/GCode.hpp @@ -45,12 +45,15 @@ public: AvoidCrossingPerimeters() : use_external_mp(false), use_external_mp_once(false), disable_once(true) {} ~AvoidCrossingPerimeters() {} - void init_external_mp(const ExPolygons &islands) { m_external_mp = Slic3r::make_unique(islands); } + void init_external_mp(const Print &print); void init_layer_mp(const ExPolygons &islands) { m_layer_mp = Slic3r::make_unique(islands); } Polyline travel_to(const GCode &gcodegen, const Point &point); private: + // For initializing the regions to avoid. + static Polygons collect_contours_all_layers(const PrintObjectPtrs& objects); + std::unique_ptr m_external_mp; std::unique_ptr m_layer_mp; }; diff --git a/version.inc b/version.inc index 961124060e..8ddb0541e2 100644 --- a/version.inc +++ b/version.inc @@ -3,7 +3,7 @@ set(SLIC3R_APP_NAME "PrusaSlicer") set(SLIC3R_APP_KEY "PrusaSlicer") -set(SLIC3R_VERSION "2.1.0-beta") +set(SLIC3R_VERSION "2.1.0-beta2") set(SLIC3R_BUILD_ID "PrusaSlicer-${SLIC3R_VERSION}+UNKNOWN") set(SLIC3R_RC_VERSION "2,1,0,0") set(SLIC3R_RC_VERSION_DOTS "2.1.0.0")