RobotStudio event

Specific MoveL instruction with API

Joachim123
edited June 2015 in Developer Tools
Hello,

I would like to create a MoveL instruction with non default values for speed and zone. It seems that i have to use RsProcessDefinition, RsInstructionTemplate, RsInstructionArgument and RsProcessTemplate, but the Example in the API does not really work, hence a small Example would be very nice. image

Post edited by Henrik Berlin on

Comments

  • Hi Joachim,

    have found a solution to your problem? I have the same problem and the API just contains an example, in which a specific SearchL-Instruction is created.

    Any help is appreciated.

  • Hi everyone, I have the same issue! Can somebody provide some help, how one can make a move instruction in the api and setting the parameters for speed and zone respectivly? Grateful for any help.
  • Topic moved to Developer Center.
    Henrik Berlin
    ABB
  • Hi,
    how about this:

    private const string DefaultSpeed = "v7000";
    private const string DefaultZone = "z200";

    var station = Station.ActiveStation;
    var task = station.ActiveTask;
    var moduleName = "MOD_" + _name;
    var tool = task.ActiveTool;
    var wobj = task.ActiveWorkObject;

    // Create a PathProcedure.
    var myPath = new RsPathProcedure(_name);

    // Add the path to the ActiveTask.
    task.PathProcedures.Add(myPath);
    myPath.ModuleName = moduleName;
    myPath.ShowName = true;
    myPath.Synchronize = true;
    myPath.Visible = true;

    RsInstruction instruction;
    instruction = new RsMoveInstruction(task, "Move", "Default", MotionType.Linear, wobj.Name, target.Name, tool.Name);

    // -- SPEED --
    var speed = instruction.InstructionArguments["Speed"];
    speed.Value = DefaultSpeed;
    speed.Enabled = true;

    // -- ZONE --
    var zone = instruction.InstructionArguments["Zone"];
    zone.Value = DefaultZone;
    zone.Enabled = true;

    // Add it to myPath.
    myPath.Instructions.Add(instruction);

    Kind regards