mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-15 01:26:10 +08:00
GCodeViewer - Added processing of gcode files produced by BambuStudio
This commit is contained in:
parent
b8a1ead9f3
commit
7fbaa3e8fd
@ -798,7 +798,8 @@ const std::vector<std::pair<GCodeProcessor::EProducer, std::string>> GCodeProces
|
|||||||
{ EProducer::Simplify3D, "G-Code generated by Simplify3D(R)" },
|
{ EProducer::Simplify3D, "G-Code generated by Simplify3D(R)" },
|
||||||
{ EProducer::CraftWare, "CraftWare" },
|
{ EProducer::CraftWare, "CraftWare" },
|
||||||
{ EProducer::ideaMaker, "ideaMaker" },
|
{ EProducer::ideaMaker, "ideaMaker" },
|
||||||
{ EProducer::KissSlicer, "KISSlicer" }
|
{ EProducer::KissSlicer, "KISSlicer" },
|
||||||
|
{ EProducer::BambuStudio, "BambuStudio" }
|
||||||
};
|
};
|
||||||
|
|
||||||
unsigned int GCodeProcessor::s_result_id = 0;
|
unsigned int GCodeProcessor::s_result_id = 0;
|
||||||
@ -2054,6 +2055,7 @@ bool GCodeProcessor::process_producers_tags(const std::string_view comment)
|
|||||||
case EProducer::CraftWare: { return process_craftware_tags(comment); }
|
case EProducer::CraftWare: { return process_craftware_tags(comment); }
|
||||||
case EProducer::ideaMaker: { return process_ideamaker_tags(comment); }
|
case EProducer::ideaMaker: { return process_ideamaker_tags(comment); }
|
||||||
case EProducer::KissSlicer: { return process_kissslicer_tags(comment); }
|
case EProducer::KissSlicer: { return process_kissslicer_tags(comment); }
|
||||||
|
case EProducer::BambuStudio: { return process_bambustudio_tags(comment); }
|
||||||
default: { return false; }
|
default: { return false; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2498,6 +2500,62 @@ bool GCodeProcessor::process_kissslicer_tags(const std::string_view comment)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool GCodeProcessor::process_bambustudio_tags(const std::string_view comment)
|
||||||
|
{
|
||||||
|
// extrusion roles
|
||||||
|
|
||||||
|
std::string tag = "FEATURE: ";
|
||||||
|
size_t pos = comment.find(tag);
|
||||||
|
if (pos != comment.npos) {
|
||||||
|
const std::string_view type = comment.substr(pos + tag.length());
|
||||||
|
if (type == "Custom")
|
||||||
|
set_extrusion_role(erCustom);
|
||||||
|
else if (type == "Inner wall")
|
||||||
|
set_extrusion_role(erPerimeter);
|
||||||
|
else if (type == "Outer wall")
|
||||||
|
set_extrusion_role(erExternalPerimeter);
|
||||||
|
else if (type == "Overhang wall")
|
||||||
|
set_extrusion_role(erOverhangPerimeter);
|
||||||
|
else if (type == "Gap infill")
|
||||||
|
set_extrusion_role(erGapFill);
|
||||||
|
else if (type == "Bridge")
|
||||||
|
set_extrusion_role(erBridgeInfill);
|
||||||
|
else if (type == "Sparse infill")
|
||||||
|
set_extrusion_role(erInternalInfill);
|
||||||
|
else if (type == "Internal solid infill")
|
||||||
|
set_extrusion_role(erSolidInfill);
|
||||||
|
else if (type == "Top surface")
|
||||||
|
set_extrusion_role(erTopSolidInfill);
|
||||||
|
else if (type == "Bottom surface")
|
||||||
|
set_extrusion_role(erNone);
|
||||||
|
else if (type == "Ironing")
|
||||||
|
set_extrusion_role(erIroning);
|
||||||
|
else if (type == "Skirt")
|
||||||
|
set_extrusion_role(erSkirt);
|
||||||
|
else if (type == "Brim")
|
||||||
|
set_extrusion_role(erSkirt);
|
||||||
|
else if (type == "Support")
|
||||||
|
set_extrusion_role(erSupportMaterial);
|
||||||
|
else if (type == "Support interface")
|
||||||
|
set_extrusion_role(erSupportMaterialInterface);
|
||||||
|
else if (type == "Support transition")
|
||||||
|
set_extrusion_role(erNone);
|
||||||
|
else if (type == "Prime tower")
|
||||||
|
set_extrusion_role(erWipeTower);
|
||||||
|
else {
|
||||||
|
set_extrusion_role(erNone);
|
||||||
|
BOOST_LOG_TRIVIAL(warning) << "GCodeProcessor found unknown extrusion role: " << type;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_extrusion_role == erExternalPerimeter)
|
||||||
|
m_seams_detector.activate(true);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool GCodeProcessor::detect_producer(const std::string_view comment)
|
bool GCodeProcessor::detect_producer(const std::string_view comment)
|
||||||
{
|
{
|
||||||
for (const auto& [id, search_string] : Producers) {
|
for (const auto& [id, search_string] : Producers) {
|
||||||
|
@ -590,7 +590,8 @@ namespace Slic3r {
|
|||||||
Simplify3D,
|
Simplify3D,
|
||||||
CraftWare,
|
CraftWare,
|
||||||
ideaMaker,
|
ideaMaker,
|
||||||
KissSlicer
|
KissSlicer,
|
||||||
|
BambuStudio
|
||||||
};
|
};
|
||||||
|
|
||||||
static const std::vector<std::pair<GCodeProcessor::EProducer, std::string>> Producers;
|
static const std::vector<std::pair<GCodeProcessor::EProducer, std::string>> Producers;
|
||||||
@ -658,6 +659,7 @@ namespace Slic3r {
|
|||||||
bool process_craftware_tags(const std::string_view comment);
|
bool process_craftware_tags(const std::string_view comment);
|
||||||
bool process_ideamaker_tags(const std::string_view comment);
|
bool process_ideamaker_tags(const std::string_view comment);
|
||||||
bool process_kissslicer_tags(const std::string_view comment);
|
bool process_kissslicer_tags(const std::string_view comment);
|
||||||
|
bool process_bambustudio_tags(const std::string_view comment);
|
||||||
|
|
||||||
bool detect_producer(const std::string_view comment);
|
bool detect_producer(const std::string_view comment);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user