Skip to content

Commit

Permalink
Fix regression in volume not being displayed in the GUI. #3431
Browse files Browse the repository at this point in the history
  • Loading branch information
alranel committed Jul 20, 2016
1 parent 8483746 commit f3259bb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/Slic3r/GUI/Plater.pm
Expand Up @@ -1640,8 +1640,10 @@ sub selection_changed {
$self->{object_info_size}->SetLabel(sprintf("%.2f x %.2f x %.2f", @{$model_object->instance_bounding_box(0)->size}));
$self->{object_info_materials}->SetLabel($model_object->materials_count);

if (my $stats = $model_object->raw_mesh->stats) {
$self->{object_info_volume}->SetLabel(sprintf('%.2f', $stats->{volume} * ($model_instance->scaling_factor**3)));
my $raw_mesh = $model_object->raw_mesh;
$raw_mesh->repair; # this calculates number_of_parts
if (my $stats = $raw_mesh->stats) {
$self->{object_info_volume}->SetLabel(sprintf('%.2f', $raw_mesh->volume * ($model_instance->scaling_factor**3)));
$self->{object_info_facets}->SetLabel(sprintf('%d (%d shells)', $model_object->facets_count, $stats->{number_of_parts}));
if (my $errors = sum(@$stats{qw(degenerate_facets edges_fixed facets_removed facets_added facets_reversed backwards_edges)})) {
$self->{object_info_manifold}->SetLabel(sprintf("Auto-repaired (%d errors)", $errors));
Expand Down
2 changes: 2 additions & 0 deletions xs/xsp/TriangleMesh.xsp
Expand Up @@ -13,7 +13,9 @@
void ReadSTLFile(std::string input_file);
void write_ascii(std::string output_file);
void write_binary(std::string output_file);
void check_topology();
void repair();
float volume();
void WriteOBJFile(std::string output_file);
void scale(float factor);
void scale_xyz(Pointf3* versor)
Expand Down

0 comments on commit f3259bb

Please sign in to comment.