boundaries pin in AXIS

More
13 Apr 2015 20:00 #57746 by fupeama
Hi, is there any posibilities to get min and max coordinates from loaded G-code to pins?
I need make some glade buttons to move to xmin xmax and ymin ymax for check work place.
I find same calculations in AXIS (properties XYZ bounds), but it is only internal value, not hal pin in axisui.
it is no problem to define pins myself and calculate this value in axis.py but I'd radher use something from official distribution.
Thanks Martin
Attachments:

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

More
13 Apr 2015 22:08 #57757 by andypugh
Replied by andypugh on topic boundaries pin in AXIS

fupeama wrote: Hi, is there any posibilities to get min and max coordinates from loaded G-code to pins?
I need make some glade buttons to move to xmin xmax and ymin ymax for check work place.
I find same calculations in AXIS (properties XYZ bounds), but it is only internal value, not hal pin in axisui.


It might be possible to do this in the .axisrc file:

linuxcnc.org/docs/html/gui/axis.html#_axisrc

You can certainly _create_ the pins easily enough with .axisrc. Whether it is as as easy to make the pins update is a different question.

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

More
13 Apr 2015 23:06 #57759 by dgarrett
Replied by dgarrett on topic boundaries pin in AXIS
In axis.py, the LivePlotter class periodically calls a function named update.
At the end of this function there is a call to user_live_update()
which is served by a no-op placeholder.

So an .axisrc file (or a [DISPLAY]USER_COMMAND_FILE) can define a
user_live_update() function which is served periodically like other updates.

ref:
git.linuxcnc.org/gitweb?p=linuxcnc.git;a...2154e975686b8db32229
git.linuxcnc.org/gitweb?p=linuxcnc.git;a...c4d160754b6420bd7df4

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

More
13 Apr 2015 23:17 #57761 by andypugh
Replied by andypugh on topic boundaries pin in AXIS
Just to explain, the advantage of using a .axisrc file to customise Axis behaviour is that the modification will still work if Axis (and LinuxCNC) is updated.

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

More
13 Apr 2015 23:21 #57762 by dgarrett
Replied by dgarrett on topic boundaries pin in AXIS
And another clarification:

a user's ~/.axisrc file is invoked for any ini file used by the user account

an ini option for [DISPLAY]USER_COMMAND_FILE supersedes the ~/.axisrc file
and makes it possible to do axis gui customizations on a per inifile basis

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

More
16 Apr 2015 23:41 #57846 by fupeama
Replied by fupeama on topic boundaries pin in AXIS
Thanks for advice
This information is exactly what I want.
Here is my solution
if hal_present:
    mycomp = hal.component("boundaries")
    mycomp.newpin("max_lim_x",hal.HAL_FLOAT,hal.HAL_OUT)
    mycomp.newpin("min_lim_x",hal.HAL_FLOAT,hal.HAL_OUT)
    mycomp.newpin("mid_lim_x",hal.HAL_FLOAT,hal.HAL_OUT)
    mycomp.newpin("max_lim_y",hal.HAL_FLOAT,hal.HAL_OUT)
    mycomp.newpin("min_lim_y",hal.HAL_FLOAT,hal.HAL_OUT)
    mycomp.newpin("mid_lim_y",hal.HAL_FLOAT,hal.HAL_OUT)
    mycomp.newpin("max_lim_z",hal.HAL_FLOAT,hal.HAL_OUT)
    mycomp.newpin("min_lim_z",hal.HAL_FLOAT,hal.HAL_OUT)
    mycomp.newpin("mid_lim_z",hal.HAL_FLOAT,hal.HAL_OUT)
    mycomp.ready()
if vars.metric.get():
    conv = 1
else:
    conv = 1/25.4


# this function is called at [DISPLAY]CYCLE_TIME interval
def user_live_update():
    min_extents = from_internal_units(o.canon.min_extents, conv)
    max_extents = from_internal_units(o.canon.max_extents, conv)
    mycomp['min_lim_x'] = min_extents[0]
    mycomp['max_lim_x'] = max_extents[0]
    mycomp['mid_lim_x'] =  min_extents[0] + (max_extents[0] - min_extents[0])/2
    mycomp['min_lim_y'] = min_extents[1]
    mycomp['max_lim_y'] = max_extents[1]
    mycomp['mid_lim_y'] = min_extents[1]+ (max_extents[1] - min_extents[1])/2
    mycomp['min_lim_z'] = min_extents[2]
    mycomp['max_lim_z'] = max_extents[2]
    mycomp['mid_lim_z'] =  min_extents[2]+ (max_extents[2] - min_extents[2])/2
   
~
Martin

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

Time to create page: 0.112 seconds
Powered by Kunena Forum