Calling tool_touch_off.ngc subroutine from another subroutine - Probe Basic

More
2 years 5 months ago #301737 by zmrdko
Related question: Is it possible to somehow pass parameter values for tool touch off from ini file? The idea is that the values are not lost by copying config, etc.

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

More
2 years 5 months ago #301743 by Aciera
Not sure if this is what you are looking for but by default you should be able to access values from the ini file in gcode using this format

#<_ini[section]name>
The following user(s) said Thank You: zmrdko

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

More
2 years 5 months ago - 2 years 5 months ago #301744 by zmrdko
Yes, I am aware of that. But question is more like where to put this expression, so that probe basic gets the value from INI to tool touch off parameters.
Last edit: 2 years 5 months ago by zmrdko.

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

More
2 years 5 months ago #301751 by spumco
If you look at the tool_touch_off subroutine, the tool touch-off position values appear to be stored as persistent variables in the .var file.

Specifically #5181, #5182, & #5183 (X/Y/Z).

I don't have a linux machine in front of me right now, so I can't open the UI and see exactly how the 'set tool touch off position' button works, but I suspect it just writes the values of the three fields to the appropriate variable numbers without any super-complicated backstage stuff.  It also (probably) reads those values at UI launch.

I'm not sure what the value is of using the INI file to store the location vs. just using the .vars file... but far be it from me to challenge someone wanting a 'peculiar' feature or change; I'm guilty of fiddling with all sorts of stuff like this.

If you want to store & retrieve the values from your INI file, I think you could do it like this:
Edit INI file:
Code:
[TOOL_SETTER] (or whatever you want) TOOL_SETTER_X = 0.000 TOOL_SETTER_Y = 1.234 TOOL_SETTER_Z = 5.678

Edit tool_touch_off.ngc:
Code:
... #<tool_touch_x_coords> = #<ini[TOOL_SETTER]TOOL_SETTER_X #<tool_touch_y_coords> = #<ini[TOOL_SETTER]TOOL_SETTER_Y #<tool_touch_z_coords> = #<ini[TOOL_SETTER]TOOL_SETTER_Z ...

I think that should work, but please be careful to test at really low speeds.  Note that this 'hack' has nothing to do with the on-screen tool touch-off locations which are managed through the GUI.  You can still enter the location on-screen, but you've essentially hijacked the tool setter subroutine so it ignores the on-screen values (which are still stored are variables).

Further, if you update Probe Basic your 'hack' is likely to get overwritten and will need to be re-done.  The subroutine will need to be edited again, and if you've made any changes to the UI those will also need to be re-added to the updated version.

Possibly you could create a new 'touch off location' display field and stick it in a new user tab - those shouldn't get over-written if you update PB.

I did something similar for my ATC sequence by using INI values for the Z-movement locations and speeds rather than the values hard-coded in the tool change subroutines.
The following user(s) said Thank You: zmrdko

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

More
2 years 5 months ago - 2 years 5 months ago #301752 by spumco
EDIT

I fat-fingered the parameters above and forgot the closing ">".  Should look like this:
#<tool_touch_x_coords> = #<ini[TOOL_SETTER]TOOL_SETTER_X>
#<tool_touch_y_coords> = #<ini[TOOL_SETTER]TOOL_SETTER_Y>
#<tool_touch_z_coords> = #<ini[TOOL_SETTER]TOOL_SETTER_Z>
Last edit: 2 years 5 months ago by spumco. Reason: formatting
The following user(s) said Thank You: tommylight

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

Moderators: KCJ, Lcvette
Time to create page: 0.306 seconds
Powered by Kunena Forum