Basics for getting up and running with Axis motion in RapidCode for Python.
import os
import platform
import sys
import time
if platform.system() == "Windows":
os.add_dll_directory("c:\\Program Files (x86)\\INtime\\bin")
import RapidCodeHelpers as helpers
rapidcode_dir = helpers.find_rapid_code_directory()
sys.path.append(rapidcode_dir)
import RapidCodePython as RapidCode
def main():
print("Hello, RapidCode.")
creation_params:RapidCode.CreationParameters = helpers.get_creation_parameters()
motionController:RapidCode.MotionController = RapidCode.MotionController.Create(creation_params)
print("This object is a "+str(type(motionController)))
print("MotionController creation error count: ", motionController.ErrorLogCountGet())
helpers.check_errors(motionController)
motionController.AxisCountSet(1)
axis:RapidCode.Axis = motionController.AxisGet(0)
helpers.check_errors(axis)
print("Axis ",axis.NumberGet()," creation error count: ", axis.ErrorLogCountGet())
axis.MoveRelative(2, 10, 1, 1, 50)
while not axis.MotionDoneGet():
print("Position: ", axis.CommandPositionGet(), " Velocity: ", axis.CommandVelocityGet())
time.sleep(1)
motionController.Delete()