Hello Guest it is March 29, 2024, 03:25:07 AM

Author Topic: Plasma/Router, Macro to travel the PART extents to test material fit.  (Read 10959 times)

0 Members and 1 Guest are viewing this topic.

Offline BR549

*
  •  6,965 6,965
    • View Profile
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

    
« Last Edit: June 20, 2010, 12:46:10 AM by BR549 »

Offline budman68

*
  • *
  •  2,352 2,352
    • View Profile
Excellent work, hope to set up a button and give this a go, thank you for your time and effort-  :)

Dave
----------------------------------------------------------------------
Just because I'm a Global Moderator, don't assume that I know anything !

Dave->    ;)

Offline budman68

*
  • *
  •  2,352 2,352
    • View Profile
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
----------------------------------------------------------------------
Just because I'm a Global Moderator, don't assume that I know anything !

Dave->    ;)

Offline BR549

*
  •  6,965 6,965
    • View Profile
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

Offline BR549

*
  •  6,965 6,965
    • View Profile
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

    


Offline budman68

*
  • *
  •  2,352 2,352
    • View Profile
Thought you might like to know, this is not working for me from a button, but does work with the Editor open, Terry.

Dave
----------------------------------------------------------------------
Just because I'm a Global Moderator, don't assume that I know anything !

Dave->    ;)

Offline BR549

*
  •  6,965 6,965
    • View Profile
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(;-)

« Last Edit: June 25, 2010, 07:15:47 PM by BR549 »

Offline budman68

*
  • *
  •  2,352 2,352
    • View Profile
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
----------------------------------------------------------------------
Just because I'm a Global Moderator, don't assume that I know anything !

Dave->    ;)
Re: Plasma/Router, Macro to travel the PART extents to test material fit.
« Reply #8 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