How to connect buttons and files.

More
08 Apr 2011 20:50 #8712 by Mike_Eitel
Hi

I'm augmenting my mill and started to use pyvcp. I think I understand now hoe to do...

I have pyvcp loading midi commands via some buttons.. ( used the homing examples from this forum ) Works fine.

Now what I want is to realize is to load different "functionalities" via calling files

I want to load on button-push files in the format .ngc, but also .py or .jpg

What I want is to have some files that do easy functions like "scrubbing a area of X * Y " or drillinf a "area of holes " or what ever I will find usefull in future.

I think I have to use the G-code o but i was not succesfull until now.

Can somybody give me an idea ..

THX Mike

P.S.
When finished I intend to publish my solution, so everybody can profit

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

More
08 Apr 2011 20:54 #8714 by BigJohnT
I would take a look at ngcgui in the Subroutines section...

John

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

More
08 Apr 2011 21:17 #8716 by Mike_Eitel
THX John

I saw that ngcgui conversation in the last time, but as I understood that is an alternative gui.

and cant' remember that there was a description how to load/ecxecute files....

Or do I miss something

Mike

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

More
08 Apr 2011 22:01 #8717 by BigJohnT
I think your confusing Mocca with ngcgui. ngcgui adds tabs to Axis to run subroutines. You can enter variables for the subroutine for just about anything.

It is a sticky in the Subroutines section...

John

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

More
09 Apr 2011 09:23 #8720 by Rick G
Besides the ngcgui

You might want to look here...
wiki.linuxcnc.org/emcinfo.pl?Simple_EMC_G-Code_Generators

and

wiki.linuxcnc.org/emcinfo.pl?Oword

You can use a button either physical or pyvpc to call a MDI command and that MDI command can run a subroutine with the O word.
The file has to be a subroutine and be in the correct directory.

I do not believe that this worked in earlier versions of EMC.

Rick G

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

More
09 Apr 2011 10:26 #8721 by Mike_Eitel
Hi Rick

the link to the Phyton is exactly what I want.
I want to start them via pressing on a pyvyp button.

After reading the doc you and John pointed out, I doubth that I cab use MDI commands ??

Is there eventually a halui command ( that I missed to see ) that can invoke a file ?

Mike

P.S.
I'm aware that I can go and load a .py file via " the normal way" but I think a button would be "nice and sexy" ;-)

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

More
09 Apr 2011 11:50 #8722 by Rick G
Hello Mike,

I am off to work now but can send you example of using a MDI command from a button to call a sub routine file tonight or tomorrow.

Rick G

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

More
09 Apr 2011 13:23 #8723 by Mike_Eitel
Phantastic
THX

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

More
10 Apr 2011 09:43 #8732 by Rick G
I start by creating a sub file and giving it a numerical name. In this example the file name is 2.ngc.
I locate this file in the directory listed by PROGRAM_PREFIX in your ini file.


2.ngc...

o<2> sub
G0 x0 y0 z0
G0 x10 y10 z1
G0 x2 y2 z2
o<2> endsub
M2

You then need to add the MDI call to [HALUI] section of your ini file...

[HALUI]
### add halui MDI commands here (max 64)
MDI_COMMAND = o<2> call


You then need to connect the button to the MDI command in your custom_postgui.hal file...

net examp halui.mdi-command-00 <= input.0.btn-base6


The MDI commands in the ini file are accessed and numbered starting with 0. So they must be in order.


Below gives better detail

wiki.linuxcnc.org/emcinfo.pl?Adding_Custom_MDI_Buttons

But you would change "MDI_COMMAND = G0 X0 Y0 Z0" to MDI_COMMAND = o<2> call

Also look at...
wiki.linuxcnc.org/emcinfo.pl?One_Button_Toggle

Hope that helps,

Rick G

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

More
10 Apr 2011 09:47 #8733 by Mike_Eitel
THX Rick

As fare as I understand, that is for a SUBROUTINE .
but can I use it also to call a "phyton " based program ?

Mike

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

Time to create page: 0.142 seconds
Powered by Kunena Forum