Page 1 of 2

corner finder

Posted: Sat Oct 05, 2019 10:46 am
by Charlie.G
i asked this question a while back,I will try again I have gone throught my control box and
modified it from its original configuration it was the same as it was from day one running mach 3
now that I have that cleaned up and all of the acon stuff running correctly. I am interested in making
a macro for a corner finder maybe there is one here somewhere I tried to find it but to no avail.
this is a copy of the one I was using in mach 3:

Sub Main()

' 2010 Circular Pocket Probing Script
' 3-1-11

Dim FRate1, FRate2
Dim DMax, Clearance, EdgeLength, CornerClear
Dim XStart, YStart
Dim PlateOffset, XOffset, YOffset
Dim ZeroYN
Dim ToolNo
Dim ToolD
Dim ProbeD
Dim ProbeLengthX, ProbeLengthY
Dim XNew, XHit1, Xhit2, XEdge, X1, X2
Dim YNew, YHit1, YHit2, YEdge, Y1, Y2

Dim XPos, YPos, EdgeAngle, PocketXLen, PocketYLen, EdgeDelta, XCenter, YCenter

Dim XScale, YScale, ZScale

Dim CurrentAbsInc

Dim CurrentFeed

FRate1 = abs(GetUserDRO(1821))
FRate2 = abs(GetUserDRO(1822))
DMax = abs(GetUserDRO(1823))
PlateOffset = GetUserDRO(1824)
ToolNo = GetCurrentTool()
ToolD = GetToolParam(ToolNo,1)
If GetUserDRO(1829) = 0 then
ProbeD = ToolD
Else
ProbeD = GetUserDRO(1829)
End If
Clearance = abs(GetUserDRO(1825))
XOffset = GetUserDRO(1826)
YOffset = GetUserDRO(1827)
EdgeLength = abs(GetUserDRO(1828))
ProbeLengthY = GetOEMDRO(801) + DMax
XStart = GetOEMDRO(800)
YStart = GetOEMDRO(801)

If GetOEMLED(801) Then ' On = English Measure INCH

CornerClear = 1.5

Else ' Off = Metric Measure MM

CornerClear = 38

End If


If GetOEMLED(1871) Then
ZeroYN=1
Else
ZeroYN=0
End If

CurrentFeed = GetOemDRO(818) ' Get the current feedrate to return to later

CurrentAbsInc = GetOemLED(48) ' Get the current G90/G91 state

'Get Axis Scale factors
XScale = GetOEMDRO(59)
YScale = GetOEMDRO(60)
ZScale = GetOEMDRO(61)

'Set All Axis' Scale to 1
Call SetOEMDRO(59,1)
Call SetOEMDRO(60,1)
Call SetOEMDRO(61,1)
Sleep(250)



'Check for Errors

If GetOemLED(16)<>0 Then ' Check for Machine Coordinates
Message "Please change to working coordinates"
Call SetOEMDRO(59,XScale)
Call SetOEMDRO(60,YScale)
Call SetOEMDRO(61,ZScale)
Sleep(250)
Exit Sub ' Exit if in Machine Coordinates
End If

If GetOemLED(825)<>0 Then
Message "Probe Grounded - Check connection and try again"
Call SetOEMDRO(59,XScale)
Call SetOEMDRO(60,YScale)
Call SetOEMDRO(61,ZScale)
Sleep(250)
Exit Sub ' Exit if probe is tripped
End If


Code "G90"
Sleep(125)



Message "Probing for Y Center....."
Sleep(1000) 'Pause 1 second
Code "F" & FRate1
Sleep(125)
Code "G31 Y" & ProbeLengthY
While IsMoving()
Wend
YHit1 = GetVar(2001)
Y1 = YHit1 + ProbeD/2 'Tool position at probe hit.


If FRate2=0 Then
Code "G0 Y" & YStart
While IsMoving()
Wend
Else
Code "G0 Y" & YHit1 - ProbeD/4
While IsMoving()
Wend
End If


If FRate2<>0 Then
Code "F" & Frate2
Sleep(150)
Code "G31 Y" & ProbeLengthY
While IsMoving()
Wend
YHit1 = GetVar(2001)
Y1 = YHit1 + ProbeD/2 'Tool position at probe hit.

Code "G0 Y" & YStart
While IsMoving()
Wend

End If

ProbeLengthY = YStart-DMax

Code "F" & FRate1
Sleep(125)
Code "G31 Y" & ProbeLengthY
While IsMoving()
Wend
YHit2 = GetVar(2001)
Y2 = YHit2 - ProbeD/2 'Tool position at probe hit.




If FRate2<>0 Then

Code "G0 Y" & YHit2 + ProbeD/4
While IsMoving()
Wend

Code "F" & Frate2
Sleep(150)
Code "G31 Y" & ProbeLengthY
While IsMoving()
Wend
YHit2 = GetVar(2001)
Y2 = YHit2 - ProbeD/2 'Tool position at probe hit.

End If

YPos = (Y1+Y2)/2


If ZeroYN = 1 then
Code "G0 Y" & YPos
While IsMoving()
Wend

SetOEMDRO(801,YOffset)
Sleep(150)
Else

Code "G0 Y" & YStart
While IsMoving()
Wend

End If



YCenter = Cstr(YOffset)


PathLength = Len(YCenter)
For X = 2 To PathLength Step 1
lstring=Mid(YCenter,X,PathLength-X+1)

If Left(lstring,1) = "." Then
LabelLength = X+5
Exit For
End If

Next X

YCenter=Left(YCenter, LabelLength)

Message "Y Center Found.........."
Sleep(150)



'X Probing
'//////////////////////////////


ProbeLengthX = XStart - DMax


Message "Probing for X Center....."
Sleep(250) 'Pause 1/4 second
Code "F" & FRate1
Sleep(125)
Code "G31 X" & ProbeLengthX
While IsMoving()
Wend
XHit1 = GetVar(2000)
X1 = XHit1 - ProbeD/2 'Tool position at probe hit.


If FRate2=0 Then
Code "G0 X" & XStart
While IsMoving()
Wend
Else
Code "G0 X" & XHit1 + ProbeD/4
While IsMoving()
Wend
End If


If FRate2<>0 Then
Message "Slow Probing for X position....."
Sleep(100) 'Pause 1/10 second
Code "F" & Frate2
Sleep(150)
Code "G31 X" & ProbeLengthX
While IsMoving()
Wend
XHit1 = GetVar(2000)
X1 = XHit1 - ProbeD/2 'Tool position at probe hit.

Code "G0 X" & XStart
While IsMoving()
Wend

End If


ProbeLengthX = XStart + DMax


Message "Probing for X Center....."
Sleep(250) 'Pause 1/4 second
Code "F" & FRate1
Sleep(125)
Code "G31 X" & ProbeLengthX
While IsMoving()
Wend
XHit2 = GetVar(2000)
X2 = XHit2 + ProbeD/2 'Tool position at probe hit.


If FRate2=0 Then
Code "G0 X" & XStart
While IsMoving()
Wend
Else
Code "G0 X" & XHit2 - ProbeD/4
While IsMoving()
Wend
End If


If FRate2<>0 Then

Message "Slow Probing for X position....."
Sleep(100) 'Pause 1/10 second
Code "F" & Frate2
Sleep(150)
Code "G31 X" & ProbeLengthX
While IsMoving()
Wend
XHit2 = GetVar(2000)
X2 = XHit2 + ProbeD/2 'Tool position at probe hit.



End If

XPos = (X1+X2)/2



If ZeroYN = 1 then
Code "G0 X" & XPos
While IsMoving()
Wend
SetOEMDRO(800,XOffset)
Sleep(150)
Else

Code "G0 X" & XStart
While IsMoving()
Wend

End If

XCenter = Cstr(XOffset)


PathLength = Len(XCenter)
For X = 2 To PathLength Step 1
lstring=Mid(XCenter,X,PathLength-X+1)

If Left(lstring,1) = "." Then
LabelLength = X+5
Exit For
End If

Next X

XCenter=Left(XCenter, LabelLength)

Message "X Center Found.........."
Sleep(150)









SetUserLabel (9,XCenter)
SetUserLabel (10,YCenter)


Code "F" & CurrentFeed ' Reset to original feed rate


If CurrentAbsInc = 0 Then 'if G91 was in effect before then return to it
Code "G91"
End If

Call SetOEMDRO(59,XScale)
Call SetOEMDRO(60,YScale)
Call SetOEMDRO(61,ZScale)
Sleep(250)

Message "Center Found"

If GetOemLED(1872) Then SetUserLED(1870,0)


End Sub

I don't know if this will work in acorn and I realize that I do not know enough about macros to modify it etc to make it work
thank you,
Charlie

Re: corner finder

Posted: Sat Oct 05, 2019 2:54 pm
by Sword
Here's one that I've been using for years and have set up for Acorn. My plate can be used to set up for inside or outside corners. I'm not near the CNCPC today, but I can post it next week. I have plans for the plate as well. Basically a 5" x 5" 0.5 thick plate with a 2" hole dead center and a fence on one face. Flip flop for inside/outside and plug in on opposite corners.

https://drive.google.com/file/d/1Jif--e ... p=drivesdk

Re: corner finder

Posted: Sun Oct 06, 2019 12:31 pm
by Charlie.G
sword,
thanks for the help..I am interested in what you are doing,
I am curious though to know if the above script I posted from mach would work in centroid.
as I stated before I do not know much about macros, I am trying to learn a bit seems I never have
enough time to sit and study this stuff. I have never needed an inside corner finder. I do not use the outside
one all the time but when you need one you need one.
this is what I use made it a few years ago...

Re: corner finder

Posted: Sun Oct 06, 2019 12:38 pm
by Charlie.G
whoops guess the photos did not attach
20191005_195036.jpg
20191005_195031.jpg
thank you,
Charlie

Re: corner finder

Posted: Sun Oct 06, 2019 2:32 pm
by Sword
Yeah, no, that Mach3 script won't work. You should be able to easily modify mine and set it up on a spare aux button or call it from the MDI. I'll grab it when I get back in the shop.

Re: corner finder

Posted: Sun Oct 06, 2019 5:30 pm
by Charlie.G
Sword,
thank you, I am not sure I know how to modify it to make it work...
I would like to learn I guess we see how it goes.
thank you,
Charlie

Re: corner finder

Posted: Mon Oct 07, 2019 10:39 am
by Sword
Hey Charlie,

Here's that macro. I changed the last part of it so it should work with your corner jig, but test it in a safe non destructive manner to verify. If you read through it, you should be able to figure out how to modify it if needed. It's up to you to be sure it's connected to the properly configured input. When I use mine, I just temporarily connect it to the same input as my moveable Z touch off plate (alligator clip it to my Z touch off plate) and then put it away when finished.

You can apply it to an available Aux button following this tutorial. viewtopic.php?f=61&t=3555

Scott

Re: corner finder

Posted: Mon Oct 07, 2019 7:20 pm
by Charlie.G
sword,
thank you I will give it a try and let you know how it worked out,
thank you again for your help.

Charlie

Re: corner finder

Posted: Sat Nov 09, 2019 1:44 pm
by Mkelcy
I came over from the "Tool Setting Options For Router and Mills" thread. I've looked at Sword's corner setting macro and see that it calls for the probe to be tripped on PLC input 5. Is that the same as the Acorn input 5? The Acorn probe setup guide (and my machine) are setup for the probe tripped signal to be on input 7, which Centriod calls PLC input 7. Should I edit the macro to call for the probe triggered input to be on PLC input 7?

The macro, so far as I can tell, seems to be finding the center of a hole in the detection plate

I'd like to take Sword's macro and modify it to work with the detection plate shown below. Imagine it flipped over and snugged up against the lower left hand corner of a work piece. I'd like to find part X0 and Y0 by jogging over the detector, setting Z0 and then probing in the minus direction to the X "wall" and subtracting half a user specified tool diameter from the probed X to get to part X0, moving positive along X an inch or so, and then probing in the minus direction to the Y "wall" and subtracting half a user specified tool diameter from the probed Y position to arrive at a part Y0. The tool diameter would be supplied each time the macro was run.

Image

I think I can get there, but the first step is to try to understand Sword's macro.

The depths of my ignorance on G-code programming can barely be measured, but I am working on trying to get a basic understanding.

Re: corner finder

Posted: Sun Feb 14, 2021 3:38 pm
by Charlie.G
I have tried this macro and I couldn't get it to work, haven't had time to mess with it but I am going to upgrade to the router version and then I will try this again. When it comes to Macros I don't know much about them but I will give it a shot.
do I need the probing license for this to function?

thank you,
Charlie