07-08-2022, 01:09 AM
I am looking to modify an existing program in RoboDK through the use of the C# RoboDK API. I have found that I can get the list of instructions with the InstructionList function call (though the Instruction types do not seem to line up to the INS_TYPE_* definitions). I am looking to add a new instruction at some position in the program and, while there appears to be a method for setting a movement instruction, the API seems incomplete as to adding other types of instructions. My first objective would be to add a set speed command to change the speed of the program however this does not seem to be available. setInstruction only seems to allow parameters for movement commands. Can you provide insight into how to insert other commands to an existing program through the API (for example, a speed change half way through the program)?
public void setInstruction(int ins_id, string name, int instype, int movetype, bool isjointtarget, Mat target, double[] joints)
{
link._check_connection();
link._send_Line("Prog_SIns");
link._send_Item(this);
link._send_Int(ins_id);
link._send_Line(name);
link._send_Int(instype);
if (instype == INS_TYPE_MOVE)
{
link._send_Int(movetype);
link._send_Int(isjointtarget ? 1 : 0);
link._send_Pose(target);
link._send_Array(joints);
}
link._check_status();
}
public void setInstruction(int ins_id, string name, int instype, int movetype, bool isjointtarget, Mat target, double[] joints)
{
link._check_connection();
link._send_Line("Prog_SIns");
link._send_Item(this);
link._send_Int(ins_id);
link._send_Line(name);
link._send_Int(instype);
if (instype == INS_TYPE_MOVE)
{
link._send_Int(movetype);
link._send_Int(isjointtarget ? 1 : 0);
link._send_Pose(target);
link._send_Array(joints);
}
link._check_status();
}