Is it possible to call a named subroutine?

More
08 Jan 2015 23:34 #54787 by mmt
Is it possible to call a named subroutine from NGCGUI?

Such as: I have several different subs and I need to type in the name in ngcgui of the sub that I want to call.

My understanding is it will only accept numbers.

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

More
08 Jan 2015 23:54 - 08 Jan 2015 23:56 #54789 by ArcEye
Hi

I haven't used NGCGUI for a while, but I thought all subs were named anyway

You have to include them in your ini file and a tab is created to select them.
[DISPLAY]
.......
TKAPP = ngcgui_app.tcl
NGCGUI = ngcgui.tcl

NGCGUI_SUBFILE = ~/emc2/ngc/start.ngc
NGCGUI_SUBFILE = ~/emc2/ngc/moveto.ngc
NGCGUI_SUBFILE = ~/emc2/ngc/path1.ngc
NGCGUI_SUBFILE = ~/emc2/ngc/path2.ngc
NGCGUI_SUBFILE = ~/emc2/ngc/g71r.ngc
NGCGUI_SUBFILE = ~/emc2/ngc/g71f.ngc
NGCGUI_SUBFILE = ~/emc2/ngc/g72r.ngc
NGCGUI_SUBFILE = ~/emc2/ngc/g72f.ngc
NGCGUI_SUBFILE = ~/emc2/ngc/peck_groove.ngc
NGCGUI_SUBFILE = ~/emc2/ngc/face.ngc
NGCGUI_SUBFILE = ~/emc2/ngc/taper-r.ngc
NGCGUI_SUBFILE = ~/emc2/ngc/taper-f.ngc
NGCGUI_SUBFILE = ~/emc2/ngc/int-taper.ngc
NGCGUI_SUBFILE = ~/emc2/ngc/bore.ngc
NGCGUI_SUBFILE = ~/emc2/ngc/threadx.ngc
NGCGUI_SUBFILE = ~/emc2/ngc/taper-threadx.ngc
NGCGUI_SUBFILE = ~/emc2/ngc/toolchange.ngc
NGCGUI_SUBFILE = ~/emc2/ngc/end.ngc

NGCGUI_FONT = Sans -10 normal

If that is not what you meant, you will have to expand

regards
Last edit: 08 Jan 2015 23:56 by ArcEye.

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

More
09 Jan 2015 00:58 #54793 by mmt
Sorry i should explain better. i am an advanced user and took some things for granted.

I have my ngcgui file working just fine. We have hundreds of files that we cut and I want to be able to have a few variable that change passed on in ngcgui and then pull the file so that the base file does not have to be edited when there are changes.

Something like #5 below Ex.


(ngcgui) tab

;
O<ngcgui> sub
;
;**********ENTER VARIABLES**********
;
#<LASER_POWER>=#1(=0)
#<Q-SWITCH_FREQUENCY>=#2(=0)
#<X_POSITION>=#3(=0)
#<Y_POSITION>=#4(=0)
;
#<PROGRAM>=#5(=myprogram)
;
;
;
o#5 call

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

More
10 Jan 2015 01:11 #54830 by ArcEye
Hi

Had a look back through the docs and examples and I think the answer is probably no, at least by the direct calling method.

The parameters in the ngcgui tab are passed as calling parameters to a sub routine, which limits their type to float, certainly not a text field.

It depends how many subs you use, as to whether there is any merit in building in the equivalent of a switch{} statement or a look up table in your ngcgui sub,
passing a call to a particular sub dependent upon the value of the calling parameter.

If you want the sub to execute any external sub, with no advance knowledge of its name or contents, you are probably stuck with numbers.

I am happy to be corrected, but that is how I read the execution flow of ngcgui.

regards

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

More
10 Jan 2015 02:02 - 10 Jan 2015 02:05 #54835 by dgarrett
ngcgui (and pyngcgui) provide prompts for arguments to
GCODE subroutines which are _always_ numbers

You can use a set of if/else statements to select a subroutine
based on an input number but it is not very convenient.

If you want to use a bunch of _named_ subroutines that
share some common code, it is convenient to use
a base subroutine like this:
$ cat base.ngc
o<base> sub
  #<userparm1> = #1 (=0)
  #<userparm2> = #2 (=0)
  ; ...
  ; do something common to all callers
o<base> endsub

$ cat abc.ngc
o<abc> sub
  #<abc_arg1> = #1 (=0)
  #<abc_arg2> = #2 (=0)
  ; ...
  ; do stuff unique to abc
  o<base> call [#<abc_arg1>][#<abc_arg2>]
  ; do stuff unique to abc
o<abc> endsub

$ cat def.ngc
o<def> sub
  #<def_arg1> = #1 (=0)
  #<def_arg2> = #2 (=0)
  ; ...
  ; do stuff unique to def
  o<base> call [#<def_arg1>][#<def_arg2>]
  ; do stuff unique to def
o<def> endsub

With this method, the operator can pick the routines abc,def,...
from the file selector (using a Custom tab) or they can be presented as individual
tabs with ini file entries like:
[DISPLAY]
NGCGUI_SUBFILE = abc.ngc
NGCGUI_SUBFILE = def.ngc
Last edit: 10 Jan 2015 02:05 by dgarrett.

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

More
10 Jan 2015 02:17 #54836 by mmt
Arceye,

I know there is a better way to do what it is i am trying to do.

I am an engineer and build cnc lasers from scratch. I am working on my 6th one now and have another right behind this one. We have 3 in the US and 2 at our facility in India.

I have a method of simplifying our software that is similar to NGCGUI.

I have a standalone program that I have written for our operators to enter some variables and it generates a G code program for them (conversational).

I know there is an easy to incorporate it into axis, I just haven't been able to wrap my brain around it.

I would love to share it on here but due to the proprietary nature of our business (and my confidentiality agreement) I can not post it here as is.

If I could email you my files and get your input on the matter, I would very much appreciate it.

Once it is worked out I will create a general program (not what we use) and then post it here and let others run with it. I am sure many people here would find it very beneficial and improve upon it.

Is that OK with you?

Thanks,
Kent

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

More
10 Jan 2015 02:26 #54837 by mmt
dgarret,

Thank you. I think that may do the trick. I will play around with it.

thanks,
kent

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

More
10 Jan 2015 17:52 #54856 by ArcEye

I have a standalone program that I have written for our operators to enter some variables and it generates a G code program for them (conversational).

I know there is an easy to incorporate it into axis, I just haven't been able to wrap my brain around it.

I would love to share it on here but due to the proprietary nature of our business (and my confidentiality agreement) I can not post it here as is.

If I could email you my files and get your input on the matter, I would very much appreciate it.


PM sent

If you don't get anything (messages sometimes just disappear) come back to me

regards

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

More
20 Jan 2015 09:53 #55196 by mmt
Arceye,

I sent you an email from your profile info.

Pardon my asking, but where is the pm section of my profile on this forum?

thanks
Kent

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

More
20 Jan 2015 15:53 #55201 by ArcEye
Received it and answered.

The PM is not necessarily intuitive.
You have to go to the profile of the person you want to contact and send it from there.

If you go to your own profile you don't see anything.

Sometimes they don't arrive anyway, so not ideal

regards

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

Time to create page: 0.080 seconds
Powered by Kunena Forum