Hello Guest it is March 29, 2024, 05:33:05 AM

Author Topic: Macro, Probing Center of circle with Diameter  (Read 6435 times)

0 Members and 1 Guest are viewing this topic.

vmax549

*
Macro, Probing Center of circle with Diameter
« on: March 28, 2009, 04:28:00 PM »
Here is a mcro that will probe for the center of a circle and return the Diameter value.

To use move the probe into position inside of the hole and use M1055. It can be used from a Gcode file or the MDI line or be called from a button code. 

It will do a 4 point probe and return to the center. It will also return you the diameter.

Note:  To be accurate you must use the probe tip diam DRO on the settings page to set the tip diameter.  If you do not set the diameter the probe will still return to the center point but the diameter will be off the amount of the probe tip value.

The returned diam value CAN also be piped over to another process if needed.


CODE EXAMPLE:

'(M1055) Center Of Circle With Diamter
setvar(2000,0)
setvar(2001,0)
setvar(1,0)
setvar(2,0)
setvar(3,0)
setvar(4,0)
setvar(5,0)
setvar(6,0)
setvar(7,0)
setvar(8,0)
Setvar(9,0)
tmc=getoemdro(221)
setvar(9,(tmc/2))
Code "G91"
Code "G31X-10 F5"
While Ismoving()
'sleep(10)
Wend
Code"G1x.020"
Code"#1=#2000"
Code"G31x20 f5"
While Ismoving()
'Sleep(10)
Wend
Code"#2 =#2000"
Code"#3=[#1-#2]"
code"#7=[#3/2]"
Code"G1x[#7+#9]"
Code"G31Y10 f5"
While Ismoving()
'Sleep(10)
Wend
Code"#4=#2001"
Code"G1y-.020"
Code"G31y-20 f5"
While ISmoving()
'Sleep(10)
Wend
Code"#5 =#2001"
Code"#6 =[#4-#5]"
code"#8 =[#6/2]"
Code"G1y[#8-#9]"
While Ismoving()
'Sleep(10)
Wend
Code"G90 M30"
HD= Getvar(6)
 
MsgBox ("Hole Diameter is " & HD)

« Last Edit: March 28, 2009, 04:31:27 PM by vmax549 »