mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-11-02 20:51:23 -07:00 
			
		
		
		
	added total cost/weight to Extruder statistics, mocked up addendum to status bar change.
This commit is contained in:
		
							parent
							
								
									3846d9e734
								
							
						
					
					
						commit
						203a965b3d
					
				
					 5 changed files with 30 additions and 6 deletions
				
			
		| 
						 | 
				
			
			@ -1343,6 +1343,7 @@ sub on_export_completed {
 | 
			
		|||
        } else {
 | 
			
		||||
            $message = "G-code file exported to " . $self->{export_gcode_output_file};
 | 
			
		||||
        }
 | 
			
		||||
        $message .= sprintf(" Cost: %.2f" , $self->{print}->total_cost);
 | 
			
		||||
    } else {
 | 
			
		||||
        $message = "Export failed";
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -321,8 +321,8 @@ sub export {
 | 
			
		|||
    $self->print->clear_filament_stats;
 | 
			
		||||
    $self->print->total_used_filament(0);
 | 
			
		||||
    $self->print->total_extruded_volume(0);
 | 
			
		||||
    my $total_filament_weight = 0.0;
 | 
			
		||||
    my $total_filament_cost = 0.0;
 | 
			
		||||
    $self->print->total_weight(0);
 | 
			
		||||
    $self->print->total_cost(0);
 | 
			
		||||
    foreach my $extruder (@{$gcodegen->writer->extruders}) {
 | 
			
		||||
        my $used_filament = $extruder->used_filament;
 | 
			
		||||
        my $extruded_volume = $extruder->extruded_volume;
 | 
			
		||||
| 
						 | 
				
			
			@ -333,11 +333,11 @@ sub export {
 | 
			
		|||
        printf $fh "; filament used = %.1fmm (%.1fcm3)\n",
 | 
			
		||||
            $used_filament, $extruded_volume/1000;
 | 
			
		||||
        if ($filament_weight > 0) {
 | 
			
		||||
            $total_filament_weight += $filament_weight;
 | 
			
		||||
            $self->print->total_weight($self->print->total_weight + $filament_weight);
 | 
			
		||||
            printf $fh "; filament used = %.1fg\n",
 | 
			
		||||
                   $filament_weight;
 | 
			
		||||
            if ($filament_cost > 0) {
 | 
			
		||||
                $total_filament_cost += $filament_cost;
 | 
			
		||||
                $self->print->total_cost($self->print->total_cost + $filament_cost);
 | 
			
		||||
                printf $fh "; filament cost = %.1f\n",
 | 
			
		||||
                       $filament_cost;
 | 
			
		||||
            }
 | 
			
		||||
| 
						 | 
				
			
			@ -347,7 +347,7 @@ sub export {
 | 
			
		|||
        $self->print->total_extruded_volume($self->print->total_extruded_volume + $extruded_volume);
 | 
			
		||||
    }
 | 
			
		||||
    printf $fh "; total filament cost = %.1f\n",
 | 
			
		||||
           $total_filament_cost;
 | 
			
		||||
           $self->print->total_cost;
 | 
			
		||||
    
 | 
			
		||||
    # append full config
 | 
			
		||||
    print $fh "\n";
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -268,6 +268,8 @@ sub generate_support_material {
 | 
			
		|||
    }
 | 
			
		||||
    
 | 
			
		||||
    $self->set_step_done(STEP_SUPPORTMATERIAL);
 | 
			
		||||
    my $stats = "Weight: %.1fg, Cost: %.1f" , $self->print->total_weight, $self->print->total_cost;
 | 
			
		||||
    $self->print->status_cb->(85, $stats);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Idempotence of this method is guaranteed by the fact that we don't remove things from
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue