How to create targets by using API?
chris
✭
in RobotStudio
Hi Johannes,I would like more information from you about creating targets in RS5.07 by using API.Because it's very useful in our work.Thanks.
0
Comments
-
Hi Chris,
typically you would do something like this to create a target and add it to a path:
Station stn = Project.ActiveProject as Station;
RsTask task = stn.ActiveTask;
// Create RsRobTarget
RsRobTarget robTarget = new RsRobTarget();
robTarget.Name = <name>
robTarget.ModuleName = <module>
robTarget.Frame.Matrix = <matrix>
task.DataDeclarations.Add(robTarget);
// Create Target
RsWorkObject wobj = task.ActiveWorkObject;
RsTarget target = new RsTarget(wobj, robTarget);
target.Name = <name>
task.Targets.Add(target)
// Create RsMoveInstruction
RsToolData tool = task.ActiveTool;
RsProcessDefinition procDef = task.ActiveProcessDefinition;
RsProcessTemplate procTempl = procDef.ActiveProcessTemplate;
RsMoveInstruction moveInstr = new RsMoveInstruction(task, procDef.Name, procTempl.Name, procTempl.ActiveMotionType, wobj.Name, robTarget.Name, tool);
// Add to path
PathProcedure path = task.ActivePathProcedure;
path.Instructions.Add(moveInstr);
(Note that the ".ActiveXXX" properties correspond to the selections in the Elements toolbar. You can change these to whatever suits you.)
regards,
Johannes
Johannes Weiman
Software Engineer
ABB Robotics0 -
I will have a try,thanks.0
Categories
- All Categories
- 5.5K RobotStudio
- 396 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 249 ScreenMaker
- 2.7K Robot Controller
- 310 IRC5
- 59 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 786 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 5 Job listings