FIX: invalid pop up when changing machine profile
1. Machine with multi extruder should set length of extruder offset to extruder num 2. Register retract_restart_extra jira:NONE Signed-off-by: xun.zhang <xun.zhang@bambulab.com> Change-Id: Ic3eb324cb91dc70b091c8922936d2709c361cc38
This commit is contained in:
parent
785b8c7b2f
commit
13df1ee7ba
|
@ -1456,8 +1456,9 @@ namespace DoExport {
|
|||
if (! skirt_points.empty()) {
|
||||
Polygon outer_skirt = Slic3r::Geometry::convex_hull(skirt_points);
|
||||
Polygons skirts;
|
||||
for (unsigned int extruder_id : print.extruders()) {
|
||||
const Vec2d &extruder_offset = print.config().extruder_offset.get_at(extruder_id);
|
||||
auto filament_extruder_map = print.config().filament_map.values; // 1 based idxs
|
||||
for (unsigned int filament_id : print.extruders()) {
|
||||
const Vec2d& extruder_offset = print.config().extruder_offset.get_at(filament_extruder_map[filament_id] - 1);
|
||||
Polygon s(outer_skirt);
|
||||
s.translate(Point::new_scale(-extruder_offset(0), -extruder_offset(1)));
|
||||
skirts.emplace_back(std::move(s));
|
||||
|
@ -5702,14 +5703,14 @@ std::string GCode::set_object_info(Print* print)
|
|||
// convert a model-space scaled point into G-code coordinates
|
||||
Vec2d GCode::point_to_gcode(const Point &point) const
|
||||
{
|
||||
Vec2d extruder_offset = FILAMENT_CONFIG(extruder_offset);
|
||||
Vec2d extruder_offset = EXTRUDER_CONFIG(extruder_offset);
|
||||
return unscale(point) + m_origin - extruder_offset;
|
||||
}
|
||||
|
||||
// convert a model-space scaled point into G-code coordinates
|
||||
Point GCode::gcode_to_point(const Vec2d &point) const
|
||||
{
|
||||
Vec2d extruder_offset = FILAMENT_CONFIG(extruder_offset);
|
||||
Vec2d extruder_offset = EXTRUDER_CONFIG(extruder_offset);
|
||||
return Point(
|
||||
scale_(point(0) - m_origin(0) + extruder_offset(0)),
|
||||
scale_(point(1) - m_origin(1) + extruder_offset(1)));
|
||||
|
|
|
@ -77,7 +77,6 @@ public:
|
|||
m_right(float(/*print_config.wipe_tower_x.value +*/ print_config.prime_tower_width.value)),
|
||||
m_wipe_tower_pos(float(print_config.wipe_tower_x.get_at(plate_idx)), float(print_config.wipe_tower_y.get_at(plate_idx))),
|
||||
m_wipe_tower_rotation(float(print_config.wipe_tower_rotation_angle)),
|
||||
m_extruder_offsets(print_config.extruder_offset.values),
|
||||
m_priming(priming),
|
||||
m_tool_changes(tool_changes),
|
||||
m_final_purge(final_purge),
|
||||
|
@ -88,7 +87,13 @@ public:
|
|||
m_enable_timelapse_print(print_config.timelapse_type.value == TimelapseType::tlSmooth),
|
||||
m_is_first_print(true),
|
||||
m_print_config(&print_config)
|
||||
{}
|
||||
{
|
||||
// initialize with the extruder offset of master extruder id
|
||||
m_extruder_offsets.resize(print_config.filament_map.size(), print_config.extruder_offset.get_at(print_config.master_extruder_id.value - 1));
|
||||
const auto& filament_map = print_config.filament_map.values; // 1 based idx
|
||||
for (size_t idx = 0; idx < filament_map.size(); ++idx)
|
||||
m_extruder_offsets[idx] = print_config.extruder_offset.get_at(filament_map[idx] - 1);
|
||||
}
|
||||
|
||||
std::string prime(GCode &gcodegen);
|
||||
void next_layer() { ++ m_layer_idx; m_tool_change_idx = 0; }
|
||||
|
@ -114,7 +119,7 @@ private:
|
|||
const float m_right;
|
||||
const Vec2f m_wipe_tower_pos;
|
||||
const float m_wipe_tower_rotation;
|
||||
const std::vector<Vec2d> m_extruder_offsets;
|
||||
std::vector<Vec2d> m_extruder_offsets;
|
||||
|
||||
// Reference to cached values at the Printer class.
|
||||
const std::vector<WipeTower::ToolChangeResult> &m_priming;
|
||||
|
|
|
@ -1164,8 +1164,13 @@ void GCodeProcessor::apply_config(const PrintConfig& config)
|
|||
for (size_t idx = 0; idx < m_result.nozzle_type.size(); ++idx) {
|
||||
m_result.nozzle_type[idx] = NozzleType(config.nozzle_type.values[idx]);
|
||||
}
|
||||
|
||||
std::vector<int> filament_map = config.filament_map.values; // 1 based idxs
|
||||
// if filament map has wrong length, set filament to master extruder_id
|
||||
filament_map.resize(filament_count, config.master_extruder_id.value);
|
||||
|
||||
for (size_t i = 0; i < filament_count; ++ i) {
|
||||
m_extruder_offsets[i] = to_3d(config.extruder_offset.get_at(i).cast<float>().eval(), 0.f);
|
||||
m_extruder_offsets[i] = to_3d(config.extruder_offset.get_at(filament_map[i] - 1).cast<float>().eval(), 0.f);
|
||||
m_extruder_colors[i] = static_cast<unsigned char>(i);
|
||||
m_result.filament_diameters[i] = static_cast<float>(config.filament_diameter.get_at(i));
|
||||
m_result.required_nozzle_HRC[i] = static_cast<int>(config.required_nozzle_HRC.get_at(i));
|
||||
|
|
|
@ -5227,6 +5227,7 @@ std::set<std::string> printer_options_with_variant_1 = {
|
|||
"wipe_distance",
|
||||
"retract_before_wipe",
|
||||
"retract_length_toolchange",
|
||||
"retract_restart_extra",
|
||||
"retract_restart_extra_toolchange",
|
||||
"long_retractions_when_cut",
|
||||
"retraction_distances_when_cut",
|
||||
|
|
Loading…
Reference in New Issue