Welcome, Guest. Please login or register.
Did you miss your activation email?
June 22, 2018, 07:42:44 PM

Login with username, password and session length
Search:     Advanced search
* Home Help Search Calendar Links Login Register
+  Machsupport Forum
|-+  Support
| |-+  Downloads
| | |-+  MACH TOOL BOX
| | | |-+  Plasma/Router, Macro to travel the PART extents to test material fit.
Pages: 1   Go Down
Print
Author Topic: Plasma/Router, Macro to travel the PART extents to test material fit.  (Read 7135 times)
0 Members and 1 Guest are viewing this topic.
BR549
Mach4 Alpha

Offline Offline

Posts: 6,852


View Profile
« on: June 19, 2010, 11:44:06 PM »

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

    

* M2009.m1s (1.03 KB - downloaded 322 times.)
« Last Edit: June 19, 2010, 11:46:10 PM by BR549 » Logged
budman68
Master of the Custodial Arts, or better known as:
Global Moderator
*
Offline Offline

Posts: 2,363



View Profile
« Reply #1 on: June 20, 2010, 07:22:07 AM »

Excellent work, hope to set up a button and give this a go, thank you for your time and effort-  Smiley

Dave
Logged

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

Dave->    Wink
budman68
Master of the Custodial Arts, or better known as:
Global Moderator
*
Offline Offline

Posts: 2,363



View Profile
« Reply #2 on: June 20, 2010, 07: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
Logged

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

Dave->    Wink
BR549
Mach4 Alpha

Offline Offline

Posts: 6,852


View Profile
« Reply #3 on: June 20, 2010, 11:06:50 AM »

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

Logged
BR549
Mach4 Alpha

Offline Offline

Posts: 6,852


View Profile
« Reply #4 on: June 24, 2010, 07: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

    


Logged
budman68
Master of the Custodial Arts, or better known as:
Global Moderator
*
Offline Offline

Posts: 2,363



View Profile
« Reply #5 on: June 25, 2010, 12: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
Logged

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

Dave->    Wink
BR549
Mach4 Alpha

Offline Offline

Posts: 6,852


View Profile
« Reply #6 on: June 25, 2010, 06: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(;-)

« Last Edit: June 25, 2010, 06:15:47 PM by BR549 » Logged
budman68
Master of the Custodial Arts, or better known as:
Global Moderator
*
Offline Offline

Posts: 2,363



View Profile
« Reply #7 on: June 25, 2010, 08: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  Wink

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
Logged

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

Dave->    Wink
rem300wm
Active Member

Offline Offline

Posts: 50


View Profile
« Reply #8 on: March 21, 2013, 09: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
Logged
Pages: 1   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.20 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!