zooc.zooc_core

The core functionality of the ZOOC module.

exception zooc.zooc_core.ZoocError

Bases: Exception

Custom exception for ZOOC errors.

add_note(note, /)

Add a note to the exception

with_traceback(tb, /)

Set self.__traceback__ to tb and return self.

class zooc.zooc_core.ZoocCore(temps_ref, allowed_offset_range, fixed_offsets, calibration_data)

Bases: object

Utilities to calculate Z-offsets for the given temperature and handle fixed offsets.

Parameters:
filter_fixed_offsets(profiles)

Select the profiles with the given names.

Parameters:

profiles (list[str]) – Names of the profile.

Returns:

Fixed offsets.

Return type:

dict[str, float]

get_aggregated_temps(temps_pri, temps_sec)

Get an aggregated set of bed and extruder temperatures.

Use the target temperatures when given temperature is not set.

Parameters:
  • temps_pri (Temps) – Primary temperatures to use if those are set.

  • temps_sec (Temps) – Secondary temperatures to use when primary is not set.

Returns:

Aggregated temperatures, where both bed and extruder are set.

Raises:

ZoocError – When temperatures are inconsistent.

Return type:

Temps

get_fixed_offsets(fixed_offsets, allow_missing=True)

Get fixed offsets from the comma separated string.

Raise ZoocError if not all fixed offsets are found and missing profiles are not allowed.

Parameters:
  • fixed_offsets (str) – Comma separated string of fixed offsets.

  • allow_missing (bool) – Allow missing fixed offsets.

Returns:

Dictionary of fixed offsets.

Raises:

ZoocError – If not all fixed profiles were found and allow_missing is False.

Return type:

dict[str, float]

get_temp_z_offset(temps)

Calculate Z-offset for given temperatures.

Parameters:

temps (Temps) – Temperatures to calculate Z-offset for

Returns:

Z-offset at temps

Raises:

ZoocError – If the Z-offset is outside the allowed range

Return type:

float

set_calibration_data(calibration_data)

Set new ZOOC calibration data.

Parameters:

calibration_data (CalibrationData) – New ZOOC calibration data.

Return type:

None