RoboDK Forum
如何执行一个特定的指令吗n a program?- Printable Version

+- RoboDK Forum (//www.sinclairbody.com/forum)
+-- Forum: RoboDK (EN) (//www.sinclairbody.com/forum/Forum-RoboDK-EN)
+--- Forum: RoboDK API (//www.sinclairbody.com/forum/Forum-RoboDK-API)
+--- Thread: How to execute a specific instruction in a program? (/Thread-How-to-execute-a-specific-instruction-in-a-program)



如何执行一个特定的指令吗n a program?-Maarten-02-09-2023

What command or method could be used to execute (in simulation) a single specific instruction in a program? Similar to what happens when double clicking an instruction in the GUI tree, or right click>execute instruction.

I'm looking for something like "prog.InstructionExecute(ins_id)", to execute existing instruction number "ins_id" of program "prog".

I found commands InstructionSelect, InstructionDelete, Instruction, setInstruction, RunInstruction, but can't seem to find a command to execute an appointed instruction.

Kind regards,

Maarten


RE: How to execute a specific instruction in a program?-Albert-02-09-2023

You can run one instruction like this:
Code:
program.setParam("StartOne", ins_id)
This has the same effect as double clicking on that instruction. Only that instruction is executed.

Alternatively, you can start from that instruction and keep moving the program pointer by using the Start parameter:
Code:
program.setParam("Start", ins_id)



RE: How to execute a specific instruction in a program?-Maarten-02-14-2023

Thanks Albert, that's what I was looking for!

Maarten