584,837 active members*
5,242 visitors online*
Register for free
Login
Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2009
    Posts
    195

    Part zero sensing marco

    Does any one know if you can make a line of code to move an axis till line is tripped then set machine zero with a math fuction for probe cut ?

    Yes I know they have there automated part zero sensing but it will not let you set the direction of travel for each axis ! From what I have seen mach3 is better at this or more people have add there code !

    Thank you

    Sent from my GT-P5113 using Tapatalk

  2. #2
    Join Date
    Jun 2009
    Posts
    195
    problem solved !!! here is a sample for flashcut users and I add a comparison to mach 3 . I didn't add the messages to my code for if the line in is tripped already
    flashcut way to find inside center . if you use this code you need to set user variables .

    (find x center)
    g31 x2 I4 s1 E0 f5 (refer to user manual for info on g31 setup )
    g92x0.0
    g04 p1
    g31 x-2 I4 s1 E0 f5
    #x1 = #program.x
    #xc1 = #x1 / 2
    g04 p1
    g1 x#xc1 f5

    (find y center)
    g31 y2 I4 s1 E0 f5
    g92y0.0
    g04 p1
    g31 y-2 I4 s1 E0 f5
    #y1 = #program.x
    #yc1 = #y1 / 2
    g04 p1
    g1 y#yc1 f5

    _______________________________

    mach3 way Rem VBScript To center probe inside a pipe

    If GetOemLed (825) <> 0 Then 'Check to see if the probe is already grounded or faulty

    Code "(Probe plate is grounded, check connection and try again)"

    Else

    FeedCurrent = GetOemDRO(818) 'Get the current settings
    XCurrent = GetDro(0)
    YCurrent = GetDro(1)

    Code "G4 P1" 'Pause 1 second to give time to position probe plate
    Code "F4" 'slow feed rate to 4 ipm

    Rem Probe Left

    XNew = Xcurrent - 3 'probe 3 inches to left
    Code "G31 X" &XNew
    While IsMoving() 'wait for the move to finish
    Wend
    XPos1 = GetVar(2000) 'get the probe touch location

    Code "G0 X" &XCurrent 'rapid move back to start point

    Rem Probe Right

    XNew = XCurrent + 3 'probe 3 inches to right
    Code "G31 X" &XNew
    While IsMoving()
    Wend
    XPos2 = GetVar(2000)

    XCenter = (XPos1 + XPos2) / 2 'center is midway between XPos1 and XPos2
    Code "G0 X" &XCenter 'rapid move to the x center location
    While IsMoving ()
    Wend
    Call SetDro (0,0.000)
    Code "G4 P0.25"

    Rem Probe up

    YNew = YCurrent + 3
    Code "G31 Y" &YNew
    While IsMoving()
    Wend
    YPos1 = GetVar(2001)

    Code "G0 Y" &YCurrent

    Rem Probe down

    YNew = YCurrent - 3
    Code "G31 Y" &YNew
    While IsMoving()
    Wend
    YPos2 = GetVar(2001)

    YCenter = (YPos1 + YPos2) / 2

    Rem move To the center

    Code "G0 Y" &YCenter
    While IsMoving ()
    Wend
    Call SetDro (1,0.000)
    Code "G4 P0.25"

    Code "F" &FeedCurrent 'restore starting feed rate

    End If

  3. #3
    Join Date
    Nov 2009
    Posts
    4415

    Re: Part zero sensing marco

    I know this is an old post but is I4 a reference to input 4? If so I assume I can change it to 7 if that is the pin I am using?
    Quote Originally Posted by tony978 View Post
    problem solved !!! here is a sample for flashcut users and I add a comparison to mach 3 . I didn't add the messages to my code for if the line in is tripped already
    flashcut way to find inside center . if you use this code you need to set user variables .

    (find x center)
    g31 x2 I4 s1 E0 f5 (refer to user manual for info on g31 setup )
    g92x0.0
    g04 p1
    g31 x-2 I4 s1 E0 f5
    #x1 = #program.x
    #xc1 = #x1 / 2
    g04 p1
    g1 x#xc1 f5

    (find y center)
    g31 y2 I4 s1 E0 f5
    g92y0.0
    g04 p1
    g31 y-2 I4 s1 E0 f5
    #y1 = #program.x
    #yc1 = #y1 / 2
    g04 p1
    g1 y#yc1 f5

    _______________________________

    mach3 way Rem VBScript To center probe inside a pipe

    If GetOemLed (825) <> 0 Then 'Check to see if the probe is already grounded or faulty

    Code "(Probe plate is grounded, check connection and try again)"

    Else

    FeedCurrent = GetOemDRO(818) 'Get the current settings
    XCurrent = GetDro(0)
    YCurrent = GetDro(1)

    Code "G4 P1" 'Pause 1 second to give time to position probe plate
    Code "F4" 'slow feed rate to 4 ipm

    Rem Probe Left

    XNew = Xcurrent - 3 'probe 3 inches to left
    Code "G31 X" &XNew
    While IsMoving() 'wait for the move to finish
    Wend
    XPos1 = GetVar(2000) 'get the probe touch location

    Code "G0 X" &XCurrent 'rapid move back to start point

    Rem Probe Right

    XNew = XCurrent + 3 'probe 3 inches to right
    Code "G31 X" &XNew
    While IsMoving()
    Wend
    XPos2 = GetVar(2000)

    XCenter = (XPos1 + XPos2) / 2 'center is midway between XPos1 and XPos2
    Code "G0 X" &XCenter 'rapid move to the x center location
    While IsMoving ()
    Wend
    Call SetDro (0,0.000)
    Code "G4 P0.25"

    Rem Probe up

    YNew = YCurrent + 3
    Code "G31 Y" &YNew
    While IsMoving()
    Wend
    YPos1 = GetVar(2001)

    Code "G0 Y" &YCurrent

    Rem Probe down

    YNew = YCurrent - 3
    Code "G31 Y" &YNew
    While IsMoving()
    Wend
    YPos2 = GetVar(2001)

    YCenter = (YPos1 + YPos2) / 2

    Rem move To the center

    Code "G0 Y" &YCenter
    While IsMoving ()
    Wend
    Call SetDro (1,0.000)
    Code "G4 P0.25"

    Code "F" &FeedCurrent 'restore starting feed rate

    End If
    A lazy man does it twice.

  4. #4
    Join Date
    Jun 2009
    Posts
    195

    Re: Part zero sensing marco

    Quote Originally Posted by Fastest1 View Post
    I know this is an old post but is I4 a reference to input 4? If so I assume I can change it to 7 if that is the pin I am using?
    Yes I4 is input 4 .

    Sent from my SAMSUNG-SM-G930A using Tapatalk

Similar Threads

  1. ohmic sensing
    By stirling in forum CNC Machine Related Electronics
    Replies: 19
    Last Post: 07-31-2017, 10:22 AM
  2. Fanuc OM Marco B question.
    By glovebox20 in forum Fanuc
    Replies: 5
    Last Post: 12-03-2013, 03:34 AM
  3. Ohmic Sensing Help
    By rahilm in forum Waterjet General Topics
    Replies: 3
    Last Post: 01-05-2013, 01:32 AM
  4. Marco or Script for toollist
    By camtd in forum NCPlot G-Code editor / backplotter
    Replies: 4
    Last Post: 02-12-2011, 09:05 PM
  5. Missing docs: Marco Wong's 3-Axis Motor Controller
    By tomking505 in forum DIY CNC Router Table Machines
    Replies: 0
    Last Post: 05-25-2010, 05:45 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •