APIs, concepts, guides, and more
Hello Axis Motion

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 # The check_errors() and check_errors() helpers provided on our API SampleApp documentation pages
rapidcode_dir = helpers.find_rapid_code_directory()
#Import the ntx.dll from INtime
os.add_dll_directory("c:\\Program Files (x86)\\INtime\\bin")#ntx.dll
#Import the RapidCode.py file (Path to your rapidcode install directory)
import RapidCode # The RapidCode.py wrapper located in your RMP install directory
def main():
print("Hello, RapidCode.")
motionController:RapidCode.MotionController = RapidCode.MotionController.CreateFromSoftware(rapidcode_dir)
print("This object is a "+str(type(motionController)))#When creating your RapidCode objects (Axis, MultiAxis, MotionController,ect) we recommend specifying the type with my_object_name:RapidCode.*** (MotionController,Axis, Ect.) so that your IDE can autocomplete class member names.
print("MotionController creation error count: ", motionController.ErrorLogCountGet())
axis:RapidCode.Axis = motionController.AxisGet(0)
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())

Learn more in settling topic page.