Axis Modifications

More
27 Nov 2021 17:02 #227758 by cakeslob
Replied by cakeslob on topic Axis Modifications
I took this from archeye's posts from a long time ago, and his work on machinekit and made it usercommand-able

Axis loads the most recent file opened on startup, so what ever you closed with, it opens with.
Add one of these to your usercommand file or axisrc and under [DISPLAY] in ini, add
LOAD_LASTFILE = YES
##########################################################
########       LOAS_LAST FILE   PY2 for 2.8     ##########
########   In ini file under [DISPLAY]  ##################
########     LOAD_LASTFILE = 	YES       ################
##########################################################

loadlast = inifile.find('USER_COMMANDS', 'LOAD_LASTFILE')
if loadlast == "YES" :
    load_lastfile = True
else:
    load_lastfile = False


lastfile = ""
recent = ap.getpref('recentfiles', [], repr)
if len(recent):
    lastfile = recent.pop(0)

code = []
addrecent = True
if args:
    initialfile = args[0]
elif os.environ.has_key("AXIS_OPEN_FILE"):
    initialfile = os.environ["AXIS_OPEN_FILE"]
elif inifile.find("DISPLAY", "OPEN_FILE"):
    initialfile = inifile.find("DISPLAY", "OPEN_FILE")
elif os.path.exists(lastfile) and load_lastfile:
    initialfile = lastfile
    print "Loading " 
    print initialfile
elif lathe:
    initialfile = os.path.join(BASE, "share", "axis", "images","axis-lathe.ngc")
    addrecent = False
else:
    initialfile = os.path.join(BASE, "share", "axis", "images", "axis.ngc")
    addrecent = False

if os.path.exists(initialfile):
    open_file_guts(initialfile, False, addrecent)

##########################################################
########       LOAS_LAST FILE   PY3 for 2.9   ############
########   In ini file under [DISPLAY]  ##################
########     LOAD_LASTFILE = 	YES       ################
##########################################################

loadlast = inifile.find('DISPLAY', 'LOAD_LASTFILE')
if loadlast == "YES" :
    load_lastfile = True
else:
    load_lastfile = False


lastfile = ""
recent = ap.getpref('recentfiles', [], repr)
if len(recent):
    lastfile = recent.pop(0)

code = []
addrecent = True
if args:
    initialfile = args[0]
elif "AXIS_OPEN_FILE" in os.environ:
    initialfile = os.environ["AXIS_OPEN_FILE"]
elif inifile.find("DISPLAY", "OPEN_FILE"):
    initialfile = inifile.find("DISPLAY", "OPEN_FILE")
elif os.path.exists(lastfile) and load_lastfile:
    initialfile = lastfile
    print ("Loading ") 
    print (initialfile)
elif lathe:
    initialfile = os.path.join(BASE, "share", "axis", "images","axis-lathe.ngc")
    addrecent = False
else:
    initialfile = os.path.join(BASE, "share", "axis", "images", "axis.ngc")
    addrecent = False

if os.path.exists(initialfile):
    open_file_guts(initialfile, False, addrecent)

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

More
27 Nov 2021 18:15 #227762 by D.L.
Replied by D.L. on topic Axis Modifications
cakeslob, thanks for this good idea - use hal.component and hal.get_value.

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

More
03 Dec 2021 18:17 - 29 Dec 2021 16:20 #228305 by D.L.
Replied by D.L. on topic Axis Modifications
Axis cutting parameters mod.


Mod hal pins axisui.display-spindle-speed and axisui.display-spindle-angle

Connection in file custom_postgui.hal, for example:
net spindle-vel-cmd-rpm-abs => axisui.display-spindle-speed
or
net spindle-fb-rpm-abs-filtered => axisui.display-spindle-speed
net spindle-revs => axisui.display-spindle-angle

Setup mod
There are 2 ways to install this mod:
1. Replace files(axis, axis.tcl and glcanon.py) in existing installation LinuxCNC v2.8.2, begins to work immediately.

2. Standard compilation from sources downloaded from:
github.com/ddotldot/linuxcnc/archive/ref...ads/2.8-axis-mod.zip
github.com/ddotldot/linuxcnc/archive/ref...ads/2.7-axis-mod.zip
Building guide: linuxcnc.org/docs/devel/html/code/building-linuxcnc.html

Setup to existing installation LinuxCNC v2.8.2:
cd ~
wget https://github.com/ddotldot/linuxcnc/archive/refs/heads/2.8-axis-mod.zip

unzip -t 2.8-axis-mod.zip
unzip 2.8-axis-mod.zip

sudo mv /usr/lib/python2.7/dist-packages/rs274/glcanon.py /usr/lib/python2.7/dist-packages/rs274/glcanon.py.orig
sudo mv /usr/share/axis/tcl/axis.tcl /usr/share/axis/tcl/axis.tcl.orig
sudo mv /usr/bin/axis /usr/bin/axis.orig

sudo cp linuxcnc-2.8-axis-mod/lib/python/rs274/glcanon.py /usr/lib/python2.7/dist-packages/rs274/glcanon.py
sudo cp linuxcnc-2.8-axis-mod/share/axis/tcl/axis.tcl /usr/share/axis/tcl/axis.tcl

Open linuxcnc-2.8-axis-mod/src/emc/usr_intf/axis/scripts/axis.py with text editor and replace
#!/usr/bin/env python2
to
#!/usr/bin/python

sudo cp linuxcnc-2.8-axis-mod/src/emc/usr_intf/axis/scripts/axis.py /usr/bin/axis

Setup to existing installation LinuxCNC v2.7.15:
It is possible to setup only the old version mod!
cd ~
wget http://forum.linuxcnc.org/media/kunena/attachments/30800/axis-mod-2715.zip

unzip -t axis-mod-2715.zip
unzip -d axis-mod-2715 axis-mod-2715.zip

sudo mv /usr/lib/python2.7/dist-packages/rs274/glcanon.py /usr/lib/python2.7/dist-packages/rs274/glcanon.py.orig
sudo mv /usr/share/axis/tcl/axis.tcl /usr/share/axis/tcl/axis.tcl.orig
sudo mv /usr/bin/axis /usr/bin/axis.orig

sudo cp axis-mod-2715/glcanon.py /usr/lib/python2.7/dist-packages/rs274/glcanon.py
sudo cp axis-mod-2715/axis.tcl /usr/share/axis/tcl/axis.tcl
sudo cp axis-mod-2715/axis /usr/bin/axis

Old version mod hal pins:
motion.analog-in-00 (spindle speed)
motion.analog-in-01 (spindle angle)
Connection in any hal file.

Mod links:
github.com/ddotldot/linuxcnc/tree/2.7-axis-mod
github.com/ddotldot/linuxcnc/tree/2.8-axis-mod
Attachments:
Last edit: 29 Dec 2021 16:20 by D.L..

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

More
03 Dec 2021 18:33 #228306 by D.L.
Replied by D.L. on topic Axis Modifications
Simple mod - homing request message when press Machine Power button:
In axis file replace this code:
    def onoff_clicked(event=None):
        s.poll()
        if s.task_state == linuxcnc.STATE_ESTOP_RESET:
            c.state(linuxcnc.STATE_ON)
        else:
            c.state(linuxcnc.STATE_OFF)
to this code(2.8):
    def onoff_clicked(event=None):
        s.poll()
        if s.task_state == linuxcnc.STATE_ESTOP_RESET:
            c.state(linuxcnc.STATE_ON)
            runHoming=prompt_areyousure(_("Homing request"),_("After turning on the machine power,\nYou need find axes origins.\n\n            Run homing process?"))
            if runHoming:
                commands.home_all_joints()
        else:
            c.state(linuxcnc.STATE_OFF)
to this code(2.7):
    def onoff_clicked(event=None):
        s.poll()
        if s.task_state == linuxcnc.STATE_ESTOP_RESET:
            c.state(linuxcnc.STATE_ON)
            runHoming=prompt_areyousure(_("Homing request"),_("After turning on the machine power,\nYou need find axes origins.\n\n            Run homing process?"))
            if runHoming:
                commands.home_all_axes()
        else:
            c.state(linuxcnc.STATE_OFF)
 
Attachments:

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

More
17 Jan 2022 22:48 #232198 by alkabal
Replied by alkabal on topic Axis Modifications
Hello

Many thanks for sharing this mod !

If the proposition for PR your patch is actual can you consider to try ?

andypugh post=227243 userid=723

Does it make sense to add this mod to the LinuxCNC build?
 

I think that if you can format it as a pull-request on Github then there might be interest. 

Br

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

More
18 Jan 2022 13:17 #232289 by D.L.
Replied by D.L. on topic Axis Modifications
Hi.
Create a PR not difficult, only there are other small difficulties:
I can not test mod for 2.9.
And need check mod compatibility(should not affect) with other linuxcnc screens, glcannon.py used not only for AXIS.
I will be glad any help in testing mod.
Mod for 2.9 link: github.com/ddotldot/linuxcnc/tree/2.9-axis-mod

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

More
05 Feb 2022 13:24 #234021 by radom
Replied by radom on topic Axis Modifications
I tried replacing files on two different 2.8.2 builds and cannot get it to work
what I am missing?
 
Attachments:

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

More
05 Feb 2022 13:30 - 05 Feb 2022 13:31 #234023 by radom
Replied by radom on topic Axis Modifications
Ok now I get it, you cannot have offsets showing with this mod
Last edit: 05 Feb 2022 13:31 by radom.

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

More
12 Feb 2022 13:26 #234638 by Arbiwei
Replied by Arbiwei on topic Axis Modifications
very nice I've been looking for a way to display the spindle position for a long time. Are you planning to start a pull request or will your development not be included in the LinuxCNC project? why is the letter of the spindle a lowercase "a"? At Heidenhain it is "S1" for the first spindle, "S2" for the second, etc.

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

More
12 Feb 2022 20:28 #234659 by D.L.
Replied by D.L. on topic Axis Modifications
Hi.
PR is planned, maybe a little later, mod for 2.9 yet not tested.
'a' = 'angle', it can be easily replaced by another text.
To do this, find and replace one string in the file glcanon.py.
For example:
posstrs.append(angformat % ("a",
to
posstrs.append(angformat % ("S1",
The following user(s) said Thank You: Arbiwei

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

Time to create page: 0.138 seconds
Powered by Kunena Forum