Jump to content

Threading Calculation


randominetdude
 Share

Recommended Posts

 Here is a little simple GUI I made for my work. This GUI calculates the amount of manual rotation needed to get the type of threading wanted.

Length is how many Inches of threading you want, and the combo box is the type of threading.

Push enter and it gives you the amount of manual rotations. Not crazy cool, but I figured someone else might be able to use it/improve on it.

:)

#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <ComboConstants.au3>


HotKeySet("`","stop")
GUICreate("Threading Calculation V.2",700,330)

#Region Buttons
$a0=GUICtrlCreateButton("0",20,260,110,50)
$a1=GUICtrlCreateButton("1",20,200,50,50)
$a2=GUICtrlCreateButton("2",80,200,50,50)
$a3=GUICtrlCreateButton("3",140,200,50,50)
$a4=GUICtrlCreateButton("4",20,140,50,50)
$a5=GUICtrlCreateButton("5",80,140,50,50)
$a6=GUICtrlCreateButton("6",140,140,50,50)
$a7=GUICtrlCreateButton("7",20,80,50,50)
$a8=GUICtrlCreateButton("8",80,80,50,50)
$a9=GUICtrlCreateButton("9",140,80,50,50)
$ad=GUICtrlCreateButton(".",140,260,50,50)
$ae=GUICtrlCreateButton("Enter",200,140,50,170)
$ab=GUICtrlCreateButton("Clear",200,80,50,50)
#EndRegion

GUISetFont(25)
$put1=GUICtrlCreateCombo("4-40",20,20,180,50,$CBS_DROPDOWNLIST)
GUICtrlSetData($put1,"6-32|8-32|10-32|1/8-27|1/4-20|1/4-18|3/8-18","4-40")
GUICtrlCreateLabel("Length",320,20)
GUISetFont(30)
$input=GUICtrlCreateInput("",320,70,360,50)
GUICtrlCreateLabel("=",320,200,50,40)
$var="0"
$an=GUICtrlCreateLabel($var&@cr&"Rotations",350,200,360,200)
GUISetState(@SW_SHOW,"Threading Calculation V.2")

#Region Calc GUI
While 1
$get=GUIGetMsg()
Switch $get
    Case $GUI_EVENT_MINIMIZE
        TrayTip("Minimized","Threading Calc Running",10,2)
        WinWait("Threading Calculation V.2")
    Case $GUI_EVENT_CLOSE
        Exit
    Case $a0
        GUICtrlSetData($input,0,"Input")
    Case $a1
        GUICtrlSetData($input,1,"Input")
    Case $a2
        GUICtrlSetData($input,2,"Input")
    Case $a3
        GUICtrlSetData($input,3,"Input")
    Case $a4
        GUICtrlSetData($input,4,"Input")
    Case $a5
        GUICtrlSetData($input,5,"Input")
    Case $a6
        GUICtrlSetData($input,6,"Input")
    Case $a7
        GUICtrlSetData($input,7,"Input")
    Case $a8
        GUICtrlSetData($input,8,"Input")
    Case $a9
        GUICtrlSetData($input,9,"Input")
    Case $ad
        GUICtrlSetData($input,".","Input")
    Case $ae
        $info=GUICtrlRead($input)
        $type=GUICtrlRead($put1)
        $num=StringRight($type,2)
        $factor=1/$num
        $var1=$info/$factor
        $var=Round($var1,3)
        GUICtrlDelete($an)
        $an=GUICtrlCreateLabel($var&@cr&"Rotations",350,200,360,200)
    Case $ab
        GUICtrlSetData($input,"")
        GUICtrlDelete($an)
        $var=0
        $an=GUICtrlCreateLabel($var&@cr&"Rotations",350,200,360,200)
EndSwitch
WEnd
#EndRegion

Func stop()
    Exit
EndFunc
Edited by randominetdude
Link to comment
Share on other sites

Sorry xD  I don't know specific details was only given a  math formula, but I will try and explain - the floor is given brass/copper tubing and told what type of threading to add and how long. They pick the type through the combo box, then add the length so it give they how many times to rotate the tool without having to doodle on paper or open the calculator.

(unfortunately these people are not the brightest and cannot for the life of them navigate computers)

Does this help at all? I hope so -- this is the best I would be able to explain it haha

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...