Machsupport Forum

Support => Downloads => MACH TOOL BOX => Topic started by: BR549 on June 20, 2010, 12:44:06 AM

Title: Plasma/Router, Macro to travel the PART extents to test material fit.
Post by: BR549 on June 20, 2010, 12:44:06 AM
Enclosed is a macro to allow the operator to LOAD a part program then the machine will travel the part extents to allow the operator to SEE if the material is large enough to cut the profile. Good for Routing GREAT for plasma users.

Load Program, then move to a position on the material that looks good for the 0,0 origin. Then run the code. IT WILL ASK you if your Z is in postion to TRAVEL safely, if not it will advise you to correct and then it ends. Correct the z height then restart.
The macro will reset the XY axis to zero, then REGEN the toolpath to correct the extents, retreive the extents values, go to the extents of each corner and wait 3 secs then go to the next, it will end back up at the first corner then move back to 0,0.
IF the spindle/Torch centerline stays on the material then you are good to go AND ready to start the cut.

****************************************************************************8

'Macro To AUTOEXTENTS
Sub main()
 FR = 30      'Sets FeedRate
 DT = 3         'Sets Dwell Time
 Msg="Is Your Z HEIGHT Safe To Travel?"
SetVar(120,FR)
SetVar(121,DT)
Response = MsgBox(Msg, 4 )
If Response = 7 Then
GoTo N3:
Else
GoTo N2:
End If
N2:
DoButton(8)      'ZeroX
Sleep(1000)      
DoButton(9)      'ZeroY
Sleep(1000)
DoOemButton(160)   'Regen ToolPath
Sleep(1000)
SetVar(100,Getoemdro(4))
Sleep(100)
SetVar(101,Getoemdro(10))
Sleep(100)
Setvar(110,Getoemdro(5))
Sleep(100)
Setvar(111,Getoemdro(11))
Sleep(100)
Code"G1 X#100 Y#110 F#120"
While Ismoving()
Sleep(100)
Wend
Code"G4 P#121"
Code"G1 X#100 Y#111 F#120"
While Ismoving()
Sleep(100)
Wend
Code"G4 P#121"
Code"G1 X#101 Y#111 F#120"
While Ismoving()
Sleep(100)
Wend
Code"G4 P#121"
Code"G1 X#101 Y#110 F#120"
While Ismoving()
Sleep(100)
Wend
Code"G4 P#121"
Code"G1 X#100 Y#110 F#120"
While Ismoving()
Sleep(100)
Wend
Code"G4 P#121"
Code"G1 X0.000 Y0.000 F#120"
While Ismoving()
Sleep(100)
Wend
DoButton(1)
DoButton(3)
Goto N4:
N3:
MsgBox("Move Z To A Safe Position And Restart")
GoTo N4:
N4:
End Sub
End

    
Title: Re: Plasma/Router, Macro to travel the PART extents to test material fit.
Post by: budman68 on June 20, 2010, 08:22:07 AM
Excellent work, hope to set up a button and give this a go, thank you for your time and effort-  :)

Dave
Title: Re: Plasma/Router, Macro to travel the PART extents to test material fit.
Post by: budman68 on June 20, 2010, 08:28:20 AM
Ok, already having a problem, it asked about the safe z height and I clicked yes to move on.

Then it sits for about 3 seconds, cycles through the program in the Gcode window but the table doesn't move at all.

Thanks,
Dave
Title: Re: Plasma/Router, Macro to travel the PART extents to test material fit.
Post by: BR549 on June 20, 2010, 12:06:50 PM
NOTICE" Please do not use this code as it has compatibility issues with NEWER version of MACH. It was developed and DOES work here with V.020

Title: Re: Plasma/Router, Macro to travel the PART extents to test material fit.
Post by: BR549 on June 24, 2010, 08:22:35 PM
I just finished up testing a version with V.040 and it seems to work fine "HERE". I run it AS a button code.


 'Macro To AUTOEXTENTS
Sub main()

 FR = 30      'Sets FeedRate
 DT = 3         'Sets Dwell Time
 Msg="Is Your Z HEIGHT Safe To Travel?"
SetVar(120,FR)
SetVar(121,DT)

Response = MsgBox(Msg, 4 )
If Response = 7 Then
GoTo N3:
Else
GoTo N2:
End If
 
N2:

DoButton(8)      'ZeroX
Sleep(1000)      
DoButton(9)      'ZeroY
Sleep(1000)
DoButton(10)
Sleep(1000)
DoOemButton(160)   'Regen ToolPath
Sleep(1000)

Sleep(1000)
SetVar(100,Getoemdro(4))
Sleep(100)
SetVar(101,Getoemdro(10))
Sleep(100)
Setvar(110,Getoemdro(5))
Sleep(100)
Setvar(111,Getoemdro(11))
Sleep(1000)

DoOemButton(169)
Sleep(1000)

Code"G1 X#100 Y#110 F#120"
While Ismoving()
Sleep(100)
Wend
Code"G4 P#121"
Code"G1 X#100 Y#111 F#120"
While Ismoving()
Sleep(100)
Wend
Code"G4 P#121"
Code"G1 X#101 Y#111 F#120"
While Ismoving()
Sleep(100)
Wend
Code"G4 P#121"
Code"G1 X#101 Y#110 F#120"
While Ismoving()
Sleep(100)
Wend
Code"G4 P#121"
Code"G1 X#100 Y#110 F#120"
While Ismoving()
Sleep(100)
Wend
Code"G4 P#121"
Code"G1 X0.000 Y0.000 F#120"
While Ismoving()
Sleep(100)
Wend
DoOemButton(170)
Sleep(1000)

GoTo N4:

N3:
MsgBox("Move Z To A Safe Position And Restart")
GoTo N4:
N4:
End Sub
End

    


Title: Re: Plasma/Router, Macro to travel the PART extents to test material fit.
Post by: budman68 on June 25, 2010, 01:41:29 PM
Thought you might like to know, this is not working for me from a button, but does work with the Editor open, Terry.

Dave
Title: Re: Plasma/Router, Macro to travel the PART extents to test material fit.
Post by: BR549 on June 25, 2010, 07:12:46 PM
HIYA DAVE , AND I thought I had a strange machine(;-) LOLOLOL

It would be nice to KNOW why some machines can run it from button code and some cannot. I guess it has to do with VB thread latency.

I also have a version working from straight GCODE no VB. more than one way to skin a polecat(;-)

Title: Re: Plasma/Router, Macro to travel the PART extents to test material fit.
Post by: budman68 on June 25, 2010, 09:15:19 PM
Hi Terry,

That's just it thought, it happens on both my testing and my machine PCs. I wonder if it's version specific as they're both the same version and since things are running great (KNOCK ON WOOD!) I'm not going to try anything new and different just yet  ;)

Yes, I actually was playing with the idea if I couldn't get it to work, I'd do it in the cam setup.

Dave
Title: Re: Plasma/Router, Macro to travel the PART extents to test material fit.
Post by: rem300wm on March 21, 2013, 10:30:59 AM
Hello to all
Well try Your code and I have a little problem,looks like if there are a lots of arcs in the dxf,the code will give the error of "arc different from arc on line *********" and the extend will only work from this point ,making in essence a small box and not going the full distance of the part.The file for the test has being cut before with out any problems.
I'm using the latest version of Mach 3.43.067.
Any ideas ?
Best Regards
Rem