Skip to main content
Version: 2.1.x

Configuring RatOS Macros

RatOS comes with a bunch of flexible predefined macro's that can be customized via variables and macro hooks.

Variables

In your printer.cfg at the top, you'll notice this:

printer.cfg
##########################################
### MACRO CONFIGURATION
### Configure the behavior...
##########################################
[gcode_macro RatOS]
....

This is a macro that serves as a place to store variables that all the RatOS macro's refer to when they're executed. Since they're gcode variables you can change them on the fly, for example from your slicer's custom gcode sections:

SET_GCODE_VARIABLE MACRO=RatOS VARIABLE=relative_extrusion VALUE=True
SET_GCODE_VARIABLE MACRO=RatOS VARIABLE=preheat_extruder_temp VALUE=200

Not all of the available variables are listed in printer.cfg by default. If you want to change a variable that isn't in printer.cfg simply just add it under the [gcode_macro RatOS] section.

Below you'll find a list of the available variables and what they do.

Printing

[gcode_macro RatOS]

NamePossible ValuesDefaultDescription
variable_relative_extrusionTrue / FalseFalseControls which extrusion mode START_PRINT ends in. Which value you use here depends on your slicer configuration, in other words this variable should always correspond to the extrusion mode setting in your slicer. It is recommended to configure your slicer for relative extrusion and set this variable to True.
variable_force_absolute_positionTrue / FalseFalseForces absolute positioning before the print starts.

Speed

[gcode_macro RatOS]

NamePossible ValuesDefaultDescription
variable_macro_travel_speednumber300XY Travel speed to use for gcode moves in RatOS Macro's in mm/s.
variable_macro_travel_accelnumber2000XY Travel acceleration to use for gcode moves in RatOS Macro's in mm/s².
variable_macro_z_speednumber15Z Travel speed to use for gcode moves in RatOS Macro's in mm/s.

Homing

[gcode_macro RatOS]

NamePossible ValuesDefaultDescription
variable_z_probe"static" / "stowable""static"z-probe type
variable_homing"endstops" / "sensorless""endstops"axis homing method
variable_safe_home_x"middle" / number"middle"The x coordinate for where to return the toolhead to when homing Z
variable_safe_home_y"middle" / number"middleThe y coordinate for where to return the toolhead to when homing Z
variable_homing_z_hopnumber15How much to raise the toolhead after homing Z. Probe configs may change this value.
variable_driver_type_xstring"tmc2209"The driver type used on X. Used to restore current after sensorless homing
variable_driver_type_ystring"tmc2209"The driver type used on X. Used to restore current after sensorless homing
variable_sensorless_x_currentnumber0.4stepper driver run current for sensorless x-homing
variable_sensorless_y_currentnumber0.4stepper driver run current for sensorless y-homing

Heating

[gcode_macro RatOS]

NamePossible ValuesDefaultDescription
variable_preheat_extruderTrue / FalseTrueEnables or disables preheating of the nozzle to 150 degrees during the START_PRINT macro. There are several benefits to preheating the nozzle. 1) Gives the bed additional time to diffuse the heat. 2) Softens plastic that may be stuck in the nozzle so it doesn't block your probe from triggering. 3) If using a non thermally compensated inductive probe, it makes the temperature and thus the offset of the probe more predictable and consistent.
variable_preheat_extruder_tempNumber150The temperature to preheat the extruder to, to soften the material at the nozzle tip

Bed Mesh Calibration

[gcode_macro RatOS]

NamePossible ValuesDefault
variable_calibrate_bed_meshTrue / FalseTrue
variable_adaptive_meshTrue / FalseTrue

Whether or not to calibrate a bed mesh before each print. If you prefer calibrating your bed mesh manually instead of on each print, you can disable it by setting this to False. Disabling variable_calibrate_bed_mesh will stop RatOS from loading a bed mesh entirely. If you want it to load a mesh, you can set variable_bed_mesh_profile to the name of the profile you want it to load.

NamePossible ValuesDefault
variable_bed_mesh_profileundefined / stringundefined

Use this variable to set name for the bed_mesh profile that RatOS calibrate and loads. If variable_calibrate_bed_mesh is False you must set this variable to the profile name you wish to load, or no bed mesh will be loaded. If variable_calibrate_bed_mesh is True and this variable isn't set, RatOS will use ratos as the profile name.

Nozzle Priming

[gcode_macro RatOS]

NamePossible ValuesDefaultDescription
variable_nozzle_priming"primeblob" / False"primeblob"Whether or not to prime the nozzle during the START_PRINT macro. "primeblob" will put a small blob at the edge of the bed that is intended to wrap around the nozzle, then lifts the toolhead out of it while extruding a small line, effective for cleaning the nozzle and it's easy to clean up.
variable_nozzle_prime_start_x"min" / "max" / number"max"Where to place the primeline or blob in X. "min" starts the blob or line at x=0 + some safety margin. "max" starts the blob or line at x=max - some safety margin. If set to a number, that number will be used as the starting x coordinate of the line or blob.
variable_nozzle_prime_start_y"min" / "max" / number"min"Where to place the primeline or blob in Y. "min" starts the blob or line at y=0 + some safety margin. "max" starts the blob or line at y=max - some safety margin. If set to a number, that number will be used as the starting y coordinate of the line or blob.
variable_nozzle_prime_direction"auto" / "forwards" / "backwards"auto"The direction to draw the line or blob in, if "backwards" the toolhead will move toward the front of the printer, if "forwards" it will move towards the back. When set to "auto" it will move towards the middle regardless of variable_nozzle_prime_start_y.
variable_nozzle_prime_bridge_fannumber102priming fan speed 0-255

Filament loading/unloading

[gcode_macro RatOS]

NamePossible ValuesDefaultDescription
variable_filament_unload_lengthnumber130How much to retract in mm when unloading filament after the tip has been formed
variable_filament_unload_speednumber5How fast to retract the filament_unload_length filament in mm/s
variable_filament_load_lengthnumber100How much to extrude in mm when loading filament to get the filament to the nozzle
variable_filament_load_speednumber10How fast to extrude the filament_load_length in mm/s

Parking

[gcode_macro RatOS]

NamePossible ValuesDefaultDescription
variable_start_print_park_in"back" / "center" / "front""back"Where to park the toolhead during final nozzle heating.
variable_start_print_park_xnumber / undefinedundefinedCustom X coordinate to park the toolhead during final nozzle heating.
variable_start_print_park_z_heightnumber50The z height at which to park the toolhead during final nozzle heating.
variable_end_print_park_in"back" / "center" / "front""back"Where to park the toolhead after ending or canceling a print.
variable_end_print_park_xnumber / undefinedundefinedCustom X coordinate to park the toolhead after ending or canceling a print.
variable_end_print_park_z_hopnumbernumberHow many mm to lift the nozzle when after ending or cancelling a print.
variable_pause_print_park_in"back" / "center" / "front""back"Where to park the toolhead when pausing a print.

END_PRINT behavior

[gcode_macro RatOS]

NamePossible ValuesDefaultDescription
variable_end_print_motors_offTrue / FalseTrueIf True the steppers will be disabled when the print ends.

Toolhead configuration

[gcode_macro T0]

NamePossible ValuesDefaultDescription
variable_hotend_type"SF", "HF", "UHF"Nozzle type. used for loading/unloading macros.
variable_has_cht_nozzlenumberNozzle type. used for loading/unloading macros.
variable_cooling_position_to_nozzle_distancenumber40MM from the cooling position to the nozzles melting zone.
variable_tooolhead_sensor_to_extruder_gear_distancenumber15MM from the toolhead filament sensor trigger point to the extruder gears.
variable_extruder_gear_to_cooling_position_distancenumber30MM from the extruder gears to the cooling zone.
variable_filament_loading_nozzle_offsetnumber-5MM loading offset for fine tuning.
variable_filament_grabbing_lengthnumber5MM filament grabbing length when inserting filament into the extruder.
variable_filament_grabbing_speednumber1Filament grabbing speed.
variable_enable_insert_detectionTrue / FalseTrueEnable the filament sensor insert detection.
variable_enable_runout_detectionTrue / FalseTrueEnable the filament sensor runout detection.
variable_enable_clog_detectionTrue / FalseTrueEnable the filament sensor clog detection.
variable_toolhead_sensor_button_only_when_sensor_enabledTrue / FalseFalseOnly trigger filament sensor button when the sensor is enabled.
variable_toolhead_detect_clog_only_when_sensor_enabledTrue / FalseTrueOnly detect clogs when the filament sensor is enabled.
variable_unload_after_runoutTrue / FalseTrueUnload filament from toolhead after if runout has been detected.
variable_resume_after_insertTrue / FalseTrueAuto resume a paused print after runout and insert.
variable_purge_after_loadnumber0Purge x mm after the filament has been loaded to the nozzle tip.
variable_purge_before_unloadnumber0Purge x mm before the filament unloads.
variable_extruder_load_speednumber60Extruder/cooling zone loading speed.
variable_filament_load_speednumber10Filament nozzle loading speed.
variable_temperature_offsetnumber0Adds a positive or negative offset to the nozzle temperature.
variable_has_oozeguardTrue / FalseFalseToolhead has a oozeguard.
variable_has_front_arm_nozzle_wiperTrue / FalseFalseToolhead has a front arm nozzle wiper.
variable_loading_positionnumber0X-position for filament loading/unloading actions.
variable_parking_positionnumber0Toolhead parking x-position.

VAOC

[gcode_macro _VAOC]

NamePossible ValuesDefaultDescription
variable_is_fixedTrue / FalseFalseVAOC is installed on a fix position.
variable_safe_znumber60Safe z-height for xy travel moves.
variable_auto_z_offset_calibrationTrue / FalseTruePerforms a auto z-offset calibration before the print starts if needed.
variable_enable_camera_coolingTrue / FalseTrueEnables the part cooling fan of the currently loaded toolhead.
variable_camera_cooling_fan_speednumber0.3Part cooling fan speed of the currently loaded toolhead.
variable_camera_cooling_temperaturenumber50Enables the integrated VAOC fan at the configured bed temperature.
variable_toolchange_travel_speednumber300XY travel move speeds.
variable_toolchange_travel_accelnumber5000XY travel move sccelerations.

IDEX

[gcode_macro RatOS]

NamePossible ValuesDefaultDescription
variable_auto_center_subjectTrue / FalseFalseExperimental auto centering subject on build plate for copy and mirror mode.
variable_toolchange_zhopnumber2.0Toolshift z-hop.
variable_toolchange_zspeednumber25Toolshift z-hop speed.
variable_toolchange_sync_fansTrue / FalseFalseSynchronizes fan speeds while printing.
variable_toolchange_combined_zhopTrue / FalseFalseCombines z-hop and retract/deretract moves for toolshifts.
variable_toolchange_travel_speednumber300Toolshift travel speed.
variable_toolchange_travel_accelnumber5000Toolshift travel acceleration.
variable_toolchange_extrusionnumber2.0Toolshift deretraction.
variable_toolchange_retractionnumber2.0Toolshift retraction.
variable_toolchange_feedratenumber7200Extruder feedrate for retract/deretract moves for toolshifts.
variable_toolchange_prepurging_timernumber0Prepurge some filament before going back to the buildplate after X seconds of inactivity.
variable_toolchange_purgenumber25MM of filament that gets prepruged in case the timer has been configured,
variable_toolchange_standby_tempnumber-1If configured the toolheads are going into standby mode when parked.
variable_toolchange_first_purgenumber50MM of filament that gets purged before a toolheads first use.

Beacon probe

[gcode_macro RatOS]

Basic Beacon Settings

NamePossible ValuesDefaultDescription
variable_beacon_bed_mesh_scvnumber25Square corner velocity for beacon proximity bed meshing.
variable_beacon_contact_prime_probingTrue / FalseTrueUse beacon contact to probe for prime blobs.
variable_beacon_contact_expansion_compensationTrue / FalseTrueEnable hotend thermal expansion compensation.

Beacon Contact Mode Settings

warning

Using contact mode for homing, bed mesh, or z-tilt is not recommended on textured surfaces due to potential significant variation in contact measurements.

NamePossible ValuesDefaultDescription
variable_beacon_contact_z_homingTrue / FalseFalseMake all G28 calls use contact instead of proximity scan. Not recommended on textured surfaces.
variable_beacon_contact_bed_meshTrue / FalseFalseBed mesh with contact method. Not recommended on textured surfaces.
variable_beacon_contact_bed_mesh_samplesnumber2Beacon contact bed mesh probe samples.
variable_beacon_contact_z_tilt_adjustTrue / FalseFalseZ-tilt adjust with contact method. Not recommended on textured surfaces.
variable_beacon_contact_z_tilt_adjust_samplesnumber2Beacon contact z-tilt probe samples.

Beacon True Zero Settings

NamePossible ValuesDefaultDescription
variable_beacon_contact_start_print_true_zeroTrue / FalseTrueUse contact to determine true Z=0 for the last homing move during START_PRINT.
variable_beacon_contact_start_print_true_zero_fuzzy_positionTrue / FalseTrueUse a randomized position for the true zero contact measurement to avoid creating a wear mark on the bed surface.
variable_beacon_contact_calibrate_model_on_true_zeroTrue / FalseTrueCalibrate a new beacon model every print. Recommended especially if you often swap build plates with different surface types. This effectively disables z_offset on the beacon model since a new one will be calibrated every print, but True Zero replaces the model offset anyway.
variable_beacon_contact_wipe_before_true_zeroTrue / FalseTrueEnable nozzle wipe at Y10 before true zeroing.
variable_beacon_contact_true_zero_tempnumber150Nozzle temperature for true zeroing. WARNING: if using a smooth PEI sheet, be careful with the temperature.

Beacon Scan Compensation

NamePossible ValuesDefaultDescription
variable_beacon_scan_compensation_enableTrue / FalseTrueEnable beacon scan compensation to correct proximity measurements based on a compensation mesh.
variable_beacon_scan_compensation_profilestring"auto"The bed mesh profile name identifying the scan compensation mesh to use, or "auto" to automatically select the most appropriate profile based on bed temperature.
variable_beacon_scan_compensation_desired_spacingnumber10The desired spacing between probe points in mm for compensation mesh creation. Strongly recommended to leave at default. The actual spacing depends on probe-able region and beacon offset.
variable_beacon_scan_compensation_bed_temp_mismatch_is_errorTrue / FalseFalseIf True, attempting to use a compensation mesh calibrated for a significantly different bed temperature will raise an error. Otherwise, a warning is reported.
variable_beacon_scan_method_automaticTrue / FalseFalseEnable the METHOD=automatic scan option. Generally not recommended, and specifically not recommended when beacon_scan_compensation_enable is enabled.

Beacon Adaptive Heat Soak

Adaptive heat soak monitors thermal stability of the printer using Beacon proximity measurements. It waits for the printer to reach thermal stability before starting the print, reducing the amount of thermal Z deflection that occurs during the first layer.

NamePossible ValuesDefaultDescription
variable_beacon_adaptive_heat_soakTrue / FalseFalseEnable adaptive heat soaking based on beacon proximity measurements. Enabled by default for V-Core 4 variants. Other printers can opt-in, but proceed with caution as aspects of the algorithm are currently tuned for the V-Core 4 design.
variable_beacon_adaptive_heat_soak_max_waitnumber5400The maximum time in seconds to wait for adaptive heat soaking to complete. This is a sanity limit to prevent waiting indefinitely.
variable_beacon_adaptive_heat_soak_extra_wait_after_completionnumber0Extra time in seconds to wait after adaptive heat soaking is considered complete. Typically not needed, but can be useful for printers with very stable gantry designs (such as steel rail on steel tube) where the adaptive heat soak completes before the bed edges stabilize.
variable_beacon_adaptive_heat_soak_layer_qualitynumber (1-5)3Controls the tradeoff between soak time and first layer quality. 1 = rough (fastest soak), 2 = draft, 3 = normal, 4 = high, 5 = maximum (slowest soak, best quality). Longer soak times leave less thermal deflection during the print.
variable_beacon_adaptive_heat_soak_maximum_first_layer_durationnumber1800Maximum first layer print time in seconds for your gcode files. Must be set correctly. If you print a significantly longer first layer than this value, excessive thermal deflection may occur. Value must be between 60 and 7200 seconds.

Stowable probes

[gcode_macro RatOS]

These variables are only relevant when using a stowable probe such as Euclid or Klicky. Use these to customize and finetune the deployment and stowing procedures.

NamePossible ValuesDefaultDescription
variable_stowable_probe_position_preflightTupleundefinedThe coordinates to move the toolhead to before the probe deployment routine. Example: [30, 60]
variable_stowable_probe_position_sideTupleundefinedThe coordinates to move the toolhead to before entering the dock during deployment, or exiting the dock while stowing. Example: [30, 0]
variable_stowable_probe_position_dockTupleundefinedThe coordinates of the toolhead when it's positioned perfectly inside the dock for pickup. Example: [0, 0]
variable_stowable_probe_position_exitTupleundefinedThe coordinates to move the toolhead to when exiting the dock while deploying or entering the dock while stowing. Example: [0, 60]

Skew profile

NamePossible ValuesDefaultDescription
variable_skew_profilestring or undefinedundefinedUse this if you have calibrated and saved a skew profile that you want to load in the START_PRINT macro. To activate it, set the variable to the name of your saved skew profile.

User macro hooks

These hooks do nothing by default, that means you can safely implement them in your USER OVERRIDES section without copy pasting anything from the RatOS config files, like so:

[gcode_macro _USER_START_PRINT_BED_MESH]
gcode:
SETUP_KAMP_MESHING

_USER_START_PRINT_BEFORE_HOMING

Runs before the printer homes at the start of START_PRINT.

_USER_START_PRINT_HEAT_CHAMBER

Runs right after the chamber has started heating, if CHAMBER_TEMP is supplied to START_PRINT.

_USER_START_PRINT_AFTER_HEATING_BED

Runs right after the bed has reached temp, before the internal _START_PRINT_AFTER_HEATING_BED

_USER_START_PRINT_BED_MESH

Runs before _START_PRINT_BED_MESH

_USER_START_PRINT_PARK

Runs before _START_PRINT_PARK

_USER_START_PRINT_AFTER_HEATING_EXTRUDER

Runs just before _START_PRINT_AFTER_HEATING_EXTRUDER

_USER_END_PRINT_BEFORE_HEATERS_OFF

Runs before the heaters are turned off in END_PRINT

_USER_END_PRINT_AFTER_HEATERS_OFF

Runs after the heaters are turned off in END_PRINT

_USER_END_PRINT_PARK

Runs before the toolhead is parked in END_PRINT

_USER_START_PRINT

Runs before the START_PRINT macro

_USER_END_START_PRINT

Runs after the START_PRINT macro

_USER_START_FEATURE

Runs at the start of a new print feature. This is useful for running custom G-Code based on the feature that is being printed. See the PrusaSlicer Configuration documentation for more information.

_USER_END_FEATURE

Runs at the end of a print feature. This is useful for running custom G-Code based on the feature that is being printed. See the PrusaSlicer Configuration documentation for more information.

_USER_BEFORE_IDLE_TIMEOUT

Runs before the printer enters idle timeout mode.

_USER_AFTER_IDLE_TIMEOUT

Runs after the printer enters idle timeout mode.

Internal macro hooks

These hooks are used internally, so if you override these be sure to copy paste the original implementation and modify that or you may break some functionality. Remember to check if there's an override in the printer's macro.cfg file, in which case that's the one you would copy.

_START_PRINT_HEAT_CHAMBER

Heats the chamber, if CHAMBER_TEMP is supplied to START_PRINT.

_START_PRINT_AFTER_HEATING_BED

Runs right after the bed has reached temp, after _USER_START_PRINT_AFTER_HEATING_BED. It is usually used for additional bed calibration, such as Z_TILT_ADJUST or QUAD_GANTRY_LEVELING depending on the printer.

_START_PRINT_BED_MESH

Handles bed meshing logic.

_START_PRINT_PARK

Parks the extruder while heating the nozzle to print temperature.

_START_PRINT_AFTER_HEATING_EXTRUDER

Primes the nozzle and loads the skew profile if any is defined in the RatOS variables.

_END_PRINT_AFTER_HEATERS_OFF

Runs right after the heaters have been turned off in the END_PRINT macro.