예제 #1
0
TEST_F(GCodeExportTest, insertWipeScriptOptionalDelay)
{
    gcode.currentPosition = Point3(1000, 1000, 1000);
    gcode.current_layer_z = 1000;
    gcode.use_extruder_offset_to_offset_coords = false;
    Application::getInstance().current_slice->scene.current_mesh_group->settings.add("layer_height", "0.2");

    WipeScriptConfig config;
    config.retraction_enable = false;
    config.hop_enable = false;
    config.brush_pos_x = 2000;
    config.repeat_count = 1;
    config.move_distance = 500;
    config.move_speed = 10;
    config.pause = 1.5; // 1.5 sec = 1500 ms.

    EXPECT_CALL(*mock_communication, sendLineTo(testing::_, testing::_, testing::_, testing::_, testing::_)).Times(3);
    gcode.insertWipeScript(config);

    std::string token;
    std::getline(output, token, '\n');
    EXPECT_EQ(std::string(";WIPE_SCRIPT_BEGIN"), token) << "Wipe script should always start with tag.";
    std::getline(output, token, '\n'); // go to wipe position
    std::getline(output, token, '\n'); // make wipe move
    std::getline(output, token, '\n'); // return back
    std::getline(output, token, '\n');
    EXPECT_EQ(std::string("G4 P1500"), token) << "Wipe script should make a delay.";
    std::getline(output, token, '\n');
    EXPECT_EQ(std::string(";WIPE_SCRIPT_END"), token) << "Wipe script should always end with tag.";
}
예제 #2
0
TEST_F(GCodeExportTest, insertWipeScriptSingleMove)
{
    gcode.currentPosition = Point3(1000, 1000, 1000);
    gcode.current_layer_z = 1000;
    gcode.use_extruder_offset_to_offset_coords = false;
    Application::getInstance().current_slice->scene.current_mesh_group->settings.add("layer_height", "0.2");

    WipeScriptConfig config;
    config.retraction_enable = false;
    config.hop_enable = false;
    config.brush_pos_x = 2000;
    config.repeat_count = 1;
    config.move_distance = 500;
    config.move_speed = 10;
    config.pause = 0;

    EXPECT_CALL(*mock_communication, sendLineTo(testing::_, testing::_, testing::_, testing::_, testing::_)).Times(3);
    gcode.insertWipeScript(config);

    std::string token;
    std::getline(output, token, '\n');
    EXPECT_EQ(std::string(";WIPE_SCRIPT_BEGIN"), token) << "Wipe script should always start with tag.";
    std::getline(output, token, '\n');
    EXPECT_EQ(std::string("G0 F600 X2 Y1"), token) << "Wipe script should go to its position.";
    std::getline(output, token, '\n');
    EXPECT_EQ(std::string("G0 X2.5 Y1"), token) << "There should be one wipe move.";
    std::getline(output, token, '\n');
    EXPECT_EQ(std::string("G0 X1 Y1"), token) << "Wipe script should return back to position before wipe.";
    std::getline(output, token, '\n');
    EXPECT_EQ(std::string(";WIPE_SCRIPT_END"), token) << "Wipe script should always end with tag.";
}
예제 #3
0
void MergeInfillLines::writeCompensatedMove(Point& to, double speed, GCodePath& last_path, int64_t new_line_width)
{
    double old_line_width = INT2MM(last_path.config->getLineWidth());
    double new_line_width_mm = INT2MM(new_line_width);
    double extrusion_mod = new_line_width_mm / old_line_width;
    double new_speed = speed;
    if (speed_equalize_flow_enabled)
    {
        double speed_mod = old_line_width / new_line_width_mm;
        new_speed = std::min(speed * speed_mod, speed_equalize_flow_max);
    }
    sendLineTo(last_path.config->type, to, last_path.getLineWidthForLayerView(), last_path.config->getLayerThickness(), new_speed);
    gcode.writeExtrusion(to, new_speed, last_path.getExtrusionMM3perMM() * extrusion_mod, last_path.config->type);
}
예제 #4
0
TEST_F(GCodeExportTest, insertWipeScriptRetractionEnable)
{
    gcode.currentPosition = Point3(1000, 1000, 1000);
    gcode.current_layer_z = 1000;
    gcode.current_e_value = 100;
    gcode.use_extruder_offset_to_offset_coords = false;
    gcode.is_volumetric = false;
    gcode.current_extruder = 0;
    gcode.extruder_attr[0].filament_area = 10.0;
    gcode.relative_extrusion = false;
    gcode.currentSpeed = 1;
    Application::getInstance().current_slice->scene.current_mesh_group->settings.add("layer_height", "0.2");
    Application::getInstance().current_slice->scene.extruders.emplace_back(0, &Application::getInstance().current_slice->scene.current_mesh_group->settings);
    Application::getInstance().current_slice->scene.extruders.back().settings.add("machine_firmware_retract", "false");

    WipeScriptConfig config;
    config.retraction_enable = true;
    config.retraction_config.distance = 1;
    config.retraction_config.speed = 2; // 120 mm/min.
    config.retraction_config.primeSpeed = 3; // 180 mm/min.
    config.retraction_config.prime_volume = gcode.extruder_attr[0].filament_area * 4; // 4mm in linear dimensions
    config.hop_enable = false;
    config.brush_pos_x = 2000;
    config.repeat_count = 1;
    config.move_distance = 500;
    config.move_speed = 10;
    config.pause = 0;

    EXPECT_CALL(*mock_communication, sendLineTo(testing::_, testing::_, testing::_, testing::_, testing::_)).Times(3);
    gcode.insertWipeScript(config);

    std::string token;
    std::getline(output, token, '\n');
    EXPECT_EQ(std::string(";WIPE_SCRIPT_BEGIN"), token) << "Wipe script should always start with tag.";
    std::getline(output, token, '\n');
    EXPECT_EQ(std::string("G1 F120 E99"), token) << "Wipe script should perform retraction with provided speed and retraction distance.";
    std::getline(output, token, '\n'); // go to wipe position
    std::getline(output, token, '\n'); // make wipe move
    std::getline(output, token, '\n'); // return back
    std::getline(output, token, '\n');
    EXPECT_EQ(std::string("G1 F180 E104"), token) << "Wipe script should make unretraction with provided speed and extra prime volume.";
    std::getline(output, token, '\n');
    EXPECT_EQ(std::string(";WIPE_SCRIPT_END"), token) << "Wipe script should always end with tag.";
}
예제 #5
0
TEST_F(GCodeExportTest, insertWipeScriptHopEnable)
{
    gcode.currentPosition = Point3(1000, 1000, 1000);
    gcode.current_layer_z = 1000;
    gcode.use_extruder_offset_to_offset_coords = false;
    gcode.currentSpeed = 1;
    gcode.current_max_z_feedrate = 1;
    Application::getInstance().current_slice->scene.current_mesh_group->settings.add("layer_height", "0.2");

    WipeScriptConfig config;
    config.retraction_enable = false;
    config.hop_enable = true;
    config.hop_speed = 2; // 120 mm/min.
    config.hop_amount = 300;
    config.brush_pos_x = 2000;
    config.repeat_count = 1;
    config.move_distance = 500;
    config.move_speed = 10;
    config.pause = 0;

    EXPECT_CALL(*mock_communication, sendLineTo(testing::_, testing::_, testing::_, testing::_, testing::_)).Times(3);
    gcode.insertWipeScript(config);

    std::string token;
    std::getline(output, token, '\n');
    EXPECT_EQ(std::string(";WIPE_SCRIPT_BEGIN"), token) << "Wipe script should always start with tag.";
    std::getline(output, token, '\n');
    EXPECT_EQ(std::string("G1 F120 Z1.3"), token) << "Wipe script should perform z-hop.";
    std::getline(output, token, '\n'); // go to wipe position
    std::getline(output, token, '\n'); // make wipe move
    std::getline(output, token, '\n'); // return back
    std::getline(output, token, '\n');
    EXPECT_EQ(std::string("G1 F120 Z1"), token) << "Wipe script should return z position.";
    std::getline(output, token, '\n');
    EXPECT_EQ(std::string(";WIPE_SCRIPT_END"), token) << "Wipe script should always end with tag.";
}