504,467 active members
3,013 visitors online
Register for free
Login
Page 1 of 2 12
Results 1 to 12 of 20
  1. #1
    Registered
    Join Date
    Aug 2009
    Posts
    228

    sensing program zero

    dunno if flashcut is still alive but anyway, i made some gcode to find XYZ stock origin using a touchprobe #ProbeSize should be set in the variables menu to the diameter of the probe tip

    bring the probe tip to within .5/.5/.5 of the edges to check for, set program to zero, run this gcode. it'll end up at 0,0,.2 , setting the tool length of the probe makes it effective 0, i thought about adding a tool change at the top to a preset tool for the probe in the library.

    I7 is the probe line, change for your setup. i ran it about 30 times in a row and i was getting around .0001 or better repeat-ability, also i did notice that the FlashCut Relative XYZ DRO has a math error, if you reset it to 0,0,0 and then keep running and resetting the program original it'll drift over by around .0001 each run) strange stuff.

    It searches Z down, X - to X+ then Y+ to Y-
    (Switch to imperial)
    G20
    (Go to Program Z0)
    G01Z0F5
    (Go to Program X0Y0)
    G01Y0X0F5
    (search z for .5" at feed rate of 1) input line 7
    G31 Z-.5 I7 S1 E0 F1
    (Program.Z is ?)
    (set Program Z to 0, with compensation)
    G92 Z#ProbeSize/2
    (Dwell .5 second)
    G04 P.5
    (Move to Program.Z.1 above part)
    G01Z.1F5
    (Move to Program.X-.3)
    G01X-.3F5
    (Move to Program.Z-.03 below part , maybe use ball size?)
    G01Z-.03F1
    (search X for .5" at feed rate of 1) input line 7
    G31 X.5 I7 S1 E0 F1
    (set Program X to 0, with compensation)
    G92 X-#ProbeSize/2
    (Dwell .5 second)
    G04 P.5
    (move away from part in X)
    G01 X-.2F5
    (Move to Program.Y.4, still below part in Z)
    G01 Y.4F5
    (move into part on X, z is below top)
    G01 X.1F5
    (search Y for -1" at feed rate of 1) input line 7
    G31 Y-1 I7 S1 E0 F1
    (set Program Y to 0, with compensation)
    G92 Y#ProbeSize/2
    (Dwell .5 second)
    G04 P.5
    (move above part)
    G01Z.2F5
    (move over corner)
    G01X0Y0F5

  2. #2
    Registered
    Join Date
    Aug 2009
    Posts
    228

    Re: sensing program zero

    G92 Z#ProbeSize/2 should be G92 Z#0 if you're measuring the over all length of the touch probe and not removing half the size of the ball.

  3. #3
    Gold Member
    Join Date
    Nov 2009
    Posts
    4373

    Re: sensing program zero

    I was just wondering if anyone had done this for FC, thanks.
    A lazy man does it twice.

  4. #4
    Registered
    Join Date
    Mar 2004
    Posts
    359

    Re: sensing program zero

    Quote Originally Posted by Fastest1 View Post
    I was just wondering if anyone had done this for FC, thanks.
    I have made similar routines over the years and use them with Flashcut........ I'd have to look at them to see what methods I used, but I would assume they would look similar to the OP's.
    Chris L

  5. #5
    Gold Member
    Join Date
    Nov 2009
    Posts
    4373

    Re: sensing program zero

    Anything for center finding?
    Quote Originally Posted by datac View Post
    I have made similar routines over the years and use them with Flashcut........ I'd have to look at them to see what methods I used, but I would assume they would look similar to the OP's.
    A lazy man does it twice.

  6. #6
    Registered
    Join Date
    Aug 2009
    Posts
    228

    Re: sensing program zero

    i did a corner finding one, center of a hole and a few others i'll post when i get home.

  7. #7
    Registered
    Join Date
    Aug 2009
    Posts
    228

    Re: sensing program zero

    Code:
    N100 GLOBAL REAL #XC #YC #ZC
    N102 GLOBAL REAL #PX #PY #PX1 #PY1 #PX2 #PY2 #CX #CY #RAD #STEP
    N103 GLOBAL REAL #DXDY
    N103 GLOBAL REAL #DXDY1
    
    N104 (Switch to imperial)
    N106 G20
    
    N108 (switch to the touch probe, set your tool as needed)
    N110 M06 T100
    
    N112 (Go to Program X0Y0)
    N114 G01Y0X0F5
    
    N116 G31 X-1 I7 S1 E0 F1
    
    N118 G01 X#Program.X/2 Y0 F5
    
    N122 (search Y axis to -1 at feed rate of 1 input line 7)
    N124 G31 Y-1 I7 S1 E0 F1
    
    N126 (First point is Program.X.Program.Y)
    N128 #PX = #Program.X
    N130 #PY = #Program.Y
    
    (N131 M00 #PX & " " & #PY
    
    N132 (Step back slightly to take probe off surface)
    N133 G01 X#Program.X/3 Y#Program.Y/2 F5
    
    N138 (search Y axis to 2 at feed rate of 1 input line 7)
    N140 G31 Y.5 I7 S1 E0 F1
    
    N142 (Second point is Program.X.Program.Y)
    N144 #PX1 = #Program.X
    N146 #PY1 = #Program.Y
    
    (N147 M00 #PX1 & " " & #PY1
    
    N149 G01 X#PX/3 Y#Program.Y/3 F5
    
    N154 (search X axis to 2 at feed rate of 1 input line 7)
    N156 G31 X2 I7 S1 E0 F1
    
    N158 (Third point is Program.X.Program.Y)
    N160 #PX2 = #Program.X
    N162 #PY2 = #Program.Y
    
    (N163 M00 #PX2 & " " & #PY2
    
    N164 (Go to Program X0Y0)
    N166 G01Y0X0F5
    
    IF [#PX1 - #PX] = 0 THEN 
    #PX1  = #PX1 + 0.0001
    ENDIF
    
    IF [#PX2 - #PX1] = 0 THEN 
    #PX2  = #PX2 + 0.0001
    ENDIF
    
    IF [#PY1 - #PY] = 0 THEN 
    #PY1  = #PY1 + 0.0001
    ENDIF
    
    IF [#PY2 - #PY1] = 0 THEN 
    #PY2  = #PY2 + 0.0001
    ENDIF
    
    
    #DXDY = [#PY1 - #PY] / [#PX1 - #PX]
    
    N174 #DXDY1=[[#PY2]-[#PY1]]/[[#PX2]-[#PX1]]
    
    (M00 #DXDY & " " & #DXDY1
    
    IF [#DXDY1 + #DXDY] = 0 THEN
    M00 "Either lines are on same coord or too small area"
    ENDIF
    
    N176 #CX=[[[#DXDY]*[#DXDY1]]*[[#PY]-[#PY2]]+[[#DXDY1]*[[#PX]+[#PX1]]]-[[#DXDY]*[[#PX1]+[#PX2]]]]/[[2.]*[[#DXDY1]-[#DXDY]]]
    N178 #CY=[[-1.]/[#DXDY]]*[[#CX]-[[#PX]+[#PX1]]/[2.]]+[[#PY]+[#PY1]]/[2.]
    
    (N180 #RAD=[SQRT[[[[#PX1]-[#CX]]*[[#PX1]-[#CX]]]+[[[#PY1]-[#CY]]*[[#PY1]-[#CY]]]]]*[2.]
    
    N182 M00 #CX & " " & " " & #CY & " " & #RAD
    N183 M00 #PX & " " & #PY & "; " & #PX1 & " " & #PY1 & "; " & #PX2 & " " & #PY2
    
    N184 M00

  8. #8
    Registered
    Join Date
    Aug 2009
    Posts
    228

    Re: sensing program zero

    Code:
    (Probe Left/Back set as program zero, move to Right/Front, set program zero to half/current position)
    
    GLOBAL REAL #XWidth
    GLOBAL REAL #YWidth
    
    GLOBAL REAL #XCenter
    GLOBAL REAL #YCenter
    
    GLOBAL STRING #Message
    
    #XWidth = 0
    #YWidth = 0
    
    #XCenter = 0
    #YCenter = 0
    
    (Switch to imperial)
    G20
    M06 T100
    
    (Go to Program Z0)
    G01Z0F5
    
    (Go to Program X0Y0)
    G01Y0X0F12
    
    (search z for .5" at feed rate of 1) input line 7
    G31 Z-.5 I7 S1 E0 F1
    
    (Program.Z is ?)
    (set Program Z to 0, no compensation since its the bottom of the probe, not the middle)
    G92 Z0
    
    (Dwell .1 second)
    G04 P.1
    
    (Move to Program.Z.1 above part)
    G01Z.1F20
    
    (Move to Program.X-.3, since origin is rough)
    G01X-.3F20
    
    (Move to Program.Z-.03 below part , maybe use ball size + ?)
    G01Z-.07F20
    
    (fast search X for .5" at feed rate of 6) input line 7
    G31 X.5 I7 S1 E0 F5
    
    (quickly step back a tad)
    G01 X#Program.X - .1F20
    
    (slow search X for .5" at feed rate of 1) input line 7
    G31 X.15 I7 S1 E0 F1
    
    (set Program X to 0, with compensation)
    G92 X-#Probe1SizeL/2
    
    (move away from part in X)
    G01 X-.2F20
    
    (Move to Program.Y, still below part in Z)
    G01 Y.2F20
    
    (move into part on X, z is below top)
    G01 X.1F20
    
    (fast search Y for -1" at feed rate of 6 input line 7 )
    G31 Y-1 I7 S1 E0 F6
    
    (move back away from part)
    G01 Y#Program.Y + .1 F12
    
    (slow search Y for .15" at feed rate of 1 input line 7 )
    G31 Y-.15 I7 S1 E0 F1
    
    (set Program Y to 0, with probe ball compensation)
    G92 Y#Probe1SizeL/2
    
    (move back away from part)
    G01 Y#Program.Y + .1 F12
    
    (move above part)
    G01Z.2F20
    
    (move over RoughX,RoughY guessed size of box at F5)
    G01 X#RoughX Y-#RoughY/2 F40
    
    (move down to below edge of part)
    G01Z-.07F20
    
    (fast search for X2, search for -1 in X)
    G31 X-1 I7 S1 E0 F6
    
    (move out a tad)
    G01 X#Program.X + .1 F12
    
    (slow search)
    G31 X-.2 I7 S1 E0 F1
    
    ( size of object in X , these fail when not in simulator mode)
    #XWidth = #Program.X - #Probe1SizeL/2
    #XCenter = #XWidth/2
    
    (move away from x in positive direction)
    G01 X#Program.X + .2 F12
    
    ( this moves XY and Z for some reason in simulator? )
    G01Z.2F20
    
    (Move to Program.Y-.4, still below part in Z)
    G01 X#RoughX/2 Y-#RoughY F40
    
    (move into part on X, z is below top)
    G01Z-.07F12
    
    (search Y for 1" at feed rate of 6 input line 7)
    G31 Y.1 I7 S1 E0 F6
    
    G01 Y#Program.Y-.1 F12
    
    (search Y for 1" at feed rate of 1 input line 7)
    G31 Y.1 I7 S1 E0 F1
    
    ( size of object in Y  - #Probe1SizeL/2)
    #YWidth = #Program.Y + #Probe1SizeL/2
    
    (away from part)
    G01 Y#Program.Y - .1F12
    
    #YCenter = #YWidth/2
    
    (move z above part)
    G01Z.2F12
    
    G01 X#XCenter Y#YCenter F40
    
    (update screen)
    #XWidth1 = #XWidth
    #YWidth1 = #YWidth

  9. #9
    Registered
    Join Date
    Aug 2009
    Posts
    228

    Re: sensing program zero

    rectangle center

    i remoted in and pulled them off the cnc machine, but i'll add notes when i can

    Code:
    GLOBAL REAL #PX #PY #PX1 #PY1
    GLOBAL REAL #CX #CY
    
    (Switch to imperial)
    G20
    
    (switch to the touch probe, set your tool as needed)
    M06 T100
    
    (Go to Program X0Y0)
    G01Y0X0F5
    
    G31 X-1 I7 S1 E0 F1
    #PX = #Program.X
    G01 X#Program.X+0.08 F1
    
    G31 Y-1 I7 S1 E0 F1
    #PY = #Program.Y
    
    G01 Y#Program.Y+0.08 F1
    
    G31 Y.5 I7 S1 E0 F1
    #PY1 = #Program.Y
    
    G01 Y#Program.Y-0.08 F1
    
    G31 X2 I7 S1 E0 F1
    #PX1 = #Program.X
    
    G01Z.2F5
    
    M00 #PX & " " & #PY  & #PX1 & " " & #PX1
    
    
    #CX = #PX1 - #PX 
    #CY = #PY1 - #PY  
    
    #CX = #CX /2
    #CY = #CY /2
    
    #CX = #PX + #CX
    #CY = #PY + #CY
    
    G01 X#CX Y#CY
    
    M00 #CX & " " & #CY

  10. #10
    Registered
    Join Date
    Mar 2004
    Posts
    359

    Re: sensing program zero

    Quote Originally Posted by Fastest1 View Post
    Anything for center finding?
    Below is what I use for center finding... note that I have one on the machine that runs this twice in a row for holes. Doing it twice gave me more assurance and accuracy. Also note, you need to install the #ProbeSize reference and Probe Diameter in the Variables Table.

    ------------------------------------

    (Probe Hole Center - Tested)
    (X-Y Center Hole Probe Routine)
    (Start program in center area of opening, .050 Down Z into Hole)
    (Seek travel distance is 2" in each axis - adjustable in G31 lines below)
    (#ProbeSize is set in Variables)
    G90
    G20
    G01 X0 Y0 Z0 F8
    (Find X Center)
    G31 X-2 I1 S1 E0 F8
    G92 X0.0
    G01 X#ProbeSize / 2 F8
    /G04 P.2
    G31 X2 I1 S1 E0 F8
    #x1 = #Program.X
    #xc1 = #x1 / 2
    /G04 P.2
    G1 X#xc1 F8
    G92 X0.0
    (Find Y Center)
    G31 Y-2 I1 S1 E0 F8
    G92 Y0.0
    G01 Y#ProbeSize / 2 F8
    /G04 P.2
    G31 Y2 I1 S1 E0 F8
    #y1 = #Program.Y
    #yc1 = #y1 / 2
    /G04 P.2
    G1 Y#yc1 F8
    G92 Y0.0
    G01 Z0.200
    G92 Z0
    M00 "Remember to set Z Zero for tooling"
    M99

    -------------------------------------------------------------------
    Chris L

  11. #11
    Gold Member
    Join Date
    Nov 2009
    Posts
    4373

    Re: sensing program zero

    Though it could definitely be user error. I get an error in FC before even starting with this code. I did edit it to be the correct input line. The probe diameter is set in my touch probe settings. Is there something else I am missing? I am having some luck with charliex's
    Quote Originally Posted by datac View Post
    Below is what I use for center finding... note that I have one on the machine that runs this twice in a row for holes. Doing it twice gave me more assurance and accuracy. Also note, you need to install the #ProbeSize reference and Probe Diameter in the Variables Table.

    ------------------------------------

    (Probe Hole Center - Tested)
    (X-Y Center Hole Probe Routine)
    (Start program in center area of opening, .050 Down Z into Hole)
    (Seek travel distance is 2" in each axis - adjustable in G31 lines below)
    (#ProbeSize is set in Variables)
    G90
    G20
    G01 X0 Y0 Z0 F8
    (Find X Center)
    G31 X-2 I1 S1 E0 F8
    G92 X0.0
    G01 X#ProbeSize / 2 F8
    /G04 P.2
    G31 X2 I1 S1 E0 F8
    #x1 = #Program.X
    #xc1 = #x1 / 2
    /G04 P.2
    G1 X#xc1 F8
    G92 X0.0
    (Find Y Center)
    G31 Y-2 I1 S1 E0 F8
    G92 Y0.0
    G01 Y#ProbeSize / 2 F8
    /G04 P.2
    G31 Y2 I1 S1 E0 F8
    #y1 = #Program.Y
    #yc1 = #y1 / 2
    /G04 P.2
    G1 Y#yc1 F8
    G92 Y0.0
    G01 Z0.200
    G92 Z0
    M00 "Remember to set Z Zero for tooling"
    M99

    -------------------------------------------------------------------
    A lazy man does it twice.

  12. #12
    Gold Member
    Join Date
    Nov 2009
    Posts
    4373

    Re: sensing program zero

    Btw, Thank You both. I am going to be enjoying this machine soon.
    A lazy man does it twice.

Page 1 of 2 12

Similar Threads

  1. ohmic sensing
    By stirling in forum General CNC Machine Related Electronics
    Replies: 19
    Last Post: 07-31-2017, 10:22 AM
  2. Ohmic Sensing Help
    By rahilm in forum General Waterjet
    Replies: 3
    Last Post: 01-05-2013, 01:32 AM
  3. Current sensing switch...
    By WilliamD in forum General CNC Machine Related Electronics
    Replies: 7
    Last Post: 04-23-2009, 05:11 AM
  4. Current sensing on stepper
    By originator in forum General CNC Machine Related Electronics
    Replies: 6
    Last Post: 12-01-2006, 09:48 AM
  5. LM3914 Low voltage sensing?
    By DennisCNC in forum General CNC Machine Related Electronics
    Replies: 6
    Last Post: 03-19-2006, 04:08 AM

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
  •