mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-12 01:07:57 -06:00
GCode Preview - Added feature type for wipe tower
This commit is contained in:
parent
fe8dfb9c9b
commit
f9dd251276
6 changed files with 45 additions and 16 deletions
|
@ -77,7 +77,7 @@ sub new {
|
||||||
$combochecklist_features->UseAltPopupWindow();
|
$combochecklist_features->UseAltPopupWindow();
|
||||||
$combochecklist_features->EnablePopupAnimation(0);
|
$combochecklist_features->EnablePopupAnimation(0);
|
||||||
my $feature_text = "Feature types";
|
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);
|
Slic3r::GUI::create_combochecklist($combochecklist_features, $feature_text, $feature_items, 1);
|
||||||
|
|
||||||
my $checkbox_travel = Wx::CheckBox->new($self, -1, "Travel");
|
my $checkbox_travel = Wx::CheckBox->new($self, -1, "Travel");
|
||||||
|
|
|
@ -25,6 +25,7 @@ enum ExtrusionRole {
|
||||||
erSkirt,
|
erSkirt,
|
||||||
erSupportMaterial,
|
erSupportMaterial,
|
||||||
erSupportMaterialInterface,
|
erSupportMaterialInterface,
|
||||||
|
erWipeTower,
|
||||||
// Extrusion role for a collection with multiple extrusion roles.
|
// Extrusion role for a collection with multiple extrusion roles.
|
||||||
erMixed,
|
erMixed,
|
||||||
};
|
};
|
||||||
|
|
|
@ -1454,7 +1454,9 @@ static inline const char* ExtrusionRole2String(const ExtrusionRole role)
|
||||||
case erSkirt: return "erSkirt";
|
case erSkirt: return "erSkirt";
|
||||||
case erSupportMaterial: return "erSupportMaterial";
|
case erSupportMaterial: return "erSupportMaterial";
|
||||||
case erSupportMaterialInterface: return "erSupportMaterialInterface";
|
case erSupportMaterialInterface: return "erSupportMaterialInterface";
|
||||||
|
case erWipeTower: return "erWipeTower";
|
||||||
case erMixed: return "erMixed";
|
case erMixed: return "erMixed";
|
||||||
|
|
||||||
default: return "erInvalid";
|
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] =
|
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(0.0f, 0.0f, 0.0f, 1.0f), // erNone
|
||||||
Color(1.0f, 0.0f, 0.0f, 1.0f), // erPerimeter
|
Color(1.0f, 0.0f, 0.0f, 1.0f), // erPerimeter
|
||||||
Color(0.0f, 1.0f, 0.0f, 1.0f), // erExternalPerimeter
|
Color(0.0f, 1.0f, 0.0f, 1.0f), // erExternalPerimeter
|
||||||
Color(0.0f, 0.0f, 1.0f, 1.0f), // erOverhangPerimeter
|
Color(0.0f, 0.0f, 1.0f, 1.0f), // erOverhangPerimeter
|
||||||
Color(1.0f, 1.0f, 0.0f, 1.0f), // erInternalInfill
|
Color(1.0f, 1.0f, 0.0f, 1.0f), // erInternalInfill
|
||||||
Color(1.0f, 0.0f, 1.0f, 1.0f), // erSolidInfill
|
Color(1.0f, 0.0f, 1.0f, 1.0f), // erSolidInfill
|
||||||
Color(0.0f, 1.0f, 1.0f, 1.0f), // erTopSolidInfill
|
Color(0.0f, 1.0f, 1.0f, 1.0f), // erTopSolidInfill
|
||||||
Color(0.5f, 0.5f, 0.5f, 1.0f), // erBridgeInfill
|
Color(0.5f, 0.5f, 0.5f, 1.0f), // erBridgeInfill
|
||||||
Color(1.0f, 1.0f, 1.0f, 1.0f), // erGapFill
|
Color(1.0f, 1.0f, 1.0f, 1.0f), // erGapFill
|
||||||
Color(0.5f, 0.0f, 0.0f, 1.0f), // erSkirt
|
Color(0.5f, 0.0f, 0.0f, 1.0f), // erSkirt
|
||||||
Color(0.0f, 0.5f, 0.0f, 1.0f), // erSupportMaterial
|
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.5f, 1.0f), // erSupportMaterialInterface
|
||||||
Color(0.0f, 0.0f, 0.0f, 1.0f) // erMixed
|
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
|
// todo: merge with Slic3r::ExtrusionRole2String() from GCode.cpp
|
||||||
|
@ -225,6 +226,7 @@ const std::string GCodeAnalyzer::PreviewData::Extrusion::Default_Extrusion_Role_
|
||||||
"Skirt",
|
"Skirt",
|
||||||
"Support material",
|
"Support material",
|
||||||
"Support material interface",
|
"Support material interface",
|
||||||
|
"Wipe tower",
|
||||||
"Mixed"
|
"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)
|
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;
|
return false;
|
||||||
|
|
||||||
unsigned int flag = (unsigned int)::exp2((double)(role - erPerimeter));
|
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);
|
_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)
|
void GCodeAnalyzer::_process_gcode_line(GCodeReader&, const GCodeReader::GCodeLine& line)
|
||||||
{
|
{
|
||||||
// processes 'special' comments contained in line
|
// processes 'special' comments contained in line
|
||||||
|
@ -597,7 +604,7 @@ void GCodeAnalyzer::_processG1(const GCodeReader::GCodeLine& line)
|
||||||
type = GCodeMove::Move;
|
type = GCodeMove::Move;
|
||||||
|
|
||||||
ExtrusionRole role = _get_extrusion_role();
|
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;
|
type = GCodeMove::Move;
|
||||||
|
|
||||||
// updates axis positions
|
// updates axis positions
|
||||||
|
|
|
@ -293,6 +293,8 @@ public:
|
||||||
// Calculates all data needed for gcode visualization
|
// Calculates all data needed for gcode visualization
|
||||||
void calc_gcode_preview_data(Print& print);
|
void calc_gcode_preview_data(Print& print);
|
||||||
|
|
||||||
|
static bool is_valid_extrusion_role(ExtrusionRole role);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Processes the given gcode line
|
// Processes the given gcode line
|
||||||
void _process_gcode_line(GCodeReader& reader, const GCodeReader::GCodeLine& line);
|
void _process_gcode_line(GCodeReader& reader, const GCodeReader::GCodeLine& line);
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "Analyzer.hpp"
|
||||||
|
|
||||||
#if defined(__linux) || defined(__GNUC__ )
|
#if defined(__linux) || defined(__GNUC__ )
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#endif /* __linux */
|
#endif /* __linux */
|
||||||
|
@ -419,6 +421,11 @@ WipeTower::ToolChangeResult WipeTowerPrusaMM::prime(
|
||||||
// Increase the extruder driver current to allow fast ramming.
|
// Increase the extruder driver current to allow fast ramming.
|
||||||
.set_extruder_trimpot(750);
|
.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) {
|
if (purpose == PURPOSE_EXTRUDE || purpose == PURPOSE_MOVE_TO_TOWER_AND_EXTRUDE) {
|
||||||
float y_end = 0.f;
|
float y_end = 0.f;
|
||||||
for (size_t idx_tool = 0; idx_tool < tools.size(); ++ idx_tool) {
|
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);
|
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) {
|
if (purpose == PURPOSE_EXTRUDE || purpose == PURPOSE_MOVE_TO_TOWER_AND_EXTRUDE) {
|
||||||
// Increase the extruder driver current to allow fast ramming.
|
// Increase the extruder driver current to allow fast ramming.
|
||||||
writer.set_extruder_trimpot(750);
|
writer.set_extruder_trimpot(750);
|
||||||
|
@ -637,6 +649,11 @@ WipeTower::ToolChangeResult WipeTowerPrusaMM::toolchange_Brim(Purpose purpose, b
|
||||||
else
|
else
|
||||||
writer.set_initial_position(initial_position);
|
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) {
|
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.
|
// 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),
|
writer.extrude_explicit(wipeTower_box.ld - xy(m_perimeter_width * 6.f, 0),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue