Grip diameter based on Variables

Hi all,

I want to attach a diameter variable to my 3 finger gripper, so that it’ll be easy to simply change the diameter value on the variable screen rather than digging through the code and finding the line that calls for grip diameter, is there a way I can attach the diameter section with preset variables?


Here is the screen I’m looking at and want to have target diameter as a variable .

Thanks!

Not sure if this answers your question, but here’s a script function we use with these grippers (not sure why this editor bolds some of the text)
We adjust the target diameter based on the OD or ID values of the part, which has been entered by the operator in the setup:

Grip, Regrip utilities

def TFG(num):

#num=0: internal grip
#num=1: external grip
#num=2: internal release
#num=3: external release

grip targets:

grip_force = 50
global internal_diameter = (ID_inches * 25.4) + 5
global external_diameter = (OD_inches * 25.4) - 5

release targets:

internal_reldia = (ID_inches *25.4) - 18
external_reldia = (OD_inches *25.4) + 18
if internal_reldia < 18:
		internal_reldia = 18
end

if num == 0 or num == "internal":
	tfg_flexible_grip(internal_diameter, grip_force, external_grip = False, stop_if_no_force=True)
elif num == 1 or num == "external":
	tfg_flexible_grip(external_diameter, grip_force, external_grip = True, stop_if_no_force=True)

elif num == 2 or num == "internal_rel":
	tfg_release(internal_reldia)
elif num == 3 or num == "external_rel":
	tfg_release(external_reldia)


else:
	popup("Invalid gripper command", title="Error", error = True,blocking=True)
	halt
end

end