Forum Migration Notice
We're transitioning to a more modern community platform by the end of this year. Learn about the upcoming changes and what to expect.

Get current executed Code in PC SDK?

Hello,

I'm new to PC SDK.
We start a program on the Flexpendant and now we want to get the currently running code via PC SDK. I've already tried a lot. I can get all sorts of information about the PC SDK, just not the code that is currently running. Is there a possibility? If yes how?

Best Answers

  • revans
    revans
    Answer ✓
    I believe what you may be looking for is something like the following. 

    strmod=controller.Rapid.GetTask("").ProgramPointer.Module;
    strRout=controller.Rapid.GetTask("").ProgramPointer.Routine;

    This will return the string that shows the current robot module and routine. If you are trying to get the line of code that it is currently on in a text format, it appears you may be best off saving the mod file to the computer using the pcsdk and using controller.Rapid.GetTask("").ProgramPointer.Range; to get the exact line of code and reading it from the text file. I hope that is not what you mean as it will change very quickly, and I don't see how it would be of much use. If you have a use case for it I would be interested as you may be better off using the motion pointer as your reference instead.

  • Tompanhuhu
    Tompanhuhu ✭✭✭
    Answer ✓

    I have made a component that does what you want, so it is fully possible.
    I think it's useful when running background tasks, as they are not as easy to view in the flexpendant.


    Systemintegrator - Web / C# / Rapid / Robotstudio

    If I helped, please press Vote Up  :smile:

    ☑️2024 - RobotStudio® User Group