mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-08 15:37:30 -06:00
Fixed crash if toolchange G-code modifies final position,
because the extruder was not set yet.
This commit is contained in:
parent
93d025bfd4
commit
71be87ecef
1 changed files with 6 additions and 4 deletions
|
@ -6302,10 +6302,12 @@ Vec2d GCode::point_to_gcode(const Point &point) const
|
||||||
// convert a model-space scaled point into G-code coordinates
|
// convert a model-space scaled point into G-code coordinates
|
||||||
Point GCode::gcode_to_point(const Vec2d &point) const
|
Point GCode::gcode_to_point(const Vec2d &point) const
|
||||||
{
|
{
|
||||||
Vec2d extruder_offset = EXTRUDER_CONFIG(extruder_offset);
|
Vec2d pt = point - m_origin;
|
||||||
return Point(
|
if (const Extruder *extruder = m_writer.extruder(); extruder)
|
||||||
scale_(point(0) - m_origin(0) + extruder_offset(0)),
|
// This function may be called at the very start from toolchange G-code when the extruder is not assigned yet.
|
||||||
scale_(point(1) - m_origin(1) + extruder_offset(1)));
|
pt += m_config.extruder_offset.get_at(extruder->id());
|
||||||
|
return scaled<coord_t>(pt);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Vec2d GCode::point_to_gcode_quantized(const Point& point) const
|
Vec2d GCode::point_to_gcode_quantized(const Point& point) const
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue