How to create targets by using API?
Options
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.4K RobotStudio
- 383 UpFeed
- 14 Tutorials
- 12 RobotApps
- 291 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 247 ScreenMaker
- 2.7K Robot Controller
- 279 IRC5
- 46 OmniCore
- 6 RCS (Realistic Controller Simulation)
- 3 RobotStudio AR Viewer
- 733 RAPID Programming
- 15 Wizard Easy Programming
- 105 Collaborative Robots
- 3 Job listings