async def stream_data(websocket, path): cnc = FocasConnection("192.168.1.100") cnc.connect() while True: data = "load": cnc.get_spindle_load(), "feed": cnc.get_feedrate()
# Send the data to the CNC machine cnc.write(100, data) # 100 is the address where the data will be written fanuc focas python
The core connection function is cnc_allclibhndl3 . We must define the argument types so ctypes knows how to convert Python types to C types. async def stream_data(websocket
fwlib = ctypes.windll.fwlib32
def get_status(self): status = ctypes.c_short() ret = focas.cnc_statinfo(self.handle, ctypes.byref(status)) return status.value if ret == 0 else None fanuc focas python