mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-12 17:27:52 -06:00
Fix of #1812 (GCode Anayzer take in account extruder offsets for multiextruder printers)
This commit is contained in:
parent
de23725a1e
commit
219ea04c23
4 changed files with 12 additions and 33 deletions
|
@ -101,12 +101,10 @@ GCodeAnalyzer::GCodeAnalyzer()
|
|||
reset();
|
||||
}
|
||||
|
||||
#if ENABLE_ANALYZER_EXTRUDER_OFFSET
|
||||
void GCodeAnalyzer::set_extruder_offsets(const std::vector<Vec2d>& extruder_offsets)
|
||||
void GCodeAnalyzer::set_extruder_offsets(const GCodeAnalyzer::ExtruderOffsetsMap& extruder_offsets)
|
||||
{
|
||||
m_extruder_offsets = extruder_offsets;
|
||||
}
|
||||
#endif // ENABLE_ANALYZER_EXTRUDER_OFFSET
|
||||
|
||||
void GCodeAnalyzer::reset()
|
||||
{
|
||||
|
@ -125,9 +123,7 @@ 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)
|
||||
|
@ -664,24 +660,15 @@ 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);
|
||||
}
|
||||
ExtruderOffsetsMap::iterator extr_it = m_extruder_offsets.find(extruder_id);
|
||||
if (extr_it != m_extruder_offsets.end())
|
||||
extruder_offset = Vec3d(extr_it->second(0), extr_it->second(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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue