3661
General Mach Discussion / Re: Plasma Consumable Tracking
« on: November 05, 2012, 12:48:57 PM »
OK back to the G68 Coord Rotation Function. I had to break this back out to a 2 part function as the latest ver's do not like my ole SusWHileDo() routine that worked in older versions. AND yes I borrowed that idea "Thanks Stirling".
YOU CAN ONLY USE THIS FUNCTION if you use the G31 to run the TOM routine. The G28.1 version will not work. Brian would have to fix the G28.1 function IF you had to have it that way.
Create 2 screen buttons Part1, Part2.
MOve to the 0,0 point then press the part1 button. Then move to a position on the rotated line you drew. Then press the 2nd button. It should calculate the require rotation angle AND apply it to the G68 and rotate the program for you.
You can then use the Preveiw function to verify it fits.
'Macro Plasma Coord Rotation G68
Dim X1 As Double
Dim X2 As Double
Dim Y1 As Double
Dim Y2 As Double
Dim XL As Double
Dim YL As Double
Dim CRA As Double
Dim RotAng As Double
DoButton(8)
While Ismoving()
Wend
DoButton(9)
While Ismoving()
Wend
X1= GetDro(0)
While Ismoving()
Wend
Y1= GetDro(1)
While Ismoving()
Wend
Setvar(301,X1)
SetVar(302,Y1)
Message"Move To 2nd refrence point and START Part2"
MsgBox "Move To 2nd refrence point and START Part2"
End
##################################################
'Macro For G68 Coord Rotation Part 2
X1= GetVar(301)
Y1=GetVAr(302)
X2= GetDro(0)
While Ismoving()
Wend
Y2= GetDro(1)
While Ismoving()
Wend
XL= (X1-X2)
YL= (Y1-Y2)
While Ismoving()
Wend
CRA= Atn(XL / Yl)
While Ismoving()
Wend
RotAng = ((CRA * 57.2957795)* -1)
MsgBox "Rotation Angle: " & RotAng
Code"G68 X0Y0 R"& RotAng
While Ismoving()
Wend
DoOEMButton(160)
While Ismoving()
Wend
MsgBox "Rotation Complete"
End
YOU CAN ONLY USE THIS FUNCTION if you use the G31 to run the TOM routine. The G28.1 version will not work. Brian would have to fix the G28.1 function IF you had to have it that way.
Create 2 screen buttons Part1, Part2.
MOve to the 0,0 point then press the part1 button. Then move to a position on the rotated line you drew. Then press the 2nd button. It should calculate the require rotation angle AND apply it to the G68 and rotate the program for you.
You can then use the Preveiw function to verify it fits.
'Macro Plasma Coord Rotation G68
Dim X1 As Double
Dim X2 As Double
Dim Y1 As Double
Dim Y2 As Double
Dim XL As Double
Dim YL As Double
Dim CRA As Double
Dim RotAng As Double
DoButton(8)
While Ismoving()
Wend
DoButton(9)
While Ismoving()
Wend
X1= GetDro(0)
While Ismoving()
Wend
Y1= GetDro(1)
While Ismoving()
Wend
Setvar(301,X1)
SetVar(302,Y1)
Message"Move To 2nd refrence point and START Part2"
MsgBox "Move To 2nd refrence point and START Part2"
End
##################################################
'Macro For G68 Coord Rotation Part 2
X1= GetVar(301)
Y1=GetVAr(302)
X2= GetDro(0)
While Ismoving()
Wend
Y2= GetDro(1)
While Ismoving()
Wend
XL= (X1-X2)
YL= (Y1-Y2)
While Ismoving()
Wend
CRA= Atn(XL / Yl)
While Ismoving()
Wend
RotAng = ((CRA * 57.2957795)* -1)
MsgBox "Rotation Angle: " & RotAng
Code"G68 X0Y0 R"& RotAng
While Ismoving()
Wend
DoOEMButton(160)
While Ismoving()
Wend
MsgBox "Rotation Complete"
End