mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-07 15:07:31 -06:00
ENH: fix wrong extruder offset when loading from gcode
All extruder offset should be extruder_offset[0] when it is single extruder multi material. Add handling when load config from gcode. This is fix for github issue #213 Signed-off-by: salt.wei <salt.wei@bambulab.com> Change-Id: Ia881b2bfbbdffa98e3c3db7b35201dc86b520b29
This commit is contained in:
parent
e7c977f86b
commit
9e2f227aef
1 changed files with 15 additions and 4 deletions
|
@ -990,11 +990,22 @@ void GCodeProcessor::apply_config(const DynamicPrintConfig& config)
|
|||
}
|
||||
|
||||
const ConfigOptionPoints* extruder_offset = config.option<ConfigOptionPoints>("extruder_offset");
|
||||
const ConfigOptionBool* single_extruder_multi_material = config.option<ConfigOptionBool>("single_extruder_multi_material");
|
||||
if (extruder_offset != nullptr) {
|
||||
m_extruder_offsets.resize(extruder_offset->values.size());
|
||||
for (size_t i = 0; i < extruder_offset->values.size(); ++i) {
|
||||
Vec2f offset = extruder_offset->values[i].cast<float>();
|
||||
m_extruder_offsets[i] = { offset(0), offset(1), 0.0f };
|
||||
//BBS: for single extruder multi material, only use the offset of first extruder
|
||||
if (single_extruder_multi_material != nullptr && single_extruder_multi_material->getBool()) {
|
||||
Vec2f offset = extruder_offset->values[0].cast<float>();
|
||||
m_extruder_offsets.resize(m_result.extruders_count);
|
||||
for (size_t i = 0; i < m_result.extruders_count; ++i) {
|
||||
m_extruder_offsets[i] = { offset(0), offset(1), 0.0f };
|
||||
}
|
||||
}
|
||||
else {
|
||||
m_extruder_offsets.resize(extruder_offset->values.size());
|
||||
for (size_t i = 0; i < extruder_offset->values.size(); ++i) {
|
||||
Vec2f offset = extruder_offset->values[i].cast<float>();
|
||||
m_extruder_offsets[i] = { offset(0), offset(1), 0.0f };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue