Repository navigation
Scripting API
Nishendra Singh edited this page Sep 16, 2026
·
4 revisions
You can control robots from the Python console and from macros. The module App/rbt_api.py is the public API.
from freecad.robotics.App.rbt_api import get_robot, get_robotsAll values at the API boundary are millimeters and degrees. Placements are App.Placement objects in world coordinates. Errors raise RbtError (RbtInputError, RbtDocError).
| Function | Function result |
|---|---|
get_robot(hint=None, doc=None) |
One RobotApi. Give no hint when the document has one robot. A hint is a Name, a Label, or a Robot object |
get_robots(doc=None) |
List of RobotApi for all robots in the document |
rob = get_robot() # the only robot in the active document
rob = get_robot("KR16") # by Label
for rob in get_robots():
print(rob) # <RobotApi 'Robot1' joints=6>- RobotApi: read the structure, move the joints, FK and IK, base, tools, and backend.
- TrajectoryApi: make waypoints, examine plans, and move along trajectories.
- RobotBuilder: build or edit a robot from a script, without the wizard.
get_robot, get_robots, RobotApi, RobotBuilder, TrajectoryApi, RbtError, RbtInputError, RbtDocError, REVOLUTE, PRISMATIC, FIXED, PTP, LIN, Waypoint, is_robot, is_trajectory.