AXIS: How to set up python code generator in a tab?

More
20 Apr 2020 15:11 #164866 by jmr
Hi,
I do not see direct info about this anywhere, I believed it can be done with pyngcgui but after looking it does not seem possible. I know it can be done with gremlin, however I do not have any experience with it and since the machine is already running I would like to just add a tab there...
Ok I need some help, or an example to start from.
Basically I want input like in pyngcgui but instead of pushing the values to .ngc file I want it to run a python script. Of course there needs to be a way to pass the gcode, having it saved with known fixed filename and reloading after generation is good enough. Or maybe I can be crazy and call python script from gcode called from pyngcgui, but how?
Thanks

Please Log in or Create an account to join the conversation.

More
20 Apr 2020 17:52 #164877 by cmorley
Axis can 'filter' a program through another program before running it.
linuxcnc.org/docs/2.8/html/gui/axis.html#_program_filters

Is that what you want to do?

Please Log in or Create an account to join the conversation.

More
20 Apr 2020 18:59 #164880 by jmr
Thanks, it could do the job, but it is not the perfect solution. The cycle time is rather short, and it should not require a lot of clicking. We got a HD display so it would be best to embed the generator somehow in the interface, we plan to get a touchscreen. Other option is just another window on the screen and ctrl+R to reload. Not that pretty but workable, this is propably my next stage, as currently the generator runs on another machine and writes to NFS.
Having it embedded would make it easily retain previously entered data.
It would be "good enough" if there is any way to bind "load file1.ext" on a vcp panel or in any other place. This way the generator would start after one hit of the button (i can make it remember last setting), otherwise it requires to file->open->scroll... all the time.
Best option I see is to use EMBED_TAB_COMMAND, however I do not know what can be embedded this way, and if it is possible to use this multiple times in ini file.
I want to save as much "keyboard monkey" time as possible, it ran 5 cycles during writing of this post.

Please Log in or Create an account to join the conversation.

More
20 Apr 2020 19:08 #164882 by cmorley
Being embedded has nothing to do with being filtered.
Embedded requires X window id forwarding.
Gladevcp and qtvcp can do this (gladevcp works better)
so by extension GTK2 based programs can be embedded easily..
GTK3 probably could, I have no experience.

What I am not sure of is if loading a program in AXIS externally will get it filtered.

Chris

Please Log in or Create an account to join the conversation.

More
20 Apr 2020 19:11 #164883 by cmorley
I guess I should mention how to control AXIS externally:

linuxcnc.org/docs/2.8/html/gui/axis.html#_axis_remote

Please Log in or Create an account to join the conversation.

More
20 Apr 2020 19:18 #164884 by jmr
I think I will use axis_remote to load the generated file.
Should I look straight at gladevcp in order to make such "tab", or is there any other not complicated example?
More crazy way would be to use gladevcp panel for data input, and then an userspace component to call the script with values it got via hal... Would you call that wrong way?

Please Log in or Create an account to join the conversation.

More
20 Apr 2020 19:28 #164885 by cmorley
Without knowing your program it's had to say what's easiest.
gladevcp makes embedding easier and if your program is already GTK2 based that's an easier conversion too. With it's ability to do python extensions with a handler file you can do most anything you want.

If you program is GTK2 based you could patch it to do X window forwarding.

If axis-remote will also filter the program then that simplifies things.

You will have to decide what's easiest for you.

Chris

Please Log in or Create an account to join the conversation.

More
20 Apr 2020 20:03 #164887 by jmr
Currently it is split in two or three parts: bash script with Xdialog asks user for input, it is then executing python script which has no gui and it then executes another, FreeCAD (with no GUI) based script , so it is not at all limited to any GUI solution. I started to work on python only version with wx but that was for EMCO DC70 machine and I only done the job and material placement part of it, which sped things up enough. Pushing vars from Xdialog to bash to python was bad and ugly and should not be done again... Pyngcgui takes care of user input very nicely. Maybe I can hack it to run python script with the vars given instead of normal ngc script.
I will look at the gladevcp and pyngcgui sources as it already works on the machine.
A python postprocessor for pyngcgui output could do the job too.
Thanks for all the hints

Please Log in or Create an account to join the conversation.

Time to create page: 0.104 seconds
Powered by Kunena Forum