Catching Extruder call command from RAPID and then converting to G code for 3d printer marlin firmware

Hello everyone. My name is Fahad and I am working on my master thesis which involves 3D printing through ABB Robotic Arm. The code that the Robo DK software generates for the robotic arm motion is in the language RAPID. In that code, there is a call for the extruder of the 3D printer to extrude filament from the nozzle. The problem is that microcontroller of the 3D printer does not understand this call. I do not know anything about coding or python. Can someone help me in writing a code in python that catches the extruder call command and converts it to the language which the firmware of the microcontroller understands and then send that command to the microcontroller (Arduino MEGA + RAMPS 1.4) through serial communication? In my setup, the PC will be acting as a server through which an ethernet connection will be going to the network switch. From the network switch, there will be a ethernet connection going to the robot and one ethernet co0nnection will be going to Raspberry Pi which is also serially connected to the Arduino. If someone understands this scenario, kindly help me with python coding because I have never done it before.