Tool Diameter in py script

More
28 Jul 2019 19:58 #140833 by MatthiasF1210
Hi,

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.

More
28 Jul 2019 20:21 #140835 by Mike_Eitel
Halui presents tool parameters.

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

More
28 Jul 2019 20:41 #140836 by MatthiasF1210
Thanks for the replay.

halui just represents offsets not the diameter...

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

More
29 Jul 2019 00:17 - 29 Jul 2019 00:18 #140853 by phillc54
Replied by phillc54 on topic Tool Diameter in py script
I think this python code adapted from linuxcnc.org/docs/html/config/python-int...xcnc_stat_attributes will do what you want.
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
Last edit: 29 Jul 2019 00:18 by phillc54.

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

More
29 Jul 2019 07:19 #140867 by Mike_Eitel
Halui in MASTER
....
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.

More
29 Jul 2019 10:28 #140870 by pl7i92
Replied by pl7i92 on topic Tool Diameter in py script
woudent the paramerter be the most recent tooldiameter to greb



ToolDiameter = #5410

the table can be modified by G10

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

More
29 Jul 2019 10:39 #140873 by phillc54
Replied by phillc54 on topic Tool Diameter in py script
I don't think you can read numbered parameters from python.

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

More
29 Jul 2019 18:21 #140906 by newbynobi
Just curious,

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.

More
30 Jul 2019 18:47 #140967 by MatthiasF1210
Hi,

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.

More
30 Jul 2019 19:12 #140970 by Mike_Eitel
I remember now.
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.

Moderators: newbynobi
Time to create page: 0.115 seconds
Powered by Kunena Forum