mirror of
https://github.com/FULU-Foundation/OrcaSlicer-bambulab.git
synced 2026-05-15 01:22:37 -07:00
GCode Anayzer take in account extruder offsets
This commit is contained in:
@@ -101,6 +101,13 @@ GCodeAnalyzer::GCodeAnalyzer()
|
||||
reset();
|
||||
}
|
||||
|
||||
#if ENABLE_ANALYZER_EXTRUDER_OFFSET
|
||||
void GCodeAnalyzer::set_extruder_offsets(const std::vector<Vec2d>& extruder_offsets)
|
||||
{
|
||||
m_extruder_offsets = extruder_offsets;
|
||||
}
|
||||
#endif // ENABLE_ANALYZER_EXTRUDER_OFFSET
|
||||
|
||||
void GCodeAnalyzer::reset()
|
||||
{
|
||||
_set_units(Millimeters);
|
||||
@@ -118,6 +125,9 @@ void GCodeAnalyzer::reset()
|
||||
_reset_axes_position();
|
||||
|
||||
m_moves_map.clear();
|
||||
#if ENABLE_ANALYZER_EXTRUDER_OFFSET
|
||||
m_extruder_offsets.clear();
|
||||
#endif // ENABLE_ANALYZER_EXTRUDER_OFFSET
|
||||
}
|
||||
|
||||
const std::string& GCodeAnalyzer::process_gcode(const std::string& gcode)
|
||||
@@ -654,7 +664,24 @@ void GCodeAnalyzer::_store_move(GCodeAnalyzer::GCodeMove::EType type)
|
||||
it = m_moves_map.insert(TypeToMovesMap::value_type(type, GCodeMovesList())).first;
|
||||
|
||||
// store move
|
||||
#if ENABLE_ANALYZER_EXTRUDER_OFFSET
|
||||
Vec3d extruder_offset = Vec3d::Zero();
|
||||
unsigned int extruder_id = _get_extruder_id();
|
||||
|
||||
std::cout << extruder_id << std::endl;
|
||||
|
||||
if (extruder_id < m_extruder_offsets.size())
|
||||
{
|
||||
Vec2d offset = m_extruder_offsets[extruder_id];
|
||||
extruder_offset = Vec3d(offset(0), offset(1), 0.0);
|
||||
}
|
||||
|
||||
Vec3d start_position = _get_start_position() + extruder_offset;
|
||||
Vec3d end_position = _get_end_position() + extruder_offset;
|
||||
it->second.emplace_back(type, _get_extrusion_role(), extruder_id, _get_mm3_per_mm(), _get_width(), _get_height(), _get_feedrate(), start_position, end_position, _get_delta_extrusion(), _get_cp_color_id());
|
||||
#else
|
||||
it->second.emplace_back(type, _get_extrusion_role(), _get_extruder_id(), _get_mm3_per_mm(), _get_width(), _get_height(), _get_feedrate(), _get_start_position(), _get_end_position(), _get_delta_extrusion(), _get_cp_color_id());
|
||||
#endif // ENABLE_ANALYZER_EXTRUDER_OFFSET
|
||||
}
|
||||
|
||||
bool GCodeAnalyzer::_is_valid_extrusion_role(int value) const
|
||||
|
||||
Reference in New Issue
Block a user