Sounds great Tom,
This is what I am thinking:
adding a string flag for user defined block:
GO X0.0 Y1.0
M6 T2
[UserBlockFlag] UserMessage
G1........
Maybe the flag could be some thing like _UB
GO X0.0 Y1.0
M6 T2
_UB UserMessage
G1........
Then an callback handler similar to
G_STATUS_CALLBACK or G_COMPLETE_CALLBACK
G_USERBLOCK_CALLBACK could be added and pass the user message to a function pointer where I can handle it in a delegate on the c# side.
In my case, the UserMessage would be a script name and I would fire it off once the message was received.
.....While thinking this through it would also be excellent to have a wait parameter on the callback.
Just do the callback
_UB 0 UserMessage
do the callback and dwell until resume is called
_UB 1 UserMessage
Make sense? Any pitfalls to watch out for or pointers in the right direction is
appreciated.
Thanks for your time,
Brad Murry
--- In
DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>
> Hi Brad,
> Â
> Its not clear to me what you mean. A callback from a GCode Block?  As an M Code? What/when would register the call back?
>
> If you implement the change (and there is no major disadvantage for others) we will incorporate it in future releases.
> Â
> Regards
> TK
>
> --- On Wed, 7/6/11, bradodarb <bradodarb@...> wrote:
>
>
> From: bradodarb <bradodarb@...>
> Subject: [DynoMotion] Re: Run python script from interpreter
> To:
DynoMotion@yahoogroups.com> Date: Wednesday, July 6, 2011, 10:21 AM
>
>
> Â
>
>
>
> Any chance of seeing a User Block Callback in an upcoming build?
>
> Or if you have another suggestion that does not involvef changing you code? I do not want to implement it myself(and do so every subsequent update)
>
> -Brad Murry
>
> --- In
DynoMotion@yahoogroups.com, "bradodarb" <bradodarb@> wrote:
> >
> > Tom,
> >
> >
> > I now recall seeing the load file and Mcode as well.
> >
> > I will need to look further into the Mcodes.
> >
> > In Iron Python, scripts run int the DLR(Dynamic Language Runtime, but are compatible with CLR(Common Language Runtime
- which is what .net languages compile to) objects.
> >
> > I can generate a dynamic runtime and add whichever variables I wish, including objects in my application(especially the c# wrappers I am creating for your DynoMotion devices).
> >
> > So basically how the framework is used at my work and how I wish to incorporate the DynoMotion hardware is:
> >
> > C/C++ :: dlls for device access
> >
> > c# :: dlls for wrapping the device in abstracted objects
> >
> > c#/WPF :: application for great GUI
> >
> > Iron Python :: for controlling the actual behavior of the c#/C/C++ objects.
> >
> > The python scripting is great to use on things like confiuring the UI so it can display different interfaces, options, etc.. at runtime. I also use the scripting for things like a tool changer or even to define what happens when an operator
presses cycle start.
> >
> >
> > I realize most if not all what I want to acomplish could be handed in your c scripts, but to maintain compatability with my existing framework and to enable the manipulation of CLR objects I need to use Iron Python.
> >
> >
> >
> >
> > I am not sure loading from file will be as performant as I need it to be, I typically cache most scripts in a pre-compiled run-time for speedy execution.
> >
> >
> >
> > It would be great if there was a User Block Callback available in the interpreter.
> >
> >
> > Thanks,
> >
> > Brad Murry
> >
> >
> >
> >
> >
> >
> >
> > --- In
DynoMotion@yahoogroups.com, Tom Kerekes <tk@> wrote:
> > >
> > > Hi Brad,
> > > ÂÂ
> > > I assume you mean to run on the PC side rather than the DSP side.
> > > ÂÂ
> > > Besides specifying .c files to be compiled, downloaded, and executed there is an option for an MCode or User Button to execute a Windows Executable. Search for:
> > > ÂÂ
> > > case M_Action_Program_PC:
> > > ÂÂ
> > > ÂÂ
> > > However I would think the problem would be that the Python would run as a separate process and wouldn't have access to any of the variables in the libraries or Interpreter or your application. Maybe I don't understand your intent.
> > > ÂÂ
> > > Regards
> > > TK
> > >
ÂÂ
> > >
> > >
> > > --- On Tue, 7/5/11, bradodarb <bradodarb@> wrote:
> > >
> > >
> > > From: bradodarb <bradodarb@>
> > > Subject: [DynoMotion] Run python script from interpreter
> > > To:
DynoMotion@yahoogroups.com> > > Date: Tuesday, July 5, 2011, 8:50 AM
> > >
> > >
> > > ÂÂ
> > >
> > >
> > >
> > > Hello
> > >
> > > I have seen in the sources where you can load and run a c program from a g-code file.
> > >
> > > I would like to come up with some sort of way to keep the original functionality, but also have the ability to fire off an Iron Python script as
well.
> > >
> > > Do you have any advice on the best way to intercept calls like this?
> > >
> > > -Brad Murry
> > >
> >
>