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
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
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
Logged Probe: Hole Center · Issue #145 · OpenBuilds/OpenBuilds-CONTROL - will let you know when we get some work done on this. In the meantime refer to Help getting started with Javascript Macros in Control... along with OpenBuilds/OpenBuilds-CONTROL
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.
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.
We appreciate that. It's already on the todo linked above, will get added to CONTROL very soon, probably next week FOR $0 (;
no prbl No problem. I have tried a few scripts and i cant get any of them to Probe inside a circle pocket.
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.
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.
Finally got to it 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() { // } } ] });
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
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.
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?
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.
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?