added options for adaptive slicing

This commit is contained in:
florens 2014-08-13 19:07:20 +02:00
parent 5a96bad8c2
commit f6f81ea751
6 changed files with 38 additions and 2 deletions

View File

@ -36,6 +36,7 @@ use Encode::Locale;
use Moo 1.003001;
use Slic3r::XS; # import all symbols (constants etc.) before they get parsed
use Slic3r::AdaptiveSlicing;
use Slic3r::Config;
use Slic3r::ExPolygon;
use Slic3r::Extruder;

View File

@ -416,6 +416,7 @@ sub build {
$self->init_config_options(qw(
layer_height first_layer_height
adaptive_slicing cusp_value
perimeters spiral_vase
top_solid_layers bottom_solid_layers
extra_perimeters avoid_crossing_perimeters thin_walls overhangs
@ -458,6 +459,8 @@ sub build {
my $optgroup = $page->new_optgroup('Layer height');
$optgroup->append_single_option_line('layer_height');
$optgroup->append_single_option_line('first_layer_height');
$optgroup->append_single_option_line('adaptive_slicing');
$optgroup->append_single_option_line('cusp_value');
}
{
my $optgroup = $page->new_optgroup('Vertical shells');
@ -695,6 +698,12 @@ sub _update {
$self->get_field($_)->toggle($have_perimeters)
for qw(extra_perimeters thin_walls overhangs seam_position external_perimeters_first);
my $have_adaptive_slicing = $config->adaptive_slicing;
$self->get_field($_)->toggle($have_adaptive_slicing)
for qw(cusp_value);
$self->get_field($_)->toggle(!$have_adaptive_slicing)
for qw(layer_height);
my $have_infill = $config->fill_density > 0;
$self->get_field($_)->toggle($have_infill)
for qw(fill_pattern infill_every_layers infill_only_where_needed solid_infill_every_layers);

View File

@ -107,7 +107,7 @@ sub slice {
$self->clear_layers;
# make layers taking custom heights into account
my $print_z = my $slice_z = my $height = my $id = 0;
my $print_z = my $slice_z = my $height = my $cusp_height = my $id = 0;
my $first_object_layer_height = -1;
my $first_object_layer_distance = -1;
@ -134,6 +134,11 @@ sub slice {
# loop until we have at least one layer and the max slice_z reaches the object height
my $max_z = unscale($self->size->z);
while (($slice_z - $height) <= $max_z) {
if ($self->config->adaptive_slicing) {
#dummy
}
# assign the default height to the layer according to the general settings
$height = ($id == 0)
? $self->config->get_value('first_layer_height')

View File

@ -6,6 +6,11 @@ t_optiondef_map
PrintConfigDef::build_def() {
t_optiondef_map Options;
Options["adaptive_slicing"].type = coBool;
Options["adaptive_slicing"].label = "Use adaptive slicing";
Options["adaptive_slicing"].tooltip = "Automatically determine layer heights by the objects topology instead of using the static value.";
Options["adaptive_slicing"].cli = "adaptive-slicing!";
Options["avoid_crossing_perimeters"].type = coBool;
Options["avoid_crossing_perimeters"].label = "Avoid crossing perimeters";
Options["avoid_crossing_perimeters"].tooltip = "Optimize travel moves in order to minimize the crossing of perimeters. This is mostly useful with Bowden extruders which suffer from oozing. This feature slows down both the print and the G-code generation.";
@ -78,6 +83,14 @@ PrintConfigDef::build_def() {
Options["cooling"].tooltip = "This flag enables the automatic cooling logic that adjusts print speed and fan speed according to layer printing time.";
Options["cooling"].cli = "cooling!";
Options["cusp_value"].type = coFloat;
Options["cusp_value"].label = "Cusp value";
Options["cusp_value"].tooltip = "This value determines the maximum deviaton from the objects original surface caused by the stair-stepping effect (approximation of the surface by discrete layers). Use a value between 0 (highest possible resolution) and [max_layer_height] (lowest possible resolution). Typical values are 0.1 - 0.2.";
Options["cusp_value"].sidetext = "mm";
Options["cusp_value"].cli = "cusp_value=f";
Options["cusp_value"].min = 0;
Options["cusp_value"].max = 1;
Options["default_acceleration"].type = coFloat;
Options["default_acceleration"].label = "Default";
Options["default_acceleration"].tooltip = "This is the acceleration your printer will be reset to after the role-specific acceleration values are used (perimeter/infill). Set zero to prevent resetting acceleration at all.";

View File

@ -114,6 +114,8 @@ class StaticPrintConfig : public virtual StaticConfig
class PrintObjectConfig : public virtual StaticPrintConfig
{
public:
ConfigOptionBool adaptive_slicing;
ConfigOptionFloat cusp_value;
ConfigOptionBool dont_support_bridges;
ConfigOptionFloatOrPercent extrusion_width;
ConfigOptionFloatOrPercent first_layer_height;
@ -138,6 +140,8 @@ class PrintObjectConfig : public virtual StaticPrintConfig
ConfigOptionFloat xy_size_compensation;
PrintObjectConfig() : StaticPrintConfig() {
this->adaptive_slicing.value = false;
this->cusp_value.value = 0.15;
this->dont_support_bridges.value = true;
this->extrusion_width.value = 0;
this->extrusion_width.percent = false;
@ -167,6 +171,8 @@ class PrintObjectConfig : public virtual StaticPrintConfig
};
ConfigOption* option(const t_config_option_key opt_key, bool create = false) {
if (opt_key == "adaptive_slicing") return &this->adaptive_slicing;
if (opt_key == "cusp_value") return &this->cusp_value;
if (opt_key == "dont_support_bridges") return &this->dont_support_bridges;
if (opt_key == "extrusion_width") return &this->extrusion_width;
if (opt_key == "first_layer_height") return &this->first_layer_height;

View File

@ -145,6 +145,8 @@ PrintObject::invalidate_state_by_config_options(const std::vector<t_config_optio
|| *opt_key == "layer_height"
|| *opt_key == "first_layer_height"
|| *opt_key == "xy_size_compensation"
|| *opt_key == "adaptive_slicing"
|| *opt_key == "cusp_value"
|| *opt_key == "raft_layers") {
steps.insert(posSlice);
} else if (*opt_key == "support_material"