Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorremi <remi-j.durand@thalesgroup.com>2018-01-31 17:23:41 +0300
committerremi <remi-j.durand@thalesgroup.com>2018-01-31 17:23:41 +0300
commitbbba9684a9c8aeeeffce4e867fbf86b12bc32dec (patch)
tree828615b1ac3cdb38ed7437f1c68e8128af266d26
parentdc9d7ed70fa0fa505ddba59470899241e6676ea6 (diff)
[gyroid, thin, 1perimeter] new optionsv1alexrj
-rw-r--r--lib/Slic3r/GUI/Plater/2DToolpaths.pm13
-rw-r--r--lib/Slic3r/Print/GCode.pm20
-rw-r--r--utils/zsh/functions/_slic3r4
-rw-r--r--xs/src/libslic3r/ExtrusionEntityCollection.cpp36
-rw-r--r--xs/src/libslic3r/ExtrusionEntityCollection.hpp2
-rw-r--r--xs/src/libslic3r/Fill/Fill.cpp4
-rw-r--r--xs/src/libslic3r/Fill/Fill.hpp10
-rw-r--r--xs/src/libslic3r/Fill/FillRectilinear.cpp91
-rw-r--r--xs/src/libslic3r/Fill/FillRectilinear.hpp84
-rw-r--r--xs/src/libslic3r/LayerRegionFill.cpp54
-rw-r--r--xs/src/libslic3r/PerimeterGenerator.cpp4
-rw-r--r--xs/src/libslic3r/PrintConfig.cpp55
-rw-r--r--xs/src/libslic3r/PrintConfig.hpp8
-rw-r--r--xs/src/libslic3r/PrintObject.cpp11
14 files changed, 307 insertions, 89 deletions
diff --git a/lib/Slic3r/GUI/Plater/2DToolpaths.pm b/lib/Slic3r/GUI/Plater/2DToolpaths.pm
index 2c5a4a7d6..5631a3521 100644
--- a/lib/Slic3r/GUI/Plater/2DToolpaths.pm
+++ b/lib/Slic3r/GUI/Plater/2DToolpaths.pm
@@ -433,11 +433,16 @@ sub Render {
sub _draw {
my ($self, $object, $print_z, $path) = @_;
- my @paths = $path->isa('Slic3r::ExtrusionLoop')
- ? @$path
- : ($path);
+ if($path->isa('Slic3r::ExtrusionPath::Collection')){
+ $self->_draw($object, $print_z, $_) for @{$path};
+ }else{
- $self->_draw_path($object, $print_z, $_) for @paths;
+ my @paths = $path->isa('Slic3r::ExtrusionLoop')
+ ? @$path
+ : ($path);
+
+ $self->_draw_path($object, $print_z, $_) for @paths;
+ }
}
sub _draw_path {
diff --git a/lib/Slic3r/Print/GCode.pm b/lib/Slic3r/Print/GCode.pm
index c344b4a8a..8664666ad 100644
--- a/lib/Slic3r/Print/GCode.pm
+++ b/lib/Slic3r/Print/GCode.pm
@@ -691,10 +691,24 @@ sub _extrude_infill {
$self->_gcodegen->config->apply_static($self->print->get_region($region_id)->config);
my $collection = Slic3r::ExtrusionPath::Collection->new(@{ $entities_by_region->{$region_id} });
- for my $fill (@{$collection->chained_path_from($self->_gcodegen->last_pos, 0)}) {
+
+ $gcode .= $self->_extrude_infill_recurs($_, $collection) ;
+
+ }
+ return $gcode;
+}
+
+sub _extrude_infill_recurs {
+ my ($self, $collectionIn) = @_;
+
+ my $gcode = "";
+
+ my $collection = collectionIn;
+ if($collection->no_sort) $collection->chained_path_from($self->_gcodegen->last_pos, 0) ;
+
+ for my $fill (@{$collection->entities}) {
if ($fill->isa('Slic3r::ExtrusionPath::Collection')) {
- $gcode .= $self->_gcodegen->extrude($_, 'infill', -1)
- for @{$fill->chained_path_from($self->_gcodegen->last_pos, 0)};
+ $gcode .= $self->_extrude_infill_recurs($_, $fill) ;
} else {
$gcode .= $self->_gcodegen->extrude($fill, 'infill', -1) ;
}
diff --git a/utils/zsh/functions/_slic3r b/utils/zsh/functions/_slic3r
index a78da948a..6199e53ed 100644
--- a/utils/zsh/functions/_slic3r
+++ b/utils/zsh/functions/_slic3r
@@ -57,8 +57,8 @@ _arguments -S \
'--solid-layers[specify number of solid layers to do for top/bottom surfaces]:number of layers for top/bottom surfaces' \
'--fill-density[specify infill density]:infill density in percent' \
'--fill-angle[specify infill angle]:infill angle in degrees' \
- '--fill-pattern[specify pattern used for infill]:infill pattern:(rectilinear line concentric honeycomb hilbertcurve archimedeanchords octagramspiral)' \
- '--solid-fill-pattern[specify pattern used for solid layers]:solid fill pattern:(rectilinear concentric hilbertcurve archimedeanchords octagramspiral)' \
+ '--fill-pattern[specify pattern used for infill]:infill pattern:(rectilinear line concentric honeycomb hilbertcurve archimedeanchords octagramspiral smooth)' \
+ '--solid-fill-pattern[specify pattern used for solid layers]:solid fill pattern:(rectilinear concentric hilbertcurve archimedeanchords octagramspiral smooth)' \
'--start-gcode[load initial G-code from file]:start G-code file:_files -g "*.(#i)(gcode)(-.)"' \
'--end-gcode[load final G-code from file]:end G-code file:_files -g "*.(#i)(gcode)(-.)"' \
'--layer-gcode[load layer-change G-code from file]:layer-change G-code file:_files -g "*.(#i)(gcode)(-.)"' \
diff --git a/xs/src/libslic3r/ExtrusionEntityCollection.cpp b/xs/src/libslic3r/ExtrusionEntityCollection.cpp
index 091cd3ff0..f3a30db13 100644
--- a/xs/src/libslic3r/ExtrusionEntityCollection.cpp
+++ b/xs/src/libslic3r/ExtrusionEntityCollection.cpp
@@ -242,6 +242,42 @@ ExtrusionEntityCollection::flatten() const
return coll;
}
+/* Returns a vector of chained (new) pointers to all non-collection items contained in this one */
+void
+ExtrusionEntityCollection::flattenIfSortable(ExtrusionEntityCollection* retval) const
+{
+ if(no_sort){
+ ExtrusionEntityCollection *unsortable = new ExtrusionEntityCollection(*this);
+ retval->append(*unsortable);
+ unsortable->entities.clear();
+ for (ExtrusionEntitiesPtr::const_iterator it = this->entities.begin(); it != this->entities.end(); ++it) {
+ if ((*it)->is_collection()) {
+ ExtrusionEntityCollection* collection = dynamic_cast<ExtrusionEntityCollection*>(*it);
+ collection->flattenIfSortable(unsortable);
+ } else {
+ unsortable->append(**it);
+ }
+ }
+ }else{
+ for (ExtrusionEntitiesPtr::const_iterator it = this->entities.begin(); it != this->entities.end(); ++it) {
+ if ((*it)->is_collection()) {
+ ExtrusionEntityCollection* collection = dynamic_cast<ExtrusionEntityCollection*>(*it);
+ retval->append(collection->flattenIfSortable().entities);
+ } else {
+ retval->append(**it);
+ }
+ }
+ }
+}
+
+ExtrusionEntityCollection
+ExtrusionEntityCollection::flattenIfSortable() const
+{
+ ExtrusionEntityCollection coll;
+ this->flattenIfSortable(&coll);
+ return coll;
+}
+
double
ExtrusionEntityCollection::min_mm3_per_mm() const
{
diff --git a/xs/src/libslic3r/ExtrusionEntityCollection.hpp b/xs/src/libslic3r/ExtrusionEntityCollection.hpp
index c3a26df82..6ffa4390e 100644
--- a/xs/src/libslic3r/ExtrusionEntityCollection.hpp
+++ b/xs/src/libslic3r/ExtrusionEntityCollection.hpp
@@ -48,6 +48,8 @@ class ExtrusionEntityCollection : public ExtrusionEntity
size_t items_count() const;
void flatten(ExtrusionEntityCollection* retval) const;
ExtrusionEntityCollection flatten() const;
+ void flattenIfSortable(ExtrusionEntityCollection* retval) const;
+ ExtrusionEntityCollection flattenIfSortable() const;
double min_mm3_per_mm() const;
Polyline as_polyline() const {
CONFESS("Calling as_polyline() on a ExtrusionEntityCollection");
diff --git a/xs/src/libslic3r/Fill/Fill.cpp b/xs/src/libslic3r/Fill/Fill.cpp
index c07851fb1..127beaab6 100644
--- a/xs/src/libslic3r/Fill/Fill.cpp
+++ b/xs/src/libslic3r/Fill/Fill.cpp
@@ -36,6 +36,10 @@ Fill::new_from_type(const InfillPattern type)
case ipHilbertCurve: return new FillHilbertCurve();
case ipOctagramSpiral: return new FillOctagramSpiral();
+ case ipSmooth: return new FillSmooth();
+ case ipGyroidThin: return new FillGyroidThin();
+ case ipGyroidThick: return new FillGyroidThick();
+
default: CONFESS("unknown type"); return NULL;
}
}
diff --git a/xs/src/libslic3r/Fill/Fill.hpp b/xs/src/libslic3r/Fill/Fill.hpp
index a72d5528c..2625cc1af 100644
--- a/xs/src/libslic3r/Fill/Fill.hpp
+++ b/xs/src/libslic3r/Fill/Fill.hpp
@@ -11,6 +11,7 @@
#include "../ExPolygon.hpp"
#include "../Polyline.hpp"
#include "../PrintConfig.hpp"
+#include "../Flow.hpp"
namespace Slic3r {
@@ -26,6 +27,9 @@ public:
// Z coordinate of the top print surface, in unscaled coordinates
coordf_t z;
+ // For gyroid, to avoid impossible slopes, in unscaled value
+ coordf_t layer_height;
+
// in unscaled coordinates
coordf_t min_spacing;
@@ -79,6 +83,12 @@ public:
// Perform the fill.
virtual Polylines fill_surface(const Surface &surface);
+
+ // If this algorithm want to create an ExtrusionEntityCollection instead of a Polylines.
+ virtual bool can_create_extrusion_entity_collection() const { return false; }
+
+ // If canCreateExtrusionEntityCollection return true, this method have to return a correct new ExtrusionEntityCollection.
+ virtual void fill_surface_extrusion(const Surface *surface, const FillParams &params, const Flow &flow, ExtrusionEntityCollection &out ){}
coordf_t spacing() const { return this->_spacing; };
diff --git a/xs/src/libslic3r/Fill/FillRectilinear.cpp b/xs/src/libslic3r/Fill/FillRectilinear.cpp
index 8e0578c48..4338d0f80 100644
--- a/xs/src/libslic3r/Fill/FillRectilinear.cpp
+++ b/xs/src/libslic3r/Fill/FillRectilinear.cpp
@@ -537,4 +537,95 @@ void FillCubic::_fill_surface_single(
fill2._fill_single_direction(expolygon, direction2, -x_shift, out);
}
+Polylines FillSmooth::fill_surface(const Surface *surface, const FillParams &params)
+{
+ //ERROR: you shouldn't call that. Default to the rectilinear one.
+ printf("FillSmooth::fill_surface() : you call the wrong method (fill_surface instead of fill_surface_extrusion).\n");
+ Polylines polylines_out;
+ if (! fill_surface_by_lines(surface, params, 0.f, 0.f, polylines_out)) {
+ printf("FillRectilinear2::fill_surface() failed to fill a region.\n");
+ }
+ return polylines_out;
+}
+
+void FillSmooth::fill_surface_extrusion(const Surface *surface, const FillParams &params, const Flow &flow, ExtrusionEntityCollection &out )
+{
+ //second pass with half layer width
+ FillParams params2 = params;
+ params2.density *= 2.0f;
+ Polylines polylines_out;
+ Polylines polylines_outNoExtrud;
+
+ //choose between v1 (no extrusion on second pass) and v2 (small extrusion on second pass)
+ if(surface->area() < (scale_(this->spacing)*scale_(this->spacing)) * 200){
+ //v1 (only if < 200 nozzle˛ (for a 0.4 nozzle, it's 32 mm˛ ~ 0.32 cm˛ ~ a 5mmx5mm cube on a notebook)
+ //TODO: also use the v1 if the surface is too narrow (no 5x5mm cube can fit inside)
+
+ // a complete perimeter overlap (no extrusion anyway)
+ Surface surfaceIncr(*surface);
+ Polygons paths = offset(surfaceIncr.expolygon.contour, scale_(this->spacing));
+ surfaceIncr.expolygon.contour = paths[0];
+
+ if (! fill_surface_by_lines(surface, params, 0.f, 0.f, polylines_out) ||
+ ! fill_surface_by_lines(&surfaceIncr, params2, float(M_PI/2), 0.f, polylines_outNoExtrud)) {
+ printf("FillSmooth::fill_surface() failed to fill a region.\n");
+ }
+
+ if (polylines_out.empty())
+ return;
+
+ out.entities.push_back(create_extrusions(1.f, 0.f, polylines_out, polylines_outNoExtrud, flow));
+ }else{
+ //v2
+
+ //a small overlap
+ Surface surfaceIncr(*surface);
+ Polygons paths = offset(surfaceIncr.expolygon.contour, scale_((float)this->spacing * 0.25f));
+ surfaceIncr.expolygon.contour = paths[0];
+
+ if (! fill_surface_by_lines(surface, params, 0.f, 0.f, polylines_out) ||
+ ! fill_surface_by_lines(&surfaceIncr, params2, float(M_PI/2), 0.f, polylines_outNoExtrud)) {
+ printf("FillSmooth::fill_surface() failed to fill a region.\n");
+ }
+
+ if (polylines_out.empty())
+ return;
+
+ out.entities.push_back(create_extrusions(0.95f, 0.15f, polylines_out, polylines_outNoExtrud, flow));
+ }
+
+}
+
+ExtrusionEntityCollection* FillSmooth::create_extrusions(const float flowThickP, const float flowThinP, Polylines &polylines_thick, Polylines &polylines_thin, const Flow &flow){
+
+ ExtrusionEntityCollection *eecroot = new ExtrusionEntityCollection();
+ //you don't want to sort the extrusions: big infill first, quick weak second
+ eecroot->no_sort = true;
+
+ // Save into layer normal rectilinear path.
+ ExtrusionEntityCollection *eec = new ExtrusionEntityCollection();
+ eecroot->entities.push_back(eec);
+ eec->no_sort = true;
+ ExtrusionRole role = flow.bridge ? erBridgeInfill : erTopSolidInfill;
+ ExtrusionPath templ(role);
+ templ.mm3_per_mm = flow.mm3_per_mm()*flowThickP;
+ templ.width = flow.width*1.f;
+ templ.height = flow.height;
+ // print thick
+ coll->append(STDMOVE(polylines_thick), templ);
+
+ // Save into layer smoothing path.
+ eec = new ExtrusionEntityCollection();
+ eecroot->entities.push_back(eec);
+ eec->no_sort = true;
+ role = erInternalInfill;
+ ExtrusionPath templ(role);
+ templ.mm3_per_mm = flow.mm3_per_mm()*flowThinP;
+ templ.width = flow.width*0.15f;
+ // print thin
+ coll->append(STDMOVE(polylines_thin), templ);
+
+ return eecroot;
+}
+
} // namespace Slic3r
diff --git a/xs/src/libslic3r/Fill/FillRectilinear.hpp b/xs/src/libslic3r/Fill/FillRectilinear.hpp
index 11e3ec4a6..e40528248 100644
--- a/xs/src/libslic3r/Fill/FillRectilinear.hpp
+++ b/xs/src/libslic3r/Fill/FillRectilinear.hpp
@@ -15,14 +15,14 @@ public:
virtual bool can_solid() const { return true; };
protected:
- virtual void _fill_surface_single(
- unsigned int thickness_layers,
- const direction_t &direction,
- ExPolygon &expolygon,
- Polylines* polylines_out);
+ virtual void _fill_surface_single(
+ unsigned int thickness_layers,
+ const direction_t &direction,
+ ExPolygon &expolygon,
+ Polylines* polylines_out);
- void _fill_single_direction(ExPolygon expolygon, const direction_t &direction,
- coord_t x_shift, Polylines* out);
+ void _fill_single_direction(ExPolygon expolygon, const direction_t &direction,
+ coord_t x_shift, Polylines* out);
};
class FillAlignedRectilinear : public FillRectilinear
@@ -33,7 +33,7 @@ public:
virtual bool can_solid() const { return false; };
protected:
- // Keep the angle constant in all layers.
+ // Keep the angle constant in all layers.
virtual float _layer_angle(size_t idx) const { return 0.f; };
};
@@ -45,14 +45,14 @@ public:
virtual bool can_solid() const { return false; };
protected:
- // The grid fill will keep the angle constant between the layers,; see the implementation of Slic3r::Fill.
+ // The grid fill will keep the angle constant between the layers,; see the implementation of Slic3r::Fill.
virtual float _layer_angle(size_t idx) const { return 0.f; }
-
- virtual void _fill_surface_single(
- unsigned int thickness_layers,
- const std::pair<float, Point> &direction,
- ExPolygon &expolygon,
- Polylines* polylines_out);
+
+ virtual void _fill_surface_single(
+ unsigned int thickness_layers,
+ const std::pair<float, Point> &direction,
+ ExPolygon &expolygon,
+ Polylines* polylines_out);
};
class FillTriangles : public FillRectilinear
@@ -63,14 +63,14 @@ public:
virtual bool can_solid() const { return false; };
protected:
- // The grid fill will keep the angle constant between the layers,; see the implementation of Slic3r::Fill.
+ // The grid fill will keep the angle constant between the layers,; see the implementation of Slic3r::Fill.
virtual float _layer_angle(size_t idx) const { return 0.f; }
-
- virtual void _fill_surface_single(
- unsigned int thickness_layers,
- const std::pair<float, Point> &direction,
- ExPolygon &expolygon,
- Polylines* polylines_out);
+
+ virtual void _fill_surface_single(
+ unsigned int thickness_layers,
+ const std::pair<float, Point> &direction,
+ ExPolygon &expolygon,
+ Polylines* polylines_out);
};
class FillStars : public FillRectilinear
@@ -81,14 +81,14 @@ public:
virtual bool can_solid() const { return false; };
protected:
- // The grid fill will keep the angle constant between the layers,; see the implementation of Slic3r::Fill.
+ // The grid fill will keep the angle constant between the layers,; see the implementation of Slic3r::Fill.
virtual float _layer_angle(size_t idx) const { return 0.f; }
-
- virtual void _fill_surface_single(
- unsigned int thickness_layers,
- const std::pair<float, Point> &direction,
- ExPolygon &expolygon,
- Polylines* polylines_out);
+
+ virtual void _fill_surface_single(
+ unsigned int thickness_layers,
+ const std::pair<float, Point> &direction,
+ ExPolygon &expolygon,
+ Polylines* polylines_out);
};
class FillCubic : public FillRectilinear
@@ -99,14 +99,28 @@ public:
virtual bool can_solid() const { return false; };
protected:
- // The grid fill will keep the angle constant between the layers,; see the implementation of Slic3r::Fill.
+ // The grid fill will keep the angle constant between the layers,; see the implementation of Slic3r::Fill.
virtual float _layer_angle(size_t idx) const { return 0.f; }
+
+ virtual void _fill_surface_single(
+ unsigned int thickness_layers,
+ const std::pair<float, Point> &direction,
+ ExPolygon &expolygon,
+ Polylines* polylines_out);
+};
+
+class FillSmooth : public FillRectilinear2
+{
+public:
+ virtual Fill* clone() const { return new FillSmooth(*this); };
+ virtual ~FillSmooth() {}
+ virtual Polylines fill_surface(const Surface *surface, const FillParams &params);
+ virtual bool can_create_extrusion_entity_collection() const { return true; }
+ virtual void fill_surface_extrusion(const Surface *surface, const FillParams &params, const Flow &flow, ExtrusionEntityCollection &out );
- virtual void _fill_surface_single(
- unsigned int thickness_layers,
- const std::pair<float, Point> &direction,
- ExPolygon &expolygon,
- Polylines* polylines_out);
+protected:
+ virtual ExtrusionEntityCollection* create_extrusions(const float percent_flow_thick, const float percent_flow_thin, Polylines &polylines_thick, Polylines &polylines_thin, const Flow &flow);
+
};
}; // namespace Slic3r
diff --git a/xs/src/libslic3r/LayerRegionFill.cpp b/xs/src/libslic3r/LayerRegionFill.cpp
index 8690434d4..35700dd5d 100644
--- a/xs/src/libslic3r/LayerRegionFill.cpp
+++ b/xs/src/libslic3r/LayerRegionFill.cpp
@@ -233,6 +233,7 @@ LayerRegion::make_fill()
(perimeter_spacing + scale_(f->min_spacing))/2);
f->layer_id = this->layer()->id();
+ f->layer_height = this->layer()->object()->config.layer_height.value;
f->z = this->layer()->print_z;
f->angle = Geometry::deg2rad(this->region()->config.fill_angle.value);
@@ -253,9 +254,6 @@ LayerRegion::make_fill()
<< " angle: " << f->angle << " min-spacing: " << f->min_spacing
<< " endpoints_overlap: " << f->endpoints_overlap << std::endl << std::endl;
*/
- Polylines polylines = f->fill_surface(surface);
- if (polylines.empty())
- continue;
// calculate actual flow from spacing (which might have been adjusted by the infill
// pattern generator)
@@ -266,28 +264,38 @@ LayerRegion::make_fill()
} else {
flow = Flow::new_from_spacing(f->spacing(), flow.nozzle_diameter, h, is_bridge || f->use_bridge_flow());
}
-
- // Save into layer.
- ExtrusionEntityCollection* coll = new ExtrusionEntityCollection();
- coll->no_sort = f->no_sort();
- this->fills.entities.push_back(coll);
- {
- ExtrusionRole role;
- if (is_bridge) {
- role = erBridgeInfill;
- } else if (surface.is_solid()) {
- role = (surface.surface_type == stTop) ? erTopSolidInfill : erSolidInfill;
- } else {
- role = erInternalInfill;
- }
-
- ExtrusionPath templ(role);
- templ.mm3_per_mm = flow.mm3_per_mm();
- templ.width = flow.width;
- templ.height = flow.height;
+ //check if the infill want to be able to create the whole extrusion or we can do the standard work.
+ if(f->can_create_extrusion_entity_collection()){
+ flow.bridge = is_bridge; //i'm not 100% sure of that line [merill]
+ f->fill_surface_extrusion(&surface, params, flow, this->fills);
+ }else{
+ Polylines polylines = f->fill_surface(&surface, params);
+ if (polylines.empty())
+ continue;
+
+ // Save into layer.
+ ExtrusionEntityCollection* coll = new ExtrusionEntityCollection();
+ coll->no_sort = f->no_sort();
+ this->fills.entities.push_back(coll);
- coll->append(STDMOVE(polylines), templ);
+ {
+ ExtrusionRole role;
+ if (is_bridge) {
+ role = erBridgeInfill;
+ } else if (surface.is_solid()) {
+ role = (surface.surface_type == stTop) ? erTopSolidInfill : erSolidInfill;
+ } else {
+ role = erInternalInfill;
+ }
+
+ ExtrusionPath templ(role);
+ templ.mm3_per_mm = flow.mm3_per_mm();
+ templ.width = flow.width;
+ templ.height = flow.height;
+
+ coll->append(STDMOVE(polylines), templ);
+ }
}
}
diff --git a/xs/src/libslic3r/PerimeterGenerator.cpp b/xs/src/libslic3r/PerimeterGenerator.cpp
index 3d1b80cc1..e13fc1ef1 100644
--- a/xs/src/libslic3r/PerimeterGenerator.cpp
+++ b/xs/src/libslic3r/PerimeterGenerator.cpp
@@ -54,7 +54,9 @@ PerimeterGenerator::process()
for (Surfaces::const_iterator surface = this->slices->surfaces.begin();
surface != this->slices->surfaces.end(); ++surface) {
// detect how many perimeters must be generated for this island
- const int loop_number = this->config->perimeters + surface->extra_perimeters -1; // 0-indexed loops
+ const int loop_number = (config->only_one_perimeter_top && surface.is_external() && !surface.is_bridge() && surface.surface_type == stTop) ?
+ 0 : // only 1 perimeter for top surface if the option is set (0-indexed loops)
+ (this->config->perimeters + surface.extra_perimeters -1); // normal case (0-indexed loops)
Polygons gaps;
diff --git a/xs/src/libslic3r/PrintConfig.cpp b/xs/src/libslic3r/PrintConfig.cpp
index 048ce4567..32d4d3e1f 100644
--- a/xs/src/libslic3r/PrintConfig.cpp
+++ b/xs/src/libslic3r/PrintConfig.cpp
@@ -11,11 +11,13 @@ PrintConfigDef::PrintConfigDef()
external_fill_pattern.type = coEnum;
external_fill_pattern.enum_keys_map = ConfigOptionEnum<InfillPattern>::get_enum_values();
external_fill_pattern.enum_values.push_back("rectilinear");
+ external_fill_pattern.enum_values.push_back("smooth");
external_fill_pattern.enum_values.push_back("concentric");
external_fill_pattern.enum_values.push_back("hilbertcurve");
external_fill_pattern.enum_values.push_back("archimedeanchords");
external_fill_pattern.enum_values.push_back("octagramspiral");
external_fill_pattern.enum_labels.push_back("Rectilinear");
+ external_fill_pattern.enum_labels.push_back("Smooth");
external_fill_pattern.enum_labels.push_back("Concentric");
external_fill_pattern.enum_labels.push_back("Hilbert Curve");
external_fill_pattern.enum_labels.push_back("Archimedean Chords");
@@ -290,6 +292,13 @@ PrintConfigDef::PrintConfigDef()
def->tooltip = "Add more perimeters when needed for avoiding gaps in sloping walls.";
def->cli = "extra-perimeters!";
def->default_value = new ConfigOptionBool(true);
+
+ def = this->add("only_one_perimeter_top", coBool);
+ def->label = "Only one perimeter on Top surfaces";
+ def->category = "Layers and Perimeters";
+ def->tooltip = "Use only one perimeter on flat top surface, to let more space to the top infill pattern.";
+ def->cli = "one-top-perimeters!";
+ def->default_value = new ConfigOptionBool(true);
def = this->add("extruder", coInt);
def->gui_type = "i_enum_open";
@@ -472,6 +481,7 @@ PrintConfigDef::PrintConfigDef()
def->max = 100;
def->enum_values.push_back("0");
def->enum_values.push_back("5");
+ def->enum_values.push_back("7.5");
def->enum_values.push_back("10");
def->enum_values.push_back("15");
def->enum_values.push_back("20");
@@ -486,6 +496,7 @@ PrintConfigDef::PrintConfigDef()
def->enum_values.push_back("100");
def->enum_labels.push_back("0%");
def->enum_labels.push_back("5%");
+ def->enum_labels.push_back("7.5");
def->enum_labels.push_back("10%");
def->enum_labels.push_back("15%");
def->enum_labels.push_back("20%");
@@ -522,6 +533,8 @@ PrintConfigDef::PrintConfigDef()
def->enum_values.push_back("concentric");
def->enum_values.push_back("honeycomb");
def->enum_values.push_back("3dhoneycomb");
+ def->enum_values.push_back("gyroidthin");
+ def->enum_values.push_back("gyroidthick");
def->enum_values.push_back("hilbertcurve");
def->enum_values.push_back("archimedeanchords");
def->enum_values.push_back("octagramspiral");
@@ -534,6 +547,8 @@ PrintConfigDef::PrintConfigDef()
def->enum_labels.push_back("Concentric");
def->enum_labels.push_back("Honeycomb");
def->enum_labels.push_back("3D Honeycomb");
+ def->enum_labels.push_back("Thin Gyroid");
+ def->enum_labels.push_back("Thick Gyroid");
def->enum_labels.push_back("Hilbert Curve");
def->enum_labels.push_back("Archimedean Chords");
def->enum_labels.push_back("Octagram Spiral");
@@ -787,16 +802,16 @@ PrintConfigDef::PrintConfigDef()
def->default_value = new ConfigOptionInt(100);
def = this->add("max_layer_height", coFloats);
- def->label = "Max";
- def->tooltip = "This is the highest printable layer height for this extruder and limits the resolution for adaptive slicing. Typical values are slightly smaller than nozzle_diameter.";
- def->sidetext = "mm";
- def->cli = "max-layer-height=f@";
- def->min = 0;
- {
- ConfigOptionFloats* opt = new ConfigOptionFloats();
- opt->values.push_back(0.3);
- def->default_value = opt;
- }
+ def->label = "Max";
+ def->tooltip = "This is the highest printable layer height for this extruder and limits the resolution for adaptive slicing. Typical values are slightly smaller than nozzle_diameter.";
+ def->sidetext = "mm";
+ def->cli = "max-layer-height=f@";
+ def->min = 0;
+ {
+ ConfigOptionFloats* opt = new ConfigOptionFloats();
+ opt->values.push_back(0.3);
+ def->default_value = opt;
+ }
def = this->add("max_print_speed", coFloat);
def->label = "Max print speed";
@@ -826,16 +841,16 @@ PrintConfigDef::PrintConfigDef()
def->default_value = new ConfigOptionInt(35);
def = this->add("min_layer_height", coFloats);
- def->label = "Min";
- def->tooltip = "This is the lowest printable layer height for this extruder and limits the resolution for adaptive slicing. Typical values are 0.1 or 0.05.";
- def->sidetext = "mm";
- def->cli = "min-layer-height=f@";
- def->min = 0;
- {
- ConfigOptionFloats* opt = new ConfigOptionFloats();
- opt->values.push_back(0.15);
- def->default_value = opt;
- }
+ def->label = "Min";
+ def->tooltip = "This is the lowest printable layer height for this extruder and limits the resolution for adaptive slicing. Typical values are 0.1 or 0.05.";
+ def->sidetext = "mm";
+ def->cli = "min-layer-height=f@";
+ def->min = 0;
+ {
+ ConfigOptionFloats* opt = new ConfigOptionFloats();
+ opt->values.push_back(0.15);
+ def->default_value = opt;
+ }
def = this->add("min_print_speed", coFloat);
def->label = "Min print speed";
diff --git a/xs/src/libslic3r/PrintConfig.hpp b/xs/src/libslic3r/PrintConfig.hpp
index abf9d9a7a..921d539a4 100644
--- a/xs/src/libslic3r/PrintConfig.hpp
+++ b/xs/src/libslic3r/PrintConfig.hpp
@@ -34,9 +34,10 @@ enum HostType {
};
enum InfillPattern {
- ipRectilinear, ipGrid, ipAlignedRectilinear,
+ ipRectilinear, ipSmooth, ipGrid, ipAlignedRectilinear,
ipTriangles, ipStars, ipCubic,
ipConcentric, ipHoneycomb, ip3DHoneycomb,
+ ipGyroidThin, ipGyroidThick,
ipHilbertCurve, ipArchimedeanChords, ipOctagramSpiral,
};
@@ -72,6 +73,7 @@ template<> inline t_config_enum_values ConfigOptionEnum<HostType>::get_enum_valu
template<> inline t_config_enum_values ConfigOptionEnum<InfillPattern>::get_enum_values() {
t_config_enum_values keys_map;
keys_map["rectilinear"] = ipRectilinear;
+ keys_map["smooth"] = ipSmooth;
keys_map["alignedrectilinear"] = ipAlignedRectilinear;
keys_map["grid"] = ipGrid;
keys_map["triangles"] = ipTriangles;
@@ -80,6 +82,8 @@ template<> inline t_config_enum_values ConfigOptionEnum<InfillPattern>::get_enum
keys_map["concentric"] = ipConcentric;
keys_map["honeycomb"] = ipHoneycomb;
keys_map["3dhoneycomb"] = ip3DHoneycomb;
+ keys_map["gyroidthin"] = ipGyroidThin;
+ keys_map["gyroidthick"] = ipGyroidThick;
keys_map["hilbertcurve"] = ipHilbertCurve;
keys_map["archimedeanchords"] = ipArchimedeanChords;
keys_map["octagramspiral"] = ipOctagramSpiral;
@@ -238,6 +242,7 @@ class PrintRegionConfig : public virtual StaticPrintConfig
ConfigOptionFloatOrPercent external_perimeter_speed;
ConfigOptionBool external_perimeters_first;
ConfigOptionBool extra_perimeters;
+ ConfigOptionBool only_one_perimeter_top;
ConfigOptionFloat fill_angle;
ConfigOptionPercent fill_density;
ConfigOptionBool fill_gaps;
@@ -279,6 +284,7 @@ class PrintRegionConfig : public virtual StaticPrintConfig
OPT_PTR(external_perimeter_speed);
OPT_PTR(external_perimeters_first);
OPT_PTR(extra_perimeters);
+ OPT_PTR(only_one_perimeter_top);
OPT_PTR(fill_angle);
OPT_PTR(fill_density);
OPT_PTR(fill_gaps);
diff --git a/xs/src/libslic3r/PrintObject.cpp b/xs/src/libslic3r/PrintObject.cpp
index 8c8e76b09..fc735bded 100644
--- a/xs/src/libslic3r/PrintObject.cpp
+++ b/xs/src/libslic3r/PrintObject.cpp
@@ -954,6 +954,17 @@ PrintObject::_make_perimeters()
this->state.invalidate(posDetectSurfaces);
}
+
+ //if we want only one perimeter for each top surface, we need to know who is a top surface before the infill
+ // ! detect_surfaces_type is done is every case in the infill() call chain.
+ if(_print->default_region_config.only_one_perimeter_top){
+ // This will assign a type (top/bottom/internal) to $layerm->slices.
+ // Then the classifcation of $layerm->slices is transfered onto
+ // the $layerm->fill_surfaces by clipping $layerm->fill_surfaces
+ // by the cummulative area of the previous $layerm->fill_surfaces.
+ this->detect_surfaces_type();
+ }
+
// compare each layer to the one below, and mark those slices needing
// one additional inner perimeter, like the top of domed objects-