Control the Z Scanner

Python

[set] You can retract the Z Scanner or adjust its operating range. [get] You can check the current position of the Z Scanner. [dependency] - SmartRemote

main 1 file
Control the Z …..py
control_z_scanner.py 756.0 B
Control the Z …..py 758 bytes
from SmartRemote import SmartRemote

class ControlZScanner:

    def __init__(self):
        self.__sr = SmartRemote()

    def retract_z_scanner(self):
        reply = self.__sr.run('spm.zscanner.retractAll()')
        return reply['result']
    
    def get_z_scanner_pos(self):
        reply = self.__sr.run('spm.zscanner.pos')
        pos = float(reply['value'])
        return pos
    
    def set_z_scanner_range(self,percent:int=70):
        reply = self.__sr.run(f'spm.zscanner.changeRangeTo({percent})')
        return reply['result']  


if __name__ == "__main__":
    czs = ControlZScanner()
    czs.retract_z_scanner()
    pos = czs.get_z_scanner_pos()
    print(f'Z Scanner Pos.: {pos}')
    czs.set_z_scanner_range(30)
Comments (0)

No comments yet. Be the first to comment!

Snippet Information
Author: jungyu.lee
Language: Python
Created: Oct 23, 2025
Updated: 0 minutes ago
Views: 37
Stars: 1

Links & Files

Additional Files (1):