Hi Brad,
I'm not sure I 100% understand what you are asking. But we already added that functionality.
See
case M_Action_Callback in InvokeAction
The "action" for the MCode has to be configured as type M_Action_Callback
A callback handler for this needs to be set with
void CGCodeInterpreter::SetUserMCodeCallback(G_M_USER_CALLBACK *UserFn)
The callback to you will pass the MCode number as a parameter. Anything else like P Q R parameter words for the MCode can be extracted directly from the Interpreter setup data structure.
HTH
TK
| Group: DynoMotion |
Message: 2307 |
From: bradodarb |
Date: 11/18/2011 |
| Subject: Re: Mcode Mapping |
I see I was not very concise there... bear with me
I guess what I am asking is how do I go about defining that M_ActionCallback?
Where is that collection of MCode Actions located and how would I go about initializing and adding actions?
I see this Member in the Interpreter:
MCODE_ACTION McodeActions[MAX_MCODE_ACTIONS]
But it is unclear to me how the array indices are mapped to the various Mcodes
Thank you
Brad Murry
--- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>
> Hi Brad,
> Â
> I'm not sure I 100% understand what you are asking. But we already added that functionality.
> Â
> See
> Â case M_Action_Callback in InvokeAction
> Â
> The "action" for the MCode has to be configured as type M_Action_Callback
> Â
> A callback handler for this needs to be set with
> Â voidCGCodeInterpreter::SetUserMCodeCallback(G_M_USER_CALLBACK *UserFn)
> Â
> The callback to you will pass the MCode number as a parameter. Anything else like P Q R parameter words for the MCode can be extracted directly from the Interpreter setup data structure.
> Â
> HTH
> TK
> Â
> Â
>
> From: bradodarb <bradodarb@...>
> To: DynoMotion@yahoogroups.com
> Sent: Friday, November 18, 2011 3:27 PM
> Subject: [DynoMotion] Mcode Mapping
>
>
> Â
> Hello Tom,
>
> I want to provide Mcode mappings similar to the KmotionCNC, though for the way I want to handle things I think I can just get away with
> [PC App callback].
>
> This way I can map all mcodes to IronPython scripts and handle things like tool changes, etc...
>
> There are most likely times when a cprogram will need to be fired, but I think to keep things consistent and simple I would like to command the execution of them thru the IronPython script as well.
>
> Any chance of a snippet or line # you can point me to?
>
> Thanks,
>
> Brad Murry
>
|
|
| Group: DynoMotion |
Message: 2308 |
From: Tom Kerekes |
Date: 11/18/2011 |
| Subject: Re: Mcode Mapping |
Hi Brad,
The SimpleGCode shows an example of how it is used.
Basically:
// configure the Action for MCode 3 to do a Callback
Interpreter.McodeActions[3].Action = M_Action_Callback;
// configure the Action for MCode 105 to do a Callback
Interpreter.McodeActions[MCODE_ACTIONS_M100_OFFSET+5].Action = M_Action_Callback;
Interpreter.SetUserMCodeCallback(UserMCodeCallback); // Set this to handle MCode Callbacks
The Array of "Actions" probably wasn't thought through well. It is a single Array in this order:
11 MCodes 1-10 (standard ones)
S (configured as an M code)
10 User Buttons
20 (User Mcodes 100-119 which allow PQR parameters in the Block)
Use these defines
#define MAX_MCODE_ACTIONS_M1 11 // actually only 2-10 are used
#define MAX_MCODE_ACTIONS_BUTTONS 10
#define MAX_MCODE_ACTIONS_M100 20
#define MAX_MCODE_ACTIONS (MAX_MCODE_ACTIONS_M1+MAX_MCODE_ACTIONS_M100+MAX_MCODE_ACTIONS_BUTTONS)
#define MCODE_ACTIONS_M100_OFFSET (MAX_MCODE_ACTIONS_M1+MAX_MCODE_ACTIONS_BUTTONS)
TK
| Group: DynoMotion |
Message: 2309 |
From: bradodarb |
Date: 11/18/2011 |
| Subject: Re: Mcode Mapping |
Perfect, just what I was after.
Thanks again Tom.
-Brad
--- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>
> Hi Brad,
> Â
> The SimpleGCode shows an example of how it is used.
> Â
> Basically:
> Â // configure the Action for MCode 3 to do a CallbackInterpreter.McodeActions[3].Action = M_Action_Callback;// configure the Action for MCode 105 to do a CallbackInterpreter.McodeActions[MCODE_ACTIONS_M100_OFFSET+5].Action = M_Action_Callback;
> Interpreter.SetUserMCodeCallback(UserMCodeCallback);
> Â
> The Array of "Actions" probably wasn't thought through well. It is a single Array in this order:
> Â
> 11 MCodes 1-10 (standard ones)
> SÂ (configured as an M code)
> 10 User Buttons
> 20Â Â (User Mcodes 100-119 which allow PQR parameters in the Block)
> Â
> Use these defines
> Â #defineMAX_MCODE_ACTIONS_M1 11 // actually only 2-10 are used#defineMAX_MCODE_ACTIONS_BUTTONS 10#defineMAX_MCODE_ACTIONS_M100 20#defineMAX_MCODE_ACTIONS (MAX_MCODE_ACTIONS_M1+MAX_MCODE_ACTIONS_M100+MAX_MCODE_ACTIONS_BUTTONS)#defineMCODE_ACTIONS_M100_OFFSET (MAX_MCODE_ACTIONS_M1+MAX_MCODE_ACTIONS_BUTTONS)
> Â
> TK
> Â // Set this to handle MCode Callbacks
>
> From: bradodarb <bradodarb@...>
> To: DynoMotion@yahoogroups.com
> Sent: Friday, November 18, 2011 3:59 PM
> Subject: [DynoMotion] Re: Mcode Mapping
>
>
> Â
> I see I was not very concise there... bear with me
>
> I guess what I am asking is how do I go about defining that M_ActionCallback?
>
> Where is that collection of MCode Actions located and how would I go about initializing and adding actions?
>
> I see this Member in the Interpreter:
>
> MCODE_ACTION McodeActions[MAX_MCODE_ACTIONS]
>
> But it is unclear to me how the array indices are mapped to the various Mcodes
>
> Thank you
>
> Brad Murry
>
> --- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@> wrote:
> >
> > Hi Brad,
> > ÃÂ
> > I'm not sure I 100% understand what you are asking.ÃÂ But we already added that functionality.
> > ÃÂ
> > See
> > ÃÂ case M_Action_Callback in InvokeAction
> > ÃÂ
> > The "action" for the MCode has to be configured as type M_Action_Callback
> > ÃÂ
> > A callback handler for this needs to be set with
> > ÃÂ voidCGCodeInterpreter::SetUserMCodeCallback(G_M_USER_CALLBACK *UserFn)
> > ÃÂ
> > The callback to you will pass the MCode number as a parameter.ÃÂ Anything else like P Q R parameter words for the MCode can be extracted directly from the Interpreter setup data structure.
> > ÃÂ
> > HTH
> > TK
> > ÃÂ
> > ÃÂ
> >
> > From: bradodarb <bradodarb@>
> > To: DynoMotion@yahoogroups.com
> > Sent: Friday, November 18, 2011 3:27 PM
> > Subject: [DynoMotion] Mcode Mapping
> >
> >
> > ÃÂ
> > Hello Tom,
> >
> > I want to provide Mcode mappings similar to the KmotionCNC, though for the way I want to handle things I think I can just get away with
> > [PC App callback].
> >
> > This way I can map all mcodes to IronPython scripts and handle things like tool changes, etc...
> >
> > There are most likely times when a cprogram will need to be fired, but I think to keep things consistent and simple I would like to command the execution of them thru the IronPython script as well.
> >
> > Any chance of a snippet or line # you can point me to?
> >
> > Thanks,
> >
> > Brad Murry
> >
>
|
|
| | | |