Hello Guest it is October 15, 2019, 01:24:02 PM

Author Topic: Plasma Consumable Tracking  (Read 26106 times)

0 Members and 1 Guest are viewing this topic.

Re: Plasma Consumable Tracking
« Reply #110 on: November 04, 2012, 07:49:41 PM »
XSize1= cStr(GetOemDRO(10))
MsgBox "Current Size is: " & XSize1 'Shows what the current MaxX value for OemDro(59)
Size1 = GetOemDro(10)   'Gets the current size  
Size2 = Question("New Size ?")      'Asks for the NEW scaled size
While Ismoving()
Wend
Scale = (Size2/Size1)         'Calculates the scale factor
While Ismoving()
Wend
SetOemDro(59,Scale)         'Set the X axis scale factor
While Ismoving()
Wend
SetOemDro(60,Scale)         'Set the Y axis scale factor
While Ismoving()
Wend
DoOemButton(160)         'REGEN the toolpath display
While Ismoving()
Sleep(100)
Wend

Why do you need

While Ismoving()
Wend

when your not moving?
« Last Edit: November 04, 2012, 07:52:06 PM by Ya-Nvr-No »
Re: Plasma Consumable Tracking
« Reply #111 on: November 04, 2012, 08:00:21 PM »
As far as I know you really don't as long as nothing is moving. It's just kinda like insurance in case. I'm sure BR549 can give you a better answer.

GL
Re: Plasma Consumable Tracking
« Reply #112 on: November 04, 2012, 08:04:45 PM »
Hey TP.  Among my messing around with some of the stuff, I noticed you had the Auto-Scale Reset Button programed as:

'Macro Button to reset scaling
SetOemDro(59,0)
SetOemDro(60,0)
End

Shouldn't it be:

'Macro Button to reset scaling
SetOemDro(59,1)
SetOemDro(60,1)
End

Otherwise it will give you a "Divide by 0" Error
Because you want a 1:1 aspect normally.

Just thought

GL
« Last Edit: November 04, 2012, 08:07:16 PM by scbrniddvl »
Re: Plasma Consumable Tracking
« Reply #113 on: November 04, 2012, 08:38:26 PM »
TP, First off I made a mistake in the text explanation of the MsgBox line It should read: Shows what the current MaxX value for OemDro(10). Sorry

I have been doing my homework. lol  If I am not mistaken isn't the data reflected by the OemDro(10) value based on the toolpath data derived from the file loaded? According to the Oem  Dro"s number list, OemDro is defined as: "Tool Path In Work Coordinates Maximum X". I have moved the table around, zeroed, not zeroed, set the machine zero at random locations and nothing changes that Dro value.     

Just thinking while learning. LOL in my case that could be dangerous.

GL

Offline BR549

*
  •  6,902 6,902
    • View Profile
Re: Plasma Consumable Tracking
« Reply #114 on: November 04, 2012, 09:13:41 PM »
While Ismoving()  is not just for when Mach3 is physically moving . It is IF mach3 is doing anything other than idleing. 

Used after a SetDro() call makes MACH3 wait until after it does the update to carry on with the script.  SOmetimes without it mach3 will hop right over a group of code.

Best to make it wait than let it have free run without thread sync. AND sometimes even that does not stop it.

The point I was trying to make about the extents IS the putor does not know what axis I am going to choose to master the scaling by. 

(;-) TP

(;-) TP

Offline BR549

*
  •  6,902 6,902
    • View Profile
Re: Plasma Consumable Tracking
« Reply #115 on: November 04, 2012, 09:56:17 PM »
GL you are correct I keep in my head that I use the Max-Min to get size because some of our work 0,0 is not the Lower right but may be center of work then we have to work in all quadrants x+ x- y+ y-  . SOmetimes I gets cornfused. Tha is why we do the double check with Scam AND Mach3 sizes.

(;-) TP

Re: Plasma Consumable Tracking
« Reply #116 on: November 04, 2012, 10:05:25 PM »
TP,  Sounds logical and safe. Takes a lot of screw up variables out. Good show. Still learning. lol

I guess as long as I have questions I'm learning.

Thanks

GL

Offline BR549

*
  •  6,902 6,902
    • View Profile
Re: Plasma Consumable Tracking
« Reply #117 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
« Last Edit: November 05, 2012, 12:51:34 PM by BR549 »

Offline BR549

*
  •  6,902 6,902
    • View Profile
Re: Plasma Consumable Tracking
« Reply #118 on: November 05, 2012, 12:55:04 PM »
NOW be aware that WHEN you rotate the Gcode program that MACH3 does NOT rotate the JOGGING along with it.  You will JOG in the original coord base BUT cut the part in the rotated base.

YES I know, BUT it is what it is.

(;-) TP
Re: Plasma Consumable Tracking
« Reply #119 on: November 05, 2012, 04:11:27 PM »
Sounds good on the G68 rotation. I'll work on that one. I have copied a new version of the M3004 macro for you to look at. It adds the absolute values of both - and + extremes for both axis from the program and calculates the scale factor. I was playing around and it seems to work fine here. Let me know what you think.

 'Macro M3004 Auto Scale Start buttom
Dim Axis As String
Dim Size1 As Double
Dim Size2 As Double
Dim Size3 As Double
Dim Scale As Double
Dim XSize1 As String
Dim YSize1 As String
Dim SAxis As Double
XSize1 = cstr(Abs(GetOemDRO(10)) + Abs(GetOemDro(4))) 'Gets Calculated absolute values of GetOemDro(4) + GetOemDro(10) values in case of negative values
YSize1 = cstr(Abs(GetOemDro(11)) + Abs(GetOemDro(5))) 'Gets Calculated absolute values of GetOemDro(5) + GetOemDro(11) values in case of negative values

Size1 = (Abs(GetOemDro(10))+Abs(GetOemDro(4))) 'Calculates absolute values of GetOemDro(4) + GetOemDro(10) values in case of negative values
Size2 = (Abs(GetOemDro(11))+Abs(GetOemDro(5))) 'Calculates absolute values of GetOemDro(5) + GetOemDro(11) values in case of negative values

MsgBox "Current X Size is: " &XSize1  'Shows what the current Abssolute MaxX value for OemDro(10) + OemDro(4)
While Ismoving()
Wend
MsgBox "Current Y Size is: " &YSize1  'Shows what the current Absolute MaxY value for OemDro(11) + OemDro(5)
While Ismoving()
Wend
Axis = AskTextQuestion ("Which Axis do you want as Scaled Axis?")
Size3 = Question("New Size ?")  'Asks for the NEW scaled size
While Ismoving()
Wend
If Axis = "X" Then
  SAxis = Size1     'Selects absolute value
End If
While Ismoving()
Wend
If Axis = "Y" Then
  SAxis = Size2
End If
While Ismoving()
Wend
Scale = (Size3/SAxis)         'Calculates the scale factor
While Ismoving()
Wend
SetOemDro(59,Scale)         'Set the X axis scale factor
While Ismoving()
Wend
SetOemDro(60,Scale)         'Set the Y axis scale factor
While Ismoving()
Wend
DoOemButton(160)         'REGEN the toolpath display
While Ismoving()
Sleep(100)
Wend

End


GL