mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-01 03:11:59 +08:00
"Filament" option for the View combobox in the preview tab.
This commit is contained in:
parent
55b91d2987
commit
234d6b68b1
@ -77,10 +77,12 @@ sub new {
|
|||||||
$choice_view_type->Append(L("Speed"));
|
$choice_view_type->Append(L("Speed"));
|
||||||
$choice_view_type->Append(L("Volumetric flow rate"));
|
$choice_view_type->Append(L("Volumetric flow rate"));
|
||||||
$choice_view_type->Append(L("Tool"));
|
$choice_view_type->Append(L("Tool"));
|
||||||
|
$choice_view_type->Append(L("Filament"));
|
||||||
$choice_view_type->SetSelection(0);
|
$choice_view_type->SetSelection(0);
|
||||||
|
|
||||||
# the following value needs to be changed if new items are added into $choice_view_type before "Tool"
|
# the following value needs to be changed if new items are added into $choice_view_type before "Tool"
|
||||||
$self->{tool_idx} = 5;
|
$self->{tool_idx} = 5;
|
||||||
|
$self->{filament_idx} = 6;
|
||||||
|
|
||||||
my $label_show_features = $self->{label_show_features} = Wx::StaticText->new($self, -1, L("Show"));
|
my $label_show_features = $self->{label_show_features} = Wx::StaticText->new($self, -1, L("Show"));
|
||||||
|
|
||||||
@ -357,6 +359,15 @@ sub load_print {
|
|||||||
push @colors, $color;
|
push @colors, $color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if($self->gcode_preview_data->type == $self->{filament_idx}) {
|
||||||
|
my @extruder_colors = @{$self->{config}->extruder_colour};
|
||||||
|
my @filament_colors = @{$self->{config}->filament_colour};
|
||||||
|
for (my $i = 0; $i <= $#extruder_colors; $i += 1) {
|
||||||
|
my $color = $filament_colors[$i];
|
||||||
|
$color = '#FFFFFF' if (! defined($color) || $color !~ m/^#[[:xdigit:]]{6}/);
|
||||||
|
push @colors, $color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($self->IsShown) {
|
if ($self->IsShown) {
|
||||||
# used to set the sliders to the extremes of the current zs range
|
# used to set the sliders to the extremes of the current zs range
|
||||||
|
@ -370,6 +370,8 @@ std::string GCodePreviewData::get_legend_title() const
|
|||||||
return L("Volumetric flow rate (mm3/s)");
|
return L("Volumetric flow rate (mm3/s)");
|
||||||
case Extrusion::Tool:
|
case Extrusion::Tool:
|
||||||
return L("Tool");
|
return L("Tool");
|
||||||
|
case Extrusion::Filament:
|
||||||
|
return L("Filament");
|
||||||
}
|
}
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
@ -431,6 +433,7 @@ GCodePreviewData::LegendItemsList GCodePreviewData::get_legend_items(const std::
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Extrusion::Tool:
|
case Extrusion::Tool:
|
||||||
|
case Extrusion::Filament:
|
||||||
{
|
{
|
||||||
unsigned int tools_colors_count = tool_colors.size() / 4;
|
unsigned int tools_colors_count = tool_colors.size() / 4;
|
||||||
items.reserve(tools_colors_count);
|
items.reserve(tools_colors_count);
|
||||||
|
@ -72,6 +72,7 @@ public:
|
|||||||
Feedrate,
|
Feedrate,
|
||||||
VolumetricRate,
|
VolumetricRate,
|
||||||
Tool,
|
Tool,
|
||||||
|
Filament,
|
||||||
Num_View_Types
|
Num_View_Types
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -3674,6 +3674,7 @@ void GLCanvas3D::_load_gcode_extrusion_paths(const GCodePreviewData& preview_dat
|
|||||||
case GCodePreviewData::Extrusion::VolumetricRate:
|
case GCodePreviewData::Extrusion::VolumetricRate:
|
||||||
return path.feedrate * (float)path.mm3_per_mm;
|
return path.feedrate * (float)path.mm3_per_mm;
|
||||||
case GCodePreviewData::Extrusion::Tool:
|
case GCodePreviewData::Extrusion::Tool:
|
||||||
|
case GCodePreviewData::Extrusion::Filament:
|
||||||
return (float)path.extruder_id;
|
return (float)path.extruder_id;
|
||||||
default:
|
default:
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
@ -3697,6 +3698,7 @@ void GLCanvas3D::_load_gcode_extrusion_paths(const GCodePreviewData& preview_dat
|
|||||||
case GCodePreviewData::Extrusion::VolumetricRate:
|
case GCodePreviewData::Extrusion::VolumetricRate:
|
||||||
return data.get_volumetric_rate_color(value);
|
return data.get_volumetric_rate_color(value);
|
||||||
case GCodePreviewData::Extrusion::Tool:
|
case GCodePreviewData::Extrusion::Tool:
|
||||||
|
case GCodePreviewData::Extrusion::Filament:
|
||||||
{
|
{
|
||||||
GCodePreviewData::Color color;
|
GCodePreviewData::Color color;
|
||||||
::memcpy((void*)color.rgba, (const void*)(tool_colors.data() + (unsigned int)value * 4), 4 * sizeof(float));
|
::memcpy((void*)color.rgba, (const void*)(tool_colors.data() + (unsigned int)value * 4), 4 * sizeof(float));
|
||||||
@ -3829,6 +3831,7 @@ void GLCanvas3D::_load_gcode_travel_paths(const GCodePreviewData& preview_data,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GCodePreviewData::Extrusion::Tool:
|
case GCodePreviewData::Extrusion::Tool:
|
||||||
|
case GCodePreviewData::Extrusion::Filament:
|
||||||
{
|
{
|
||||||
res = _travel_paths_by_tool(preview_data, tool_colors);
|
res = _travel_paths_by_tool(preview_data, tool_colors);
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user