Basics for getting up and running with Axis motion in RapidCode for Python.
📜 Hello Axis Motion
import os
import sys
import time
import RapidCodeHelpers as helpers
rapidcode_dir = helpers.find_rapid_code_directory()
os.add_dll_directory("c:\\Program Files (x86)\\INtime\\bin")
sys.path.append(rapidcode_dir)
import RapidCode
def main():
print("Hello, RapidCode.")
motionController:RapidCode.MotionController = RapidCode.MotionController.CreateFromSoftware(rapidcode_dir)
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)
Learn more in settling topic page.