{
    "version": 2,
    "name": "Anycubic i3 Mega S/Pro",
    "inherits": "fdmprinter",
    "metadata":
    {
        "visible": true,
        "author": "Nils Hendrik Rottgardt",
        "manufacturer": "Anycubic",
        "file_formats": "text/x-gcode",
        "platform": "anycubic_i3_mega_s_platform.3mf",
        "has_materials": true,
        "has_variants": false,
        "has_machine_quality": true,
        "preferred_quality_type": "normal",
        "machine_extruder_trains":
        {
            "0": "anycubic_i3_mega_s_extruder_0"
        }
    },

    "overrides":
    {
        "machine_name": { "default_value": "Anycubic i3 Mega S/Pro" },
        "machine_heated_bed": { "default_value": true },
        "machine_width": { "default_value": 210 },
        "machine_height": { "default_value": 205 },
        "machine_depth": { "default_value": 210 },
        "machine_center_is_zero": { "default_value": false },
        "gantry_height": { "value": "0" },
        "machine_gcode_flavor": { "default_value": "RepRap (Marlin/Sprinter)" },
        "machine_start_gcode": { "default_value": "G21                                        ; metric values \nG90                                        ; absolute positioning \nM82                                        ; set extruder to absolute mode \nM107                                       ; start with the fan off \nM140 S{material_bed_temperature_layer_0}           ; Start heating the bed \nG4 S60                                     ; wait 1 minute \nM104 S{material_initial_print_temperature}         ; start heating the hot end \nM190 S{material_bed_temperature_layer_0}           ; wait for bed \nM109 S{material_initial_print_temperature}         ; wait for hotend \nM300 S1000 P500                            ; BEEP heating done \nG28 X0 Y10 Z0                              ; move X/Y to min endstops \nM420 S1                                    ; Enable leveling \nM420 Z2.0                                  ; Set leveling fading height to 2 mm \nG0 Z0.15                                   ; lift nozzle a bit \nG92 E0                                     ; zero the extruded length \nG1 X50 E25 F500                            ; Extrude 25mm of filament in a 5cm line. \nG92 E0                                     ; zero the extruded length again \nG1 E-2 F500                                ; Retract a little \nG1 X120 F4000                              ; Quickly wipe away from the filament line`" },
        "machine_end_gcode": { "default_value": "M104 S0                                    ; Extruder off \nM140 S0                                    ; Heatbed off \nM107                                       ; Fan off \nG91                                        ; relative positioning \nG1 E-5 F300                                ; retract a little \nG1 Z+10 E-5 ; X-20 Y-20 F{travel_xy_speed} ; lift print head \nG28 X0 Y0                                  ; homing \nG1 Y180 F2000                              ; reset feedrate \nM84                                        ; disable stepper motors \nG90                                        ; absolute positioning \nM300 S440 P200                             ; Make Print Completed Tones \nM300 S660 P250                             ; beep \nM300 S880 P300                             ; beep" },

        "machine_max_acceleration_x": { "value": 3000 },
        "machine_max_acceleration_y": { "value": 3000 },
        "machine_max_acceleration_z": { "value": 3000 },
        "machine_max_acceleration_e": { "value": 3000 },
        "machine_acceleration": { "value": 3000 },

        "machine_max_jerk_xy": { "value": 10 },
        "machine_max_jerk_z": { "value": 0.4 },
        "machine_max_jerk_e": { "value": 5 },

        "material_diameter": { "default_value": 1.75 },

        "acceleration_print": { "value": 1500 },
        "acceleration_travel": { "value": 3000 },
        "acceleration_travel_layer_0": { "value": "acceleration_travel" },
        "acceleration_roofing": { "enabled": "acceleration_enabled and roofing_layer_count > 0 and top_layers > 0" },

        "jerk_print": { "value": 8 },
        "jerk_travel": { "value": 10 },
        "jerk_travel_layer_0": { "value": "jerk_travel" },

        "acceleration_enabled": { "value": false },
        "jerk_enabled": { "value": true },

        "speed_print": { "value": 50.0 } ,
        "speed_infill": { "value": "speed_print" },
        "speed_wall": { "value": "speed_print / 2" },
        "speed_wall_0": { "value": "speed_wall" },
        "speed_wall_x": { "value": "speed_wall" },
        "speed_topbottom": { "value": "speed_print / 2" },
        "speed_roofing": { "value": "speed_topbottom" },
        "speed_travel": { "value": 100.0,  "maximum_value_warning": 150.0 },
        "speed_layer_0": { "value": 20.0 },
        "speed_print_layer_0": { "value": "speed_layer_0" },
        "speed_travel_layer_0": { "value": 100.0 },
        "speed_prime_tower": { "value": "speed_topbottom" },
        "speed_support": { "value": "speed_wall_0" },
        "speed_support_interface": { "value": "speed_topbottom" },
        
        "skirt_brim_speed": { "value": "speed_layer_0" },

        "optimize_wall_printing_order": { "value": "True" },

        "material_initial_print_temperature": { "value": "material_print_temperature + 10" },
        "material_final_print_temperature": { "value": "material_print_temperature" },
        "material_flow": { "value": 100 },
        "travel_compensate_overlapping_walls_0_enabled": { "value": "False" },
        
        "infill_sparse_density": { "value": 25 },
        "infill_before_walls": { "value": false },
        "infill_overlap": { "value": 15.0 },
       
       
        "retraction_speed": { "value": 25, "maximum_value": 40 },
        "retraction_retract_speed": { "maximum_value": 40 },
        "retraction_prime_speed": { "maximum_value": 40 },
        
        "retraction_hop_enabled": { "value": true },
        "retraction_hop": { "value": 0.075 },
		"retraction_hop_only_when_collides": { "value": true },

        "retraction_combing": { "value": "'off'" },
        "retraction_combing_max_distance": { "value": 30 },
        "travel_avoid_other_parts": { "value": true },
        "travel_avoid_supports": { "value": true },
        "travel_retract_before_outer_wall": { "value": true },
        
		"retraction_amount": { "value": 6 },
        "retraction_enable": { "value": true },
        "retraction_min_travel": { "value": 1.5 },

        "cool_fan_full_at_height": { "value": "layer_height_0 + 2 * layer_height" },
		"cool_fan_speed": { "value": 70 },
		"cool_fan_speed_0": { "value": 30 },

        "cool_fan_enabled": { "value": true },
        "cool_min_layer_time": { "value": 10 },

        "adhesion_type": { "value": "'none' if support_enable else 'skirt'" },
        "brim_replaces_support": { "value": false },
        "skirt_gap": { "value": 5.0 },
        "skirt_line_count": { "value": 4 },

        "meshfix_maximum_deviation": { "value": 0.05 },
       
        "support_angle": { "value": "math.floor(math.degrees(math.atan(line_width / 2.0 / layer_height)))" },
        "support_pattern": { "value": "'zigzag'" },
        "support_infill_rate": { "value": "0 if support_enable and support_structure == 'tree' else 20" },
        "support_use_towers": { "value": false },
        "support_xy_distance": { "value": "wall_line_width_0 * 2" },
        "support_xy_distance_overhang": { "value": "wall_line_width_0" },
        "support_z_distance": { "value": "layer_height if layer_height >= 0.16 else layer_height * 2" },
        "support_top_distance": { "value":  "extruderValue(support_roof_extruder_nr if support_roof_enable else support_infill_extruder_nr, 'support_z_distance') + (layer_height if support_structure == 'tree' else 0)"},
        "support_xy_overrides_z": { "value": "'xy_overrides_z'" },
        "support_wall_count": { "value": 1 },
        "support_brim_enable": { "value": true },
        "support_brim_width": { "value": 4 },

        "support_interface_enable": { "value": true },
        "support_structure": { "value": "'tree'" },
        "support_type": { "value": "'buildplate' if support_structure == 'tree' else 'everywhere'" },
        "support_interface_height": { "value": "layer_height * 4" },
        "support_interface_density": { "value": 33.333 },
        "support_interface_pattern": { "value": "'grid'" },
        "support_interface_skip_height": { "value": 0.2 },
        "minimum_support_area": { "value": 2 },
        "minimum_interface_area": { "value": 10 },
        "top_bottom_thickness": { "value":  "layer_height_0 + layer_height * math.floor(1.2 / layer_height)" },
        "wall_thickness": { "value": "line_width * 3" }
    }
}
