GCode Preview - Added feature type for wipe tower
This commit is contained in:
parent
fe8dfb9c9b
commit
f9dd251276
@ -77,7 +77,7 @@ sub new {
|
||||
$combochecklist_features->UseAltPopupWindow();
|
||||
$combochecklist_features->EnablePopupAnimation(0);
|
||||
my $feature_text = "Feature types";
|
||||
my $feature_items = "Perimeter|External perimeter|Overhang perimeter|Internal infill|Solid infill|Top solid infill|Bridge infill|Gap fill|Skirt|Support material|Support material interface";
|
||||
my $feature_items = "Perimeter|External perimeter|Overhang perimeter|Internal infill|Solid infill|Top solid infill|Bridge infill|Gap fill|Skirt|Support material|Support material interface|Wipe tower";
|
||||
Slic3r::GUI::create_combochecklist($combochecklist_features, $feature_text, $feature_items, 1);
|
||||
|
||||
my $checkbox_travel = Wx::CheckBox->new($self, -1, "Travel");
|
||||
|
@ -25,6 +25,7 @@ enum ExtrusionRole {
|
||||
erSkirt,
|
||||
erSupportMaterial,
|
||||
erSupportMaterialInterface,
|
||||
erWipeTower,
|
||||
// Extrusion role for a collection with multiple extrusion roles.
|
||||
erMixed,
|
||||
};
|
||||
|
@ -1454,7 +1454,9 @@ static inline const char* ExtrusionRole2String(const ExtrusionRole role)
|
||||
case erSkirt: return "erSkirt";
|
||||
case erSupportMaterial: return "erSupportMaterial";
|
||||
case erSupportMaterialInterface: return "erSupportMaterialInterface";
|
||||
case erWipeTower: return "erWipeTower";
|
||||
case erMixed: return "erMixed";
|
||||
|
||||
default: return "erInvalid";
|
||||
};
|
||||
}
|
||||
|
@ -195,19 +195,20 @@ GCodeAnalyzer::PreviewData::LegendItem::LegendItem(const std::string& text, cons
|
||||
|
||||
const GCodeAnalyzer::PreviewData::Color GCodeAnalyzer::PreviewData::Extrusion::Default_Extrusion_Role_Colors[Num_Extrusion_Roles] =
|
||||
{
|
||||
Color(0.0f, 0.0f, 0.0f, 1.0f), // erNone
|
||||
Color(1.0f, 0.0f, 0.0f, 1.0f), // erPerimeter
|
||||
Color(0.0f, 1.0f, 0.0f, 1.0f), // erExternalPerimeter
|
||||
Color(0.0f, 0.0f, 1.0f, 1.0f), // erOverhangPerimeter
|
||||
Color(1.0f, 1.0f, 0.0f, 1.0f), // erInternalInfill
|
||||
Color(1.0f, 0.0f, 1.0f, 1.0f), // erSolidInfill
|
||||
Color(0.0f, 1.0f, 1.0f, 1.0f), // erTopSolidInfill
|
||||
Color(0.5f, 0.5f, 0.5f, 1.0f), // erBridgeInfill
|
||||
Color(1.0f, 1.0f, 1.0f, 1.0f), // erGapFill
|
||||
Color(0.5f, 0.0f, 0.0f, 1.0f), // erSkirt
|
||||
Color(0.0f, 0.5f, 0.0f, 1.0f), // erSupportMaterial
|
||||
Color(0.0f, 0.0f, 0.5f, 1.0f), // erSupportMaterialInterface
|
||||
Color(0.0f, 0.0f, 0.0f, 1.0f) // erMixed
|
||||
Color(0.0f, 0.0f, 0.0f, 1.0f), // erNone
|
||||
Color(1.0f, 0.0f, 0.0f, 1.0f), // erPerimeter
|
||||
Color(0.0f, 1.0f, 0.0f, 1.0f), // erExternalPerimeter
|
||||
Color(0.0f, 0.0f, 1.0f, 1.0f), // erOverhangPerimeter
|
||||
Color(1.0f, 1.0f, 0.0f, 1.0f), // erInternalInfill
|
||||
Color(1.0f, 0.0f, 1.0f, 1.0f), // erSolidInfill
|
||||
Color(0.0f, 1.0f, 1.0f, 1.0f), // erTopSolidInfill
|
||||
Color(0.5f, 0.5f, 0.5f, 1.0f), // erBridgeInfill
|
||||
Color(1.0f, 1.0f, 1.0f, 1.0f), // erGapFill
|
||||
Color(0.5f, 0.0f, 0.0f, 1.0f), // erSkirt
|
||||
Color(0.0f, 0.5f, 0.0f, 1.0f), // erSupportMaterial
|
||||
Color(0.0f, 0.0f, 0.5f, 1.0f), // erSupportMaterialInterface
|
||||
Color(0.7f, 0.89f, 0.67f, 1.0f), // erWipeTower
|
||||
Color(0.0f, 0.0f, 0.0f, 1.0f) // erMixed
|
||||
};
|
||||
|
||||
// todo: merge with Slic3r::ExtrusionRole2String() from GCode.cpp
|
||||
@ -225,6 +226,7 @@ const std::string GCodeAnalyzer::PreviewData::Extrusion::Default_Extrusion_Role_
|
||||
"Skirt",
|
||||
"Support material",
|
||||
"Support material interface",
|
||||
"Wipe tower",
|
||||
"Mixed"
|
||||
};
|
||||
|
||||
@ -258,7 +260,7 @@ bool GCodeAnalyzer::PreviewData::Extrusion::is_role_flag_set(ExtrusionRole role)
|
||||
|
||||
bool GCodeAnalyzer::PreviewData::Extrusion::is_role_flag_set(unsigned int flags, ExtrusionRole role)
|
||||
{
|
||||
if ((role < erPerimeter) || (erSupportMaterialInterface < role))
|
||||
if (!is_valid_extrusion_role(role))
|
||||
return false;
|
||||
|
||||
unsigned int flag = (unsigned int)::exp2((double)(role - erPerimeter));
|
||||
@ -458,6 +460,11 @@ void GCodeAnalyzer::calc_gcode_preview_data(Print& print)
|
||||
_calc_gcode_preview_unretractions(print);
|
||||
}
|
||||
|
||||
bool GCodeAnalyzer::is_valid_extrusion_role(ExtrusionRole role)
|
||||
{
|
||||
return ((erPerimeter <= role) && (role < erMixed));
|
||||
}
|
||||
|
||||
void GCodeAnalyzer::_process_gcode_line(GCodeReader&, const GCodeReader::GCodeLine& line)
|
||||
{
|
||||
// processes 'special' comments contained in line
|
||||
@ -597,7 +604,7 @@ void GCodeAnalyzer::_processG1(const GCodeReader::GCodeLine& line)
|
||||
type = GCodeMove::Move;
|
||||
|
||||
ExtrusionRole role = _get_extrusion_role();
|
||||
if ((type == GCodeMove::Extrude) && ((_get_width() == 0.0f) || (_get_height() == 0.0f) || (role < erPerimeter) || (erSupportMaterialInterface < role)))
|
||||
if ((type == GCodeMove::Extrude) && ((_get_width() == 0.0f) || (_get_height() == 0.0f) || !is_valid_extrusion_role(role)))
|
||||
type = GCodeMove::Move;
|
||||
|
||||
// updates axis positions
|
||||
|
@ -293,6 +293,8 @@ public:
|
||||
// Calculates all data needed for gcode visualization
|
||||
void calc_gcode_preview_data(Print& print);
|
||||
|
||||
static bool is_valid_extrusion_role(ExtrusionRole role);
|
||||
|
||||
private:
|
||||
// Processes the given gcode line
|
||||
void _process_gcode_line(GCodeReader& reader, const GCodeReader::GCodeLine& line);
|
||||
|
@ -6,6 +6,8 @@
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
#include "Analyzer.hpp"
|
||||
|
||||
#if defined(__linux) || defined(__GNUC__ )
|
||||
#include <strings.h>
|
||||
#endif /* __linux */
|
||||
@ -419,6 +421,11 @@ WipeTower::ToolChangeResult WipeTowerPrusaMM::prime(
|
||||
// Increase the extruder driver current to allow fast ramming.
|
||||
.set_extruder_trimpot(750);
|
||||
|
||||
// adds tag for analyzer
|
||||
char buf[32];
|
||||
sprintf(buf, ";%s%d\n", GCodeAnalyzer::Extrusion_Role_Tag.c_str(), erWipeTower);
|
||||
writer.append(buf);
|
||||
|
||||
if (purpose == PURPOSE_EXTRUDE || purpose == PURPOSE_MOVE_TO_TOWER_AND_EXTRUDE) {
|
||||
float y_end = 0.f;
|
||||
for (size_t idx_tool = 0; idx_tool < tools.size(); ++ idx_tool) {
|
||||
@ -554,6 +561,11 @@ WipeTower::ToolChangeResult WipeTowerPrusaMM::tool_change(unsigned int tool, boo
|
||||
writer.set_initial_position(initial_position);
|
||||
}
|
||||
|
||||
// adds tag for analyzer
|
||||
char buf[32];
|
||||
sprintf(buf, ";%s%d\n", GCodeAnalyzer::Extrusion_Role_Tag.c_str(), erWipeTower);
|
||||
writer.append(buf);
|
||||
|
||||
if (purpose == PURPOSE_EXTRUDE || purpose == PURPOSE_MOVE_TO_TOWER_AND_EXTRUDE) {
|
||||
// Increase the extruder driver current to allow fast ramming.
|
||||
writer.set_extruder_trimpot(750);
|
||||
@ -637,6 +649,11 @@ WipeTower::ToolChangeResult WipeTowerPrusaMM::toolchange_Brim(Purpose purpose, b
|
||||
else
|
||||
writer.set_initial_position(initial_position);
|
||||
|
||||
// adds tag for analyzer
|
||||
char buf[32];
|
||||
sprintf(buf, ";%s%d\n", GCodeAnalyzer::Extrusion_Role_Tag.c_str(), erWipeTower);
|
||||
writer.append(buf);
|
||||
|
||||
if (purpose == PURPOSE_EXTRUDE || purpose == PURPOSE_MOVE_TO_TOWER_AND_EXTRUDE) {
|
||||
// Prime the extruder 10*m_perimeter_width left along the vertical edge of the wipe tower.
|
||||
writer.extrude_explicit(wipeTower_box.ld - xy(m_perimeter_width * 6.f, 0),
|
||||
|
Loading…
Reference in New Issue
Block a user