Hello Guest it is December 09, 2024, 05:48:14 PM

Author Topic: sub routines and/or macro calls  (Read 3320 times)

0 Members and 1 Guest are viewing this topic.

sub routines and/or macro calls
« on: January 05, 2013, 08:21:41 AM »
Does anyone know of a macro call in mach3 for finding height, sides and center of a part using a touch probe. I know Hass and Fadal have something.

Offline BR549

*
  •  6,965 6,965
Re: sub routines and/or macro calls
« Reply #1 on: January 05, 2013, 12:52:50 PM »
You may want to check in the MachToolBox section.

If nothing there suits you check back with a description of what you want it to do.

(;-) TP
Re: sub routines and/or macro calls
« Reply #2 on: January 05, 2013, 07:20:51 PM »
thank you for responding back to me i'm sorry i didin't put down enough info let me try this again,I'm running a Tormach 1100 and would like to know if there is a macro or sub-routine for Mach3 using a touch probe to establish the center of a part - say a dowel or square rod - starting with height of Z,  then outside sides X and Y, compensating for probe tip thickness -  then repositioning to just above the center of the part on Z axis, reseting DRO's to that new center position. I saw on youtube that a Hass and Fadal can accomplish this. When I checked with Tormach support staff, I was told that their version of Mach3 didn't have that ability. Any info would be appreciated.earlier today I heard back from Bob with G-Wazard he gave me a couple things to lookup so i'm following those leads. thanks again for responding back.

Offline BR549

*
  •  6,965 6,965
Re: sub routines and/or macro calls
« Reply #3 on: January 05, 2013, 11:12:08 PM »
OK Here is a macro that should do the trick. You have to program the macro at load time with the use of #vars

#1 = X width of part
#2= Y width of part
#3= Probing Feedrate

You call it as

M175 #1=2 #2=2 #3=50

With that it assumes the part is 2X2 and the Probing feedrate = 50

You place the Probe at the approx center of the part then call the macro. It probes down and finds the Top of Material. Then moves over to X positive and probes for the right side of the part, then Moves back away from the part and  UP and across the part to the opposite side. It then Probes the Left side of the part. Then moves back away from the part and UP. It then moves to the center distance between the 2 sides.

It repeats the same sequences for Y axis  and ends at the center of the X and Y.


AS the standard disclaimer  for probing with macros Your mileage may vary as to how it reacts to your system.  TRY it in the air above the part BEFORE you commit it to actually probing.

IF it crashes your PROBE sorry about that BUT no guaranties. The motion works here and the math works here , BUT (;-)

(;-) TP




'Macro Center of Part

Xwide = GetVar(1)
Ywide = Getvar(2)
Frate = GetVar(3)

If  Xwide = 0  Or Ywide = 0 Or Frate = 0 Then
MsgBox" Mcode  Params not stated, Retry"
End
End If

SetVar(100,Frate)

'Move close to center of part
'Z Probe

Code"F#100"
Code"G31 Z-2"
While Ismoving()
Wend
Code"G92 Z0"
Code"G1 Z.010"
Code"G92 Z0"
While Ismoving()
Wend
Ztop = GetDro(2)
Code"G0Z.5"

' X Probe

Code"G0 X" & (.5 * (Xwide +1))
Code"Z-.5"
Code"G31 X0"
While Ismoving()
Wend
SetVar(101,GetVar(2000))

Code"G0 G91 X1"
Code"G90"
Code"Z.5"
Code"G0 X"&(-1* (.5 * (Xwide +1)))
Code"G0 Z-.5"
Code"G31 X0"
While Ismoving()
Wend
SetVar(102,GetVar(2000))

Code"G0 G91 X-1"
Code"G90"

X1= GetVar(101)
X2= Abs (GetVar(102))
Xcenter = ((X1+X2) /2)
'MsgBox"" &Xcenter

Code"G0 G91 X" & (Xcenter +1)
Code"G90"

'Y Probe

Code"G0 Y" & (.5 * (Xwide +1))
Code"Z-.5"
Code"G31 Y0"
While Ismoving()
Wend
SetVar(201,GetVar(2001))

Code"G0 G91 Y1"
Code"G90"
Code"Z.5"
Code"G0 Y"&(-1* (.5 * (Xwide +1)))
Code"G0 Z-.5"
Code"G31 Y0"
While Ismoving()
Wend
SetVar(202,GetVar(2001))

Code"G0 G91 Y-1"
Code"G90"

Y1= GetVar(201)
Y2= Abs (GetVar(202))
Ycenter = ((Y1+Y2) /2)
'MsgBox"" &Ycenter
Code"G0 G91 Y" & (Ycenter +1)
Code"G90"

Message" Probe at CENTER of MATERIAL"

Code" G92 X0.0000 Y0.0000"
Code" G1 Z" & Ztop
Message " Probe at X0 Y0 Z0 of Part Origin"
Code"#1=0 #2=0 #3=0"
End