1
General Mach Discussion / Calculating Tool length + setting hight.
« on: December 08, 2017, 05:35:39 AM »
Hi,
I am Simon, pretty new to this forum and working with my own 4-axis CNC-mill running on mach3 mill.
As i am trying to write a macro to calculate the tool length and setting the Z level for the current tool i am struggeling with some issuess.
The machine needs to touch a gage with a fix point on the spindle, the moves the mill point above the gage and touch again, the difference of these 2 hights +75mm should be the distance from the mill point to the turning axis of my spindle.
In this part i already succeded.
The sad truth is i failed in the most simple part
when the mill point hits the probe it needs to write all the settings and move +10, for this movement i used Code "G90 Z +10 F5000"
Next thing that happend is the machine that goes down instead of up and destroys my gage.
How is this possible and how can i prevent it of doing this?
Under this post you can find my code.
Thanks for the help
Simon
I am Simon, pretty new to this forum and working with my own 4-axis CNC-mill running on mach3 mill.
As i am trying to write a macro to calculate the tool length and setting the Z level for the current tool i am struggeling with some issuess.
The machine needs to touch a gage with a fix point on the spindle, the moves the mill point above the gage and touch again, the difference of these 2 hights +75mm should be the distance from the mill point to the turning axis of my spindle.
In this part i already succeded.
The sad truth is i failed in the most simple part
when the mill point hits the probe it needs to write all the settings and move +10, for this movement i used Code "G90 Z +10 F5000"
Next thing that happend is the machine that goes down instead of up and destroys my gage.
How is this possible and how can i prevent it of doing this?
Under this post you can find my code.
Thanks for the help
Simon
Code: [Select]
ZCurrent = GetOemDro(802) 'OEM DROs (802)=Z DRO
GageH = GetOEMDRO(1001) 'OEMDRO(1001)= hoogte Probe
ZNew = ZCurrent - 100 'Probe 100mm naar beneden
Dim ZBlock
Dim ZFrees
Dim Hhoogte
Code "G53 X190 Y190 F5000" 'verplaatsen naar ProbeBlockPositie
While IsMoving ()
Sleep(10)
Wend
Code "F500"
Code "G31 Z " &ZNew 'Beweging naar Gage
While IsMoving ()
Sleep(10)
Wend
ZBlock = (GetOemDro(802)) 'Hoogte wegschrijven als ZBlock
Code "G90 Z +70 F5000" 'beweeg naar veilige Hoogte
While IsMoving ()
Sleep(10)
Wend
Code "G90 Y +86" 'Beweeg spindel boven Gage
While IsMoving ()
Sleep(10)
Wend
Code "F500"
Code "G31 Z" &ZNew 'Beweging naar Gage
While IsMoving ()
Sleep(10)
Wend
ZFrees = (GetOemDro(802)) 'hoogte wegschrijven als ZFrees
Hhoogte = ((ZBlock*-1) - (ZFrees*-1) + 75)
Call SetDro (2,GageH) 'DRO(2)=Z DRO
Code "G90 Z +50 F5000"
MsgBox("H = " & Hhoogte)