Write mm^3/s to the G-code comments

This commit is contained in:
Alessandro Ranellucci 2017-03-31 18:44:02 +02:00
parent e78c189411
commit 3271010226
4 changed files with 67 additions and 31 deletions

View File

@ -22,9 +22,7 @@ sub get_value {
sub set_tooltip {
my ($self, $tooltip) = @_;
$self->SetToolTipString($tooltip)
if $tooltip && $self->can('SetToolTipString');
die "Method not implemented";
}
sub toggle {
@ -67,8 +65,14 @@ sub _default_size {
sub _trigger_wxWindow {
my ($self) = @_;
$self->wxWindow->SetToolTipString($self->option->tooltip)
if $self->option->tooltip && $self->wxWindow->can('SetToolTipString');
$self->set_tooltip($self->option->tooltip);
}
sub set_tooltip {
my ($self, $tooltip) = @_;
$self->wxWindow->SetToolTipString($tooltip)
if $self->wxWindow->can('SetToolTipString');
}
sub set_value {

View File

@ -80,22 +80,56 @@ sub export {
my $layer_height = $first_object->config->layer_height;
for my $region_id (0..$#{$self->print->regions}) {
my $region = $self->print->regions->[$region_id];
printf $fh "; external perimeters extrusion width = %.2fmm\n",
$region->flow(FLOW_ROLE_EXTERNAL_PERIMETER, $layer_height, 0, 0, -1, $first_object)->width;
printf $fh "; perimeters extrusion width = %.2fmm\n",
$region->flow(FLOW_ROLE_PERIMETER, $layer_height, 0, 0, -1, $first_object)->width;
printf $fh "; infill extrusion width = %.2fmm\n",
$region->flow(FLOW_ROLE_INFILL, $layer_height, 0, 0, -1, $first_object)->width;
printf $fh "; solid infill extrusion width = %.2fmm\n",
$region->flow(FLOW_ROLE_SOLID_INFILL, $layer_height, 0, 0, -1, $first_object)->width;
printf $fh "; top infill extrusion width = %.2fmm\n",
$region->flow(FLOW_ROLE_TOP_SOLID_INFILL, $layer_height, 0, 0, -1, $first_object)->width;
printf $fh "; support material extrusion width = %.2fmm\n",
$self->objects->[0]->support_material_flow->width
if $self->print->has_support_material;
printf $fh "; first layer extrusion width = %.2fmm\n",
{
my $flow = $region->flow(FLOW_ROLE_EXTERNAL_PERIMETER, $layer_height, 0, 0, -1, $first_object);
my $vol_speed = $flow->mm3_per_mm * $region->config->get_abs_value('external_perimeter_speed');
$vol_speed = min($vol_speed, $self->config->max_volumetric_speed) if $self->config->max_volumetric_speed > 0;
printf $fh "; external perimeters extrusion width = %.2fmm (%.2fmm^3/s)\n",
$flow->width, $vol_speed;
}
{
my $flow = $region->flow(FLOW_ROLE_PERIMETER, $layer_height, 0, 0, -1, $first_object);
my $vol_speed = $flow->mm3_per_mm * $region->config->get_abs_value('perimeter_speed');
$vol_speed = min($vol_speed, $self->config->max_volumetric_speed) if $self->config->max_volumetric_speed > 0;
printf $fh "; perimeters extrusion width = %.2fmm (%.2fmm^3/s)\n",
$flow->width, $vol_speed;
}
{
my $flow = $region->flow(FLOW_ROLE_INFILL, $layer_height, 0, 0, -1, $first_object);
my $vol_speed = $flow->mm3_per_mm * $region->config->get_abs_value('infill_speed');
$vol_speed = min($vol_speed, $self->config->max_volumetric_speed) if $self->config->max_volumetric_speed > 0;
printf $fh "; infill extrusion width = %.2fmm (%.2fmm^3/s)\n",
$flow->width, $vol_speed;
}
{
my $flow = $region->flow(FLOW_ROLE_SOLID_INFILL, $layer_height, 0, 0, -1, $first_object);
my $vol_speed = $flow->mm3_per_mm * $region->config->get_abs_value('solid_infill_speed');
$vol_speed = min($vol_speed, $self->config->max_volumetric_speed) if $self->config->max_volumetric_speed > 0;
printf $fh "; solid infill extrusion width = %.2fmm (%.2fmm^3/s)\n",
$flow->width, $vol_speed;
}
{
my $flow = $region->flow(FLOW_ROLE_TOP_SOLID_INFILL, $layer_height, 0, 0, -1, $first_object);
my $vol_speed = $flow->mm3_per_mm * $region->config->get_abs_value('top_solid_infill_speed');
$vol_speed = min($vol_speed, $self->config->max_volumetric_speed) if $self->config->max_volumetric_speed > 0;
printf $fh "; top infill extrusion width = %.2fmm (%.2fmm^3/s)\n",
$flow->width, $vol_speed;
}
if ($self->print->has_support_material) {
my $object0 = $self->objects->[0];
my $flow = $object0->support_material_flow;
my $vol_speed = $flow->mm3_per_mm / $object0->config->get_abs_value('support_material_speed');
$vol_speed = min($vol_speed, $self->config->max_volumetric_speed) if $self->config->max_volumetric_speed > 0;
printf $fh "; support material extrusion width = %.2fmm (%.2fmm^3/s)\n",
$flow->width, $vol_speed;
}
printf $fh "; first layer extrusion width = %.2fmm (%.2fmm^3/s)\n",
$region->flow(FLOW_ROLE_PERIMETER, $layer_height, 0, 1, -1, $self->objects->[0])->width
if $region->config->first_layer_extrusion_width;
print $fh "\n";
}

View File

@ -813,21 +813,19 @@ Print::_make_brim()
const coord_t grow_distance = flow.scaled_width()/2;
Polygons islands;
FOREACH_OBJECT(this, object) {
const Layer &layer0 = *(*object)->get_layer(0);
for (PrintObject* object : this->objects) {
const Layer* layer0 = object->get_layer(0);
Polygons object_islands = layer0.slices.contours();
Polygons object_islands = layer0->slices.contours();
if (!(*object)->support_layers.empty()) {
const SupportLayer &support_layer0 = *(*object)->get_support_layer(0);
if (!object->support_layers.empty()) {
const SupportLayer* support_layer0 = object->get_support_layer(0);
for (ExtrusionEntitiesPtr::const_iterator it = support_layer0.support_fills.entities.begin();
it != support_layer0.support_fills.entities.end(); ++it)
append_to(object_islands, offset((*it)->as_polyline(), grow_distance));
for (const ExtrusionEntity* e : support_layer0.support_fills.entities)
append_to(object_islands, offset(e->as_polyline(), grow_distance));
for (ExtrusionEntitiesPtr::const_iterator it = support_layer0.support_interface_fills.entities.begin();
it != support_layer0.support_interface_fills.entities.end(); ++it)
append_to(object_islands, offset((*it)->as_polyline(), grow_distance));
for (const ExtrusionEntity* e : support_layer0.support_interface_fills.entities)
append_to(object_islands, offset(e->as_polyline(), grow_distance));
}
for (const Point &copy : (*object)->_shifted_copies) {
for (Polygon p : object_islands) {

View File

@ -751,7 +751,7 @@ PrintConfigDef::PrintConfigDef()
def = this->add("max_volumetric_speed", coFloat);
def->label = "Max volumetric speed";
def->category = "Speed";
def->tooltip = "This experimental setting is used to set the maximum volumetric speed your extruder supports.";
def->tooltip = "If set to a non-zero value, extrusion will be limited to this volumetric speed. You may want to set it to your extruder maximum. As a hint, you can read calculated volumetric speeds in the comments of any G-code file you export from Slic3r.";
def->sidetext = "mm³/s";
def->cli = "max-volumetric-speed=f";
def->min = 0;