Tool Diameter in py script
- MatthiasF1210
- Offline
- Junior Member
- Posts: 37
- Thank you received: 0
I want to use the tool diameter inside an custom gui and a py script, but don't find a corresponding hal pin (or something similar) to retrieve the information.
Any help?
Thanks
Matthias
Please Log in or Create an account to join the conversation.
- Mike_Eitel
- Offline
- Platinum Member
- Posts: 1150
- Thank you received: 184
Please Log in or Create an account to join the conversation.
- MatthiasF1210
- Offline
- Junior Member
- Posts: 37
- Thank you received: 0
halui just represents offsets not the diameter...
Please Log in or Create an account to join the conversation.
import linuxcnc
s = linuxcnc.stat()
s.poll()
if s.tool_in_spindle != 0: # a tool is loaded
print s.tool_table[s.tool_in_spindle].diameter
Please Log in or Create an account to join the conversation.
- Mike_Eitel
- Offline
- Platinum Member
- Posts: 1150
- Thank you received: 184
....
halui.tool.length−offset.z float out
current applied tool length offset for the Z axis
halui.tool.diameter float out
Current tool diameter, or 0 if no tool is loaded.
halui.tool.number u32 out
current selected tool
spindle
.....
Please Log in or Create an account to join the conversation.
ToolDiameter = #5410
the table can be modified by G10
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
what GUI are you planing? Just because I believe this thread is wrong here in the gmoccapy area. Should I move it to other GUI?
Norbert
Please Log in or Create an account to join the conversation.
- MatthiasF1210
- Offline
- Junior Member
- Posts: 37
- Thank you received: 0
what GUI are you planing? Just because I believe this thread is wrong here in the gmoccapy area. Should I move it to other GUI?
I am doing an small panel inside gmoccapy, where i want to display and calculate some cutting parameters. I found inside the gmoccapy.py file something like this and was wondering if I can use this inside my py-script.
def _update_toolinfo( self, tool ):
toolinfo = self.widgets.tooledit1.get_toolinfo( tool )
if toolinfo:
# Doku
# toolinfo[0] = cell toggle
# toolinfo[1] = tool number
# toolinfo[2] = pocket number
# toolinfo[3] = X offset
# toolinfo[4] = Y offset
# toolinfo[5] = Z offset
# toolinfo[6] = A offset
# toolinfo[7] = B offset
# toolinfo[8] = C offset
# toolinfo[9] = U offset
# toolinfo[10] = V offset
# toolinfo[11] = W offset
# toolinfo[12] = tool diameter
# toolinfo[13] = frontangle
# toolinfo[14] = backangle
# toolinfo[15] = tool orientation
# toolinfo[16] = tool info
self.widgets.lbl_tool_no.set_text( str( toolinfo[1] ) )
self.widgets.lbl_tool_dia.set_text( toolinfo[12] )
self.widgets.lbl_tool_name.set_text( toolinfo[16] )
# we do not allow touch off with no tool mounted, so we set the
# coresponding widgets unsensitive and set the description acordingly
if tool <= 0:
self.widgets.lbl_tool_no.set_text( "0" )
self.widgets.lbl_tool_dia.set_text( "0" )
self.widgets.lbl_tool_name.set_text( _( "No tool description available" ) )
self.widgets.btn_tool_touchoff_x.set_sensitive( False )
self.widgets.btn_tool_touchoff_z.set_sensitive( False )
else:
self.widgets.btn_tool_touchoff_x.set_sensitive( True )
self.widgets.btn_tool_touchoff_z.set_sensitive( True )
@Mike_Eitel
halui.tool.diameter float out
Current tool diameter, or 0 if no tool is loaded.
in my machine the is no parameter like this (just offsets and number).
@phillc54
thanks I will try this....
Please Log in or Create an account to join the conversation.
- Mike_Eitel
- Offline
- Platinum Member
- Posts: 1150
- Thank you received: 184
The tool diameter is shown in halui but only for short time going, either with T or when M6 is recognized. Then back to 0.
In my comp (calculating some cutting parameters and showing via LCD) I therefore store the value if it is not zero..
Sorry that I didn't remember that...
Mike
Please Log in or Create an account to join the conversation.