How to connect buttons and files.

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.

More
10 Apr 2011 10:17 #8736 by Rick G
Yep that is for a subroutine, which is what I use. Never had occasion to try with to get a phyton program to work the way you describe.
As John pointed out you may want to look at ngcgui which you can embed in tabs for fast access to ngc files from AXIS. These can be quite powerful and easy to edit.

Rick G

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

More
10 Apr 2011 11:01 #8737 by Mike_Eitel
Yes I understood John's way.

But I wanted to stay with mainstream axis and pyvcp.
I prefer mainstream, otherwise it's easy to run into frustration, as happend with mocca....

It seems as I understood coorectly the functionality of O code..... Pitty, But
I'l stay on looking around for a solution.

THX to both of you, Rick and John.

Mike

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

More
10 Apr 2011 11:55 - 10 Apr 2011 11:57 #8738 by Mike_Eitel
OK Ihave partialy sucess:

In the ini file :

OPEN_FILE = /home/cnc/emc2/nc_files/EMC.ngc
......................
#
Connect buttons of screen
HALUI =halui

[HALUI]
MDI_COMMAND = G0 X1 Y1 Z1
MDI_COMMAND = G0 X2 Y2 Z2
MDI_COMMAND = G0 X3 Y3 Z3
MDI_COMMAND = o<Tools/square> call



In the postgui / pyvyp.hal :
net cmd00 pyvcp.cmd00 halui.mdi-command-00
net cmd01 pyvcp.cmd01 halui.mdi-command-01
net cmd02 pyvcp.cmd02 halui.mdi-command-02
net cmd03 pyvcp.cmd03 halui.mdi-command-03


In my ncfiles I have a subdirectoty called tools and as examle herin the file square.ngc:
o<tools/square> sub
G0 Z1
G0 x0 y0
F 120
G1 x0 y0 z0
G1 x0 y10 z0
G1 x10 y10 z0
G1 x10 y0 z0
G1 x0 y0 z0
o<tools/square> endsub
M2
%

As soon as I press the button, all commands in the file are processed correctly.

That way I can predefine some G-code programms, runned without request.
I'll experiment with M1 and message to get additional information and safety on screen

Maybe I'l find also something for .py and jpg. ;-()

Mike
Last edit: 10 Apr 2011 11:57 by Mike_Eitel.

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

More
10 Apr 2011 11:57 #8739 by Rick G
Perhaps Andy will jump in,

In the mean time have you looked at ...

www.linuxcnc.org/component/option,com_ku...d,6514/lang,english/

Rick G

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

More
10 Apr 2011 12:01 #8741 by Rick G
Great, looks like your on your way.

Rick

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

More
10 Apr 2011 12:03 #8742 by Mike_Eitel
Yes Rick

I thibk this will be a good way to go.

I forgot about M101 etc.

Mike

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

Time to create page: 0.168 seconds
Powered by Kunena Forum