[Yes. YES.] Is there a way to display the current UCS [G5n setting] in AXIS?

More
27 Dec 2020 19:52 #193308 by cakeslob
dont understand completely whats happening but when i broke it down to use it for other things , it was like this as to my understanding

'all_systems' is in axis.py to define(?) the usersystem coordinates
'o.' is for the opengl widget for the preview frame
github.com/LinuxCNC/linuxcnc/blob/master...axis/scripts/axis.py

'g5x_index' is located in the python interface docs, but can also be found in axis.py as defined 'o.last_g5x_index = self.stat.g5x_index'
linuxcnc.org/docs/devel/html/config/python-interface.html

'split' the split stuff is something python to only take the first returned value i think

yes, i thought the same thing, display spindle speed, so i also used this thread to get me there. here is a fast and dirty one for you, because I am using my spindle speed in a different area. it is not as clean as phils, because i dont know how to leverage the python interface very well yet. it might be something like this linuxcnc.stat.spindle.speed . because im not so good, im making a halcomp and linking it to spindle speed in hal, so make sure your spindle is linked to spindle-vel-cmd-rpm in hal
# shortcut saves typing
W = root_window.tk.call

#  create the label, the text will be over written later 
W('label','.pane.top.tabs.fmanual.spindlef.spindle-speed','-text','SPEED')

# the position of the label,  I changed it from the homing section, it makes more sense in spindle 
W('grid','.pane.top.tabs.fmanual.spindlef.spindle-speed','-column','0','-row','3','-sticky','w')

# this updates the spindle label when every it changes, and also re-configures the text
def user_live_update():
  W('.pane.top.tabs.fmanual.spindlef.spindle-speed','configure','-text','SPEED %3.0f' % (comp['spindle-speed']))
  

### this creates new axisui halpins and connects them to existing signals , spindle speed is now viewable under axisui pins in hal config
def user_hal_pins():
    # create new hal pins
    #mycomp = hal.component('feed')
    comp.newpin('spindle-speed', hal.HAL_FLOAT, hal.HAL_IN)
    
    hal.connect('axisui.spindle-speed','spindle-vel-cmd-rpm')

add this the same way you would with g5x UCS.
USER_COMMAND_FILE = usercommand_justspeed.py
if you want to use both (g5x and spindle speed) you need to merge the user_live_update sections of the 2
pyvcp will not work properly with the way I have done spindlespeed with a new comp pin
here is the thread where I am playing with axis stuff, my main examples for spindle speed are located here
forum.linuxcnc.org/21-axis/40373-search-bar-and-gcode-scroll


File Attachment:

File Name: usercomman...speed.py
File Size:1 KB
Attachments:
The following user(s) said Thank You: phillc54

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

More
28 Dec 2020 04:00 #193340 by nau
Dear cakeslob,

Thank you very much for such a clear explanation. Now I do understand how it's works and my Axis looks exactly as I wanted.
Attachments:

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

Time to create page: 0.070 seconds
Powered by Kunena Forum