CS-Lab Support Forum for CNC Community
Help to run this brand-new forum and stay with us.
Ask your questions, we are here to help!
passing information from one python script to another within SimCNC
Quote from Michael on 18 September 2025, 12:26Hello,
do I have a chance to pass an information from one python script to another within SimCNC?
When pressing "start trajectory" I execute a "run"-script which stops and start the trajectory dependingly of an external condition. I would prefere using start and stop trajectory instead of pause because it gives me more possibilities. My problem is now, that the "stop trajectory" button is not working when my script has stoped the trajectory and waits for the external condition. My script restarts the trajectory when the external condition is not more present.
So I need to know when the "stop trajectory" button is pressed to terminate my "run"-script. I already tried a script behind the "Stop" button with d.stopTrajectory, d.finishTrajectory and d.stopButton. It does not help.
Is there any possibility to pass a variable from my "Stop" script to my "Run" script. My only idea is to leave a "cookie" on the hard disk but this is not very elegant.
Thanks
Michael
Hello,
do I have a chance to pass an information from one python script to another within SimCNC?
When pressing "start trajectory" I execute a "run"-script which stops and start the trajectory dependingly of an external condition. I would prefere using start and stop trajectory instead of pause because it gives me more possibilities. My problem is now, that the "stop trajectory" button is not working when my script has stoped the trajectory and waits for the external condition. My script restarts the trajectory when the external condition is not more present.
So I need to know when the "stop trajectory" button is pressed to terminate my "run"-script. I already tried a script behind the "Stop" button with d.stopTrajectory, d.finishTrajectory and d.stopButton. It does not help.
Is there any possibility to pass a variable from my "Stop" script to my "Run" script. My only idea is to leave a "cookie" on the hard disk but this is not very elegant.
Thanks
Michael
Quote from Dobbelju on 18 September 2025, 13:27Hello!
One solution could be using machineparameters.
You can find them under "diagnostics" -> parameter table (raw translation).
There you can use commands to write an status in it, you can grab these status from every script.
Commands:
d.setMachineParam(200,1)
(writes an 1 to param 200, you can use up to 4000 params by your choice so far i know (over 4000 is resevered for simcnc itself))
d.getMachineParam(200)
with this command it would get an 1 as result (refering to the set param above) and can check if the external condition is still present for example.
Maybe this will work for you.
Kind regards
Dobbelju
Hello!
One solution could be using machineparameters.
You can find them under "diagnostics" -> parameter table (raw translation).
There you can use commands to write an status in it, you can grab these status from every script.
Commands:
d.setMachineParam(200,1)
(writes an 1 to param 200, you can use up to 4000 params by your choice so far i know (over 4000 is resevered for simcnc itself))
d.getMachineParam(200)
with this command it would get an 1 as result (refering to the set param above) and can check if the external condition is still present for example.
Maybe this will work for you.
Kind regards
Dobbelju
Quote from CS-Lab Support on 19 September 2025, 07:04You can use machine params for that. Parameters #0-1999 are meant to be used by the user. #0-999 are saved in the profile, so their values will be restored when simCNC is restarted, while #1000-1999 are 'volatile'.You can access params in the script by d.setMachineParam / d.getMachineParam and also monitor values through Diagnostic / Parameters Table window. Also, params can be used in gcode e.g. like this:#100=10.5
G0 X#10
#100=10.5
G0 X#10





















