Zaber Launcher Tutorials
Zaber Motion Library
Sample Projects
Virtual DeviceDropdown icon
About3D Viewer
AccountDropdown icon
Sign InSign Up
Zaber Motion LibraryGetting StartedHow-to Guides
API Reference
root
zaber_motion.ascii
AlertEventAllAxesAxisAxisGroupAxisIdentityAxisSettingsAxisStorageAxisTypeConnectionConversionFactorDeviceDeviceIdentityDeviceIODeviceIOInfoDeviceSettingsDeviceStorageDigitalOutputActionGetAxisSettingGetAxisSettingResultGetSettingGetSettingResultIoPortLabelIoPortTypeLockstepMeasurementSequenceMessageTypeOscilloscopeOscilloscopeCapturePropertiesOscilloscopeDataOscilloscopeDataSourceParamsetInfoPidTuningPvtPvtAxisDefinitionPvtAxisTypePvtBufferPvtCallActionPvtCancelAllOutputsScheduleActionPvtCancelOutputScheduleActionPvtCsvDataPvtIoPvtModePvtPartialCsvDataPvtPartialPointPvtPartialSequenceItemPvtPointPvtSequencePvtSequenceItemPvtSetAllAnalogOutputsActionPvtSetAllDigitalOutputsActionPvtSetAnalogOutputActionPvtSetDigitalOutputActionResponseServoTunerServoTuningParamServoTuningParamsetSetStateAxisResponseSetStateDeviceResponseSettingConstantsSimpleTuningSimpleTuningParamDefinitionStreamStreamAxisDefinitionStreamAxisTypeStreamBufferStreamIoStreamModeStreamsTransportTriggerTriggerActionTriggerConditionTriggerEnabledStateTriggerOperationTriggersTriggerStateUnknownResponseEventWarningFlagsWarnings
zaber_motion.binary
BinarySettingsCommandCodeConnectionDeviceDeviceIdentityDeviceSettingsDeviceTypeErrorCodeMessageReplyCodeReplyOnlyEventUnknownResponseEvent
zaber_motion.exceptions
MotionLibExceptionBinaryCommandFailedExceptionDataCommandFailedExceptionDataCommandTooLongExceptionDataDeviceAddressConflictExceptionDataDeviceDbFailedExceptionDataDeviceDbInnerErrorGCodeExecutionExceptionDataGCodeSyntaxExceptionDataInvalidPacketExceptionDataInvalidPvtPointInvalidResponseExceptionDataMovementFailedExceptionDataMovementInterruptedExceptionDataOperationFailedExceptionDataPvtExecutionExceptionDataPvtMovementFailedExceptionDataPvtMovementInterruptedExceptionDataSetDeviceStateExceptionDataSetPeripheralStateExceptionDataStreamExecutionExceptionDataStreamMovementFailedExceptionDataStreamMovementInterruptedExceptionData
zaber_motion.gcode
AxisDefinitionAxisMappingAxisTransformationDeviceDefinitionOfflineTranslatorTranslateMessageTranslateResultTranslatorTranslatorConfig
zaber_motion.microscopy
AutofocusAutofocusStatusCameraTriggerFilterChangerIlluminatorIlluminatorChannelMicroscopeMicroscopeConfigObjectiveChangerThirdPartyComponentsWdiAutofocusProviderWdiAutofocusProviderStatus
zaber_motion.product
ProcessProcessControllerProcessControllerModeProcessControllerSourceProcessControllerSourceSensor
zaber_motion
AxisAddressChannelAddressCyclicDirectionDeviceDbSourceDeviceDbSourceTypeDeviceDiscoveryResultDevicePortTypeFirmwareVersionLibraryLogOutputModeMeasurementNamedParameterRotationDirectionToolsUnitConversionDescriptorUnitsUnitTable
SupportBinary Protocol (Legacy)
© 2026 Zaber Technologies Inc.

API Reference v9.0.0

Translatorclass

Module: zaber_motion.gcode

Represents a live G-Code translator. It allows to stream G-Code blocks to a connected device. It requires a stream to be setup on the device. Requires at least Firmware 7.11.

The following example illustrates how you can obtain an instance of this type:

from zaber_motion.ascii import Connection
from zaber_motion.gcode import Translator

connection = Connection.open_serial_port('COM3')
device = connection.get_device(1)
streams = device.streams
stream = streams.get_stream(1)
translator = Translator.setup(stream)
Related Guides:
  • G-Code

Index

pProperties
coordinate_system
translator_id
mMethods
flush()
get_axis_coordinate_system_offset()
get_axis_position()
reset_after_stream_error()
reset_position()
set_axis_home_position()
set_axis_position()
set_axis_secondary_home_position()
set_feed_rate_override()
set_traverse_rate()
setup()
translate()

Properties

p

coordinate_system

readonly
translator.coordinate_system
str Current coordinate system.
p

translator_id

readonly
translator.translator_id
int The ID of the translator that serves to identify native resources.

Methods

m

flush()

async available
translator.flush(wait_until_idle = True)
Flushes the remaining stream commands waiting in optimization buffer into the underlying stream. The flush is also performed by M2 and M30 codes.
Arguments
NameTypeDescription
wait_until_idleboolDetermines whether to wait for the stream to finish all the movements.
Return Value
List[str] The remaining stream commands.
m

get_axis_coordinate_system_offset()

translator.get_axis_coordinate_system_offset(coordinate_system, axis, unit)
Gets offset of an axis in a given coordinate system.
Arguments
NameTypeDescription
coordinate_systemstrCoordinate system (e.g. G54).
axisstrLetter of the axis.
unitLengthUnitsUnits of position.
Return Value
float Offset in translator units of the axis.
m

get_axis_position()

translator.get_axis_position(axis, unit)
Gets position of translator's axis. This method does not query device but returns value from translator's state.
Arguments
NameTypeDescription
axisstrLetter of the axis.
unitLengthUnitsUnits of position.
Return Value
float Position of translator's axis.
m

reset_after_stream_error()

translator.reset_after_stream_error()
Resets internal state after device rejected generated command. Axis positions become uninitialized.
m

reset_position()

async available
translator.reset_position()
Resets position of the translator from the underlying stream. Call this method after performing a movement outside of translator.
m

set_axis_home_position()

translator.set_axis_home_position(axis, position, unit)
Sets the home position of translator's axis. This position is used by G28.
Arguments
NameTypeDescription
axisstrLetter of the axis.
positionfloatThe home position.
unitLengthUnitsUnits of position.
m

set_axis_position()

translator.set_axis_position(axis, position, unit)
Sets position of translator's axis. Use this method to set position after performing movement outside of the translator. This method does not cause any movement.
Arguments
NameTypeDescription
axisstrLetter of the axis.
positionfloatThe position.
unitLengthUnitsUnits of position.
m

set_axis_secondary_home_position()

translator.set_axis_secondary_home_position(axis, position, unit)
Sets the secondary home position of translator's axis. This position is used by G30.
Arguments
NameTypeDescription
axisstrLetter of the axis.
positionfloatThe home position.
unitLengthUnitsUnits of position.
m

set_feed_rate_override()

translator.set_feed_rate_override(coefficient)
Allows to scale feed rate of the translated code by a coefficient.
Arguments
NameTypeDescription
coefficientfloatCoefficient of the original feed rate.
m

set_traverse_rate()

translator.set_traverse_rate(traverse_rate, unit)
Sets the speed at which the device moves when traversing (G0).
Arguments
NameTypeDescription
traverse_ratefloatThe traverse rate.
unitVelocityUnitsUnits of the traverse rate.
s

setup()

async available
Translator.setup(stream, config = None)
Sets up the translator on top of a provided stream.
Arguments
NameTypeDescription
streamStreamThe stream to setup the translator on. The stream must be already setup in a live or a store mode.
configOptional[TranslatorConfig]Configuration of the translator.
Return Value
Translator New instance of translator.
m

translate()

async available
translator.translate(block)
Translates a single block (line) of G-code. The commands are queued in the underlying stream to ensure smooth continues movement. Returning of this method indicates that the commands are queued (not necessarily executed).
Arguments
NameTypeDescription
blockstrBlock (line) of G-code.
Return Value
TranslateResult Result of translation containing the commands sent to the device.
Top