Welcome to Our Community

Some features disabled for guests. Register Today.

Probe Center

Discussion in 'Control Software' started by dfox1787, Aug 15, 2020.

  1. dfox1787

    dfox1787 New
    Builder

    Joined:
    Nov 2, 2019
    Messages:
    42
    Likes Received:
    7
    Hi Guys

    Im sure i have already posted this but i cant find the original post.

    I am still searching for macro code for my blackox controller to probe center of a hole.

    does anyone have any code i can use?

    thanks
     
  2. Peter Van Der Walt

    Peter Van Der Walt OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Mar 1, 2017
    Messages:
    15,059
    Likes Received:
    4,313
    You'll have to write a Javascript macro, as you need to do maths between the readings

    I don't have an example at hand, but look at CONTROLs source code on Github, inside js/probev2.js there is a hole probe routine part of the Automated XYZ probing routine that uses the hole in our probe to measure endmill diameter that you could use as inspiration
     
  3. dfox1787

    dfox1787 New
    Builder

    Joined:
    Nov 2, 2019
    Messages:
    42
    Likes Received:
    7
    unfortunately im no good at writing code.
    any further assistance would be appreciated.
     
  4. Peter Van Der Walt

    Peter Van Der Walt OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Mar 1, 2017
    Messages:
    15,059
    Likes Received:
    4,313
    What exactly do you want to achieve?

    To probe a hole center you need to know the probe diameter, and then write a sequence of moves to work into the hole and do a diamond shape to find the two centers (X and Y) - might need a Z probe too to make sure probe is at correct depth in hole. What is the hole you want to probe? Fixed location (for example on a fixture) or random piece of pipe mounted upright?

    Will need a lot more details to be able to advise on code examples
     
  5. dfox1787

    dfox1787 New
    Builder

    Joined:
    Nov 2, 2019
    Messages:
    42
    Likes Received:
    7
    its an upright piece of alu pipe. the probe diameter is 6mm
     
  6. Peter Van Der Walt

    Peter Van Der Walt OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Mar 1, 2017
    Messages:
    15,059
    Likes Received:
    4,313
  7. Rob Taylor

    Rob Taylor Master
    Builder

    Joined:
    Dec 15, 2013
    Messages:
    1,470
    Likes Received:
    749
    Depending on the precision required, you also need to be sure that the probe itself is both actually round (or oval, or otherwise of radial symmetry, I suppose, assuming it can't rotate freely) within some reasonable tolerance and of zero runout. Usually tasters/probes have runout adjustment screws to make sure.

    The probing routine itself is fairly simple:

    1) User sets approximate center of hole and appropriate Z height (ie. inside the hole)
    2) grbl probes one direction, say -X, CONTROL records the coordinate returned
    3) grbl probes the opposite direction, +X in this case, CONTROL records that number
    4) CONTROL does X/2 (or rather ((+X) - (-X))/2 + (-X)) and centers itself in X
    5) Repeat 2), 3) and 4) for Y.
    6) With a more reliable center and therefore less tangential force on the probe on the X walls, now re-probe X
    7) If that's significantly different (say, more than 0.1 or 0.2mm away), re-probe Y too.
    8) Done

    Not hard to write in JavaScript if you can get up to speed with the language or know someone who is.
     
  8. dfox1787

    dfox1787 New
    Builder

    Joined:
    Nov 2, 2019
    Messages:
    42
    Likes Received:
    7
    again im not a coder. id pay for a script that works tho
     
  9. Giarc

    Giarc OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Jan 24, 2015
    Messages:
    3,017
    Likes Received:
    1,682
    For $59 you can purchase Estlcam. It already does this. It is what I use. It has all kinds of advanced probing functions and I find the cam portion to be simpler than Fusion 360.

     
    #9 Giarc, Aug 21, 2020
    Last edited: Aug 21, 2020
  10. dfox1787

    dfox1787 New
    Builder

    Joined:
    Nov 2, 2019
    Messages:
    42
    Likes Received:
    7
    interesting. may consider that. like to stick to the open builds software
     
  11. Peter Van Der Walt

    Peter Van Der Walt OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Mar 1, 2017
    Messages:
    15,059
    Likes Received:
    4,313
    We appreciate that. It's already on the todo linked above, will get added to CONTROL very soon, probably next week :) FOR $0 (;
     
  12. Giarc

    Giarc OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Jan 24, 2015
    Messages:
    3,017
    Likes Received:
    1,682
    That will be a great addition.
     
  13. dfox1787

    dfox1787 New
    Builder

    Joined:
    Nov 2, 2019
    Messages:
    42
    Likes Received:
    7
    fantastic very much appreciated.

    the ability to probe inside and outside of circles would be fab
     
  14. Rommell1787

    Builder

    Joined:
    Nov 9, 2020
    Messages:
    17
    Likes Received:
    6
    hey is this still going to be a feature? estlcam looks a great option for flexible probing
     
  15. dfox1787

    dfox1787 New
    Builder

    Joined:
    Nov 2, 2019
    Messages:
    42
    Likes Received:
    7
    any updates on this? :)
     
  16. dfox1787

    dfox1787 New
    Builder

    Joined:
    Nov 2, 2019
    Messages:
    42
    Likes Received:
    7
    thats the outside edge of a circle does it do inside?
     
  17. Peter Van Der Walt

    Peter Van Der Walt OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Mar 1, 2017
    Messages:
    15,059
    Likes Received:
    4,313
    :) I got some stuff to wrap up before Black Fri - thereafter I'll finish it up :) !Sorry
     
  18. dfox1787

    dfox1787 New
    Builder

    Joined:
    Nov 2, 2019
    Messages:
    42
    Likes Received:
    7
    no prbl
    No problem.

    I have tried a few scripts and i cant get any of them to Probe inside a circle pocket.
     
    #18 dfox1787, Nov 19, 2020
    Last edited: Nov 20, 2020
    Peter Van Der Walt likes this.
  19. Giarc

    Giarc OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Jan 24, 2015
    Messages:
    3,017
    Likes Received:
    1,682
    I will try it today if I get a chance. I have never had a reason so I can't say for sure off the top of my head.
     
  20. Giarc

    Giarc OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Jan 24, 2015
    Messages:
    3,017
    Likes Received:
    1,682
    I am sorry this took so long, but I tested it using the hole in my OpenBuilds XYZ probe and it did probe the inside of the circle and find center.
     
  21. Peter Van Der Walt

    Peter Van Der Walt OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Mar 1, 2017
    Messages:
    15,059
    Likes Received:
    4,313
    Finally got to it :)

    upload_2020-12-8_20-25-20.png


    1) Go to Macros tab
    2) Click ADD
    3) Click the Javascript tab, paste the code below:
    4) Give it a name and an icon of your preference, and color, keyboard shortcut, etc if you so wish

    To use, jog endmill into the hole, approx in the center, down into the hole deep enough to make contact with the sides
    - NB NB ensure the sides of the hole are conductive and magnet is on the endmill/collet, the usual
    Can be used for circle, square or rectangular holes, after probing endmill will be in the center of whatever XY edges it found

    Code:
    function findCircleCenter(approxCircleDia, endmillDiameter, probeFeed) {
    
      // var approxCircleDia = 60;
      // var endmillDiameter = 3.175
      // var probeFeed = 200;
    
      var step = 0;
      var rightside = 0,
        leftside = 0,
        farside = 0,
        nearside = 0,
        centerXdistance = 0,
        centerYdistance = 0;
    
      socket.off('prbResult'); // Disable old listeners
    
      var holefindermacroStep1 = `
      ; Header
    
      G21 ; mm mode
      G10 P1 L20 X0 Y0 Z0 ; zero out current location
    
      G38.2 X` + approxCircleDia / 2 + ` F` + probeFeed + ` ; Probe X` // find right side of circle
    
      socket.emit('runJob', {
        data: holefindermacroStep1,
        isJob: false,
        completedMsg: false,
        fileName: ""
      });
    
      socket.on('prbResult', function(prbdata) {
        if (prbdata.state > 0) {
          step++;
          console.log("Step " + step, prbdata);
    
          // Steps 1-3 just positions endmill for probes that count
    
          if (step == 1) {
            rightside = prbdata.x
            console.log(rightside);
    
            var holefindermacroStep5 = `
            G4 P0.3
            G91
            G0 X-1
            G90
            G38.2 X-` + approxCircleDia / 2 + ` F` + probeFeed + ` ; Probe X` // find left side of circle
    
            socket.emit('runJob', {
              data: holefindermacroStep5,
              isJob: false,
              completedMsg: false,
              fileName: ""
            });
          }
    
          if (step == 2) {
            leftside = prbdata.x
            var centerdistance = (rightside - leftside);
            var holefindermacroStep6 = `
            G4 P0.3
            G91
            G0 X` + centerdistance / 2 + `
            G90
            G10 P1 L20 X0
            G38.2 Y` + approxCircleDia / 2 + ` F` + probeFeed + ` ; Probe Y` // find far side of circle
    
            socket.emit('runJob', {
              data: holefindermacroStep6,
              isJob: false,
              completedMsg: false,
              fileName: ""
            });
          }
    
          if (step == 3) {
            farside = prbdata.y
    
            var holefindermacroStep7 = `
            G4 P0.3
            G91
            G0 Y-1
            G90
            G38.2 Y-` + approxCircleDia / 2 + ` F` + probeFeed + ` ; Probe Y` // find near side of circle
    
            socket.emit('runJob', {
              data: holefindermacroStep7,
              isJob: false,
              completedMsg: false,
              fileName: ""
            });
          }
    
          if (step == 4) {
            nearside = prbdata.y
            centerYdistance = (farside - nearside);
            centerXdistance = (rightside - leftside);
            console.log(centerXdistance, centerYdistance)
            var holefindermacroStep7 = `
            G4 P0.3
            G91
            G0 Y` + centerYdistance / 2 + `
            G90
            G10 P1 L20 Y0
            `
    
            socket.emit('runJob', {
              data: holefindermacroStep7,
              isJob: false,
              completedMsg: `Probe Complete: Remove the Probe Clip and Probe GND before continuing... <hr>
              Probed dimension X: ` + (centerXdistance + endmillDiameter).toFixed(3) + `<br>
              Probed dimension Y: ` + (centerYdistance + endmillDiameter).toFixed(3) + `<br>
              <hr>`,
              fileName: ""
            });
          }
    
        } else {
          console.log("Probe Failed")
        }
    
      })
    }
    
    Metro.dialog.create({
      title: "Center Finding Macro",
      content: `
        <div class="row mb-0">
          <label class="cell-sm-6">Maximum Distance between edges</label>
          <div class="cell-sm-6">
              <input id="centerProbeDistance" type="number" value="100" data-role="input" data-append="mm" data-prepend="<i class='fas fa-ruler-combined'></i>" data-clear-button="false">
          </div>
        </div>
    
        <small>This is the approximate diameter of the circle, or the maximum width between edges of the rectangular/square hole you are probing inside</small>
        <hr>
        <div class="row mb-0">
          <label class="cell-sm-6">Endmill Diameter</label>
          <div class="cell-sm-6">
              <input id="centerProbeEndmill" type="number" value="6.35" data-role="input" data-append="mm" data-prepend="<i class='fas fa-arrows-alt-h'></i>" data-clear-button="false">
          </div>
        </div>
        <small>Enter the Endmill Diameter</small>
        <hr>
        <div class="row mb-0">
          <label class="cell-sm-6">Probe Feedrate</label>
          <div class="cell-sm-6">
              <input id="centerProbeFeedrate" type="number" value="100" data-role="input" data-append="mm/min" data-prepend="<i class='fas fa-running'></i>" data-clear-button="false">
          </div>
        </div>
        <small>How fast the probe will move - slower is safer/more accurate</small>
        `,
      actions: [{
          caption: "Run center finding Probe",
          cls: "js-dialog-close success",
          onclick: function() {
            var approxCircleDia = parseFloat($("#centerProbeDistance").val())
            var endmillDiameter = parseFloat($("#centerProbeEndmill").val())
            var probeFeed = parseInt($("#centerProbeFeedrate").val())
            findCircleCenter(approxCircleDia, endmillDiameter, probeFeed)
          }
        },
        {
          caption: "Cancel",
          cls: "js-dialog-close alert",
          onclick: function() {
            //
          }
        }
      ]
    });
    
     

    Attached Files:

    #21 Peter Van Der Walt, Dec 8, 2020
    Last edited: Dec 8, 2020
    Tucstrlly and Mark Carew like this.
  22. Rommell1787

    Builder

    Joined:
    Nov 9, 2020
    Messages:
    17
    Likes Received:
    6
    excellent Peter.

    how do I change the endmill diameter for the script? i don't have the same window above as you. my endmill is 3mm.

    thanks


     

    Attached Files:

  23. Peter Van Der Walt

    Peter Van Der Walt OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Mar 1, 2017
    Messages:
    15,059
    Likes Received:
    4,313
    Finish setting up the macro button, then run it to get the window :)
     
  24. Rommell1787

    Builder

    Joined:
    Nov 9, 2020
    Messages:
    17
    Likes Received:
    6
    that is awesome. ill test this tomorrow too cold in my workshop. thank you so much
     
    Peter Van Der Walt likes this.
  25. sharmstr

    sharmstr OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Mar 23, 2018
    Messages:
    2,059
    Likes Received:
    1,448
    Any way to use the existing probeJogWindow in another dialog? I can get it to appear and works except for it ignores preventDefault. So when you mousedown it will start to jog but then refresh the window. I'm using

    $( '#probeJogWindow' ).clone(true, true).appendTo( '#insertJogWindow' );

    Keyboard jogging works if need be, but I'd really like to get some jog buttons instead without duplicating a bunch of code.
     
  26. Peter Van Der Walt

    Peter Van Der Walt OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Mar 1, 2017
    Messages:
    15,059
    Likes Received:
    4,313
    I think not, since the dialog is straight out of Metro4. But you can pull the jog buttons out into a function or template, send a pull. That would be a useful component to seperate from the probe window itself?
     
  27. sharmstr

    sharmstr OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Mar 23, 2018
    Messages:
    2,059
    Likes Received:
    1,448
    I just realized I posted this in the wrong thread. Sorry.

    I'm not sure if I completely follow, but I was just trying to add the div that contains the jog buttons and not the entire dialog. Not sure it that detail came through. What's interesting is that I actually got it to work by enclosing all of my code, html and functions, etc, into a single var. Then added it with .before. There a several drawbacks to this, the biggest being that visual studio code (or any ide) see's it for what is ... a big string, so you dont get any fancy color coding and autocomplete. LOL. Again, not sure I completely follow you, but if you were asking if you should make the tiny jog controls available to any dialog, then yes, that would be awesome. :) Obviously this is another "Me" request and I'm totally okay without it. I usually spend hours trying to get stuff to work before I ask because I know I'm the only one who wants most of the stuff I do.
     
  28. Peter Van Der Walt

    Peter Van Der Walt OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Mar 1, 2017
    Messages:
    15,059
    Likes Received:
    4,313
    Exactly where i was headed. Useful widget that one, makes sense to make it re-usable :)
     
    sharmstr likes this.
  29. sharmstr

    sharmstr OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Mar 23, 2018
    Messages:
    2,059
    Likes Received:
    1,448
    I got it working! I had everything wrapped in document.ready. Once I removed that, it worked.
     
    Peter Van Der Walt likes this.
  30. Swisscheese

    Builder

    Joined:
    Feb 10, 2024
    Messages:
    5
    Likes Received:
    0
    I'd like to add my vote to have center probing (ID or OD) built in to OB. Finding center without a probe is a real hassle. I need it every time I make something on my lathe and the need to mill onto the face. For example I needed three mounting holes on a flange at the end of turned part. Even probing in all 4 XY directions (not just 2) would help.

    Also, did anyone make a variation of the above macro for OD center probing?
     
    #30 Swisscheese, Apr 21, 2024
    Last edited: Apr 21, 2024

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice