Hi! this could be a big project, I’ve never worked with Pocket NC tools but i guess there are a lot of solutions for this, here are some of my ideas but as I said I don’t know exactly how pocketNc works;
1) on PocketNC at first sight it looks like you have only outputs/inputs through USB, so, if you can get a signal at the end of your pocketnc programm and receive it on an Arduino (USB serial for example), you should be able to then send a GPIO signal (easier) to the Niryo arm. So the programm in your niryo would do step 1 to 3 then waits the signal then execute lasts orders.
2) If you need to be connected to a computer and you can get something at the end of your programm you can do a lot of things, sending through USB to Arduino and do the same as my 1st idea, by being connected directly to the Raspberry pi the programm executes the next steps …
3) If you can’t do anything with software you can still try to deal with hardware, right now I am thinking about something like an endstop sensor wich is activated at a specific position (gcode last order says to go that position).