Probably other people have been looking for a axis user exit/extension  
capability beyond halui.mdi-command-xx's functionality. Ideallly I'd  
have user-defined Python functions and gcode subroutines called from  
the axis context by some "user-defined command" menu or somesuch, but  
I found the axis ui inpenetrable to extend, so I've been looking at  
massaging pyvcp without touching axis.

What've come up with is a halpin/Python interface through a pyvcp  
pseudo widget. Setting the hal pin triggers the corresponding Python  
function call within pyvcp, and optionally a function called on every  
pyvcp update.


<pyvcp>
     <!-- one or several invisible command "widgets" - -->
     <cmd>
         <halpin>"cmd-01"</halpin>
         <function>"cmdfunc"</function>
         <updatehook>"updatefunc"</updatehook>
         <disablepin>False</disablepin>
     </cmd>
     <hbox>
        <!-- normal pyvcp widgets go here -->
     </hbox>
</pyvcp>

pyvcp_widgets.py includes userfuncs.py which looks as follows:
...
def cmdfunc(pycomp):
     """ example user command function"""
     print "cmdfunc() called, pycomp=",pycomp

def updatefunc(pycomp):
     """ example update hook function"""
     print "updatefunc() called, pycomp=",pycomp
...

now setting component.cmd-01 to 1 results in cmdfunc() being called.

--

If that's considered useful, I'll clean it up and contribute a patch.


-Michael






------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Emc-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to