Machsupport Forum

Mach Discussion => VB and the development of wizards => Topic started by: marbles on December 12, 2017, 04:46:50 PM

Title: Auto zero VB script imperial to metric conversion query
Post by: marbles on December 12, 2017, 04:46:50 PM
Hi,
i'm using the script below but wondering how to write the values in metric instead of imperial as the script comes. For example the touchdown material I have is 6mm thick and i need to change the command (2, .060). How should that be written as 6mm?
Thanks for any suggestions


CurrentFeed = GetOemDRO(818) 'Get the current feedrate to return to later
CurrentAbsInc = GetOemLED(48) 'Get the current G90/G91 state
CurrentGmode = GetOemDRO(819) 'Get the current G0/G1 state

If GetOemLed (825)=0 Then 'Check to see if the probe is already grounded or faulty
DoOEMButton (1010) 'zero the Z axis so the probe move will start from here
Code "G4 P3" ' this delay gives me time to get from computer to hold probe in place
Code "G90 G31Z-4. F4" 'probing move, can set the feed rate here as well as how far to move
While IsMoving() 'wait while it happens
Wend
ZProbePos = GetVar(2002) 'get the exact point the probe was hit
Code "G0 Z" &ZProbePos 'go back to that point, always a very small amount of overrun
While IsMoving ()
Wend
Call SetDro (2, .060) ' change .060 to your plate thickness and then adjust for final accuracy
Sleep 200 'Pause for Dro to update.
Code "G1 Z1. F50" 'put the Z retract height you want here, must be greater than the touch plate thickness
While IsMoving ()
Wend
Code "(Z axis is now zeroed)" 'puts this message in the status bar
Code "F" &CurrentFeed 'Returns to prior feed rate
Else
Code "(Z-Plate is grounded, check connection and try again)" 'this goes in the status bar if applicable
End If
If CurrentAbsInc = 0 Then 'if G91 was in effect before then return to it
Code "G91"
End If
If CurrentGMode = 0 Then 'if G0 was in effect before then return to it
Code "G0"
End If   
Title: Re: Auto zero VB script imperial to metric conversion query
Post by: ger21 on December 12, 2017, 05:59:11 PM
Call SetDro (2, 6)
Title: Re: Auto zero VB script imperial to metric conversion query
Post by: marbles on December 12, 2017, 06:04:18 PM
Thanks Gerry!  :)
Title: Re: Auto zero VB script imperial to metric conversion query
Post by: marbles on December 12, 2017, 07:05:59 PM
Call SetDro (2, 6)

Might it be possible just to ask a couple of other questions please Gerry about this so i'm clear.

Am I right in thinking 3 seconds of delay before start?
Code "G4 P3"

Am I right in thinking 100mm of travel before stop is therefor
Code "G90 G31Z-100.

Feed rate 5mm per second, how would I write the value of F?
Code "G90 G31Z-100. F50"

I wish the end mills to retract 20mm how do I input that?
Code "G1 Z1. F50"
Title: Re: Auto zero VB script imperial to metric conversion query
Post by: ger21 on December 12, 2017, 09:12:35 PM
Yes, G4 P3 is Pause 3 seconds.

Code "G90 G31Z-100" means probe down in Z 100mm.

Mach3 works in units/min, so 5mm/sec would be 300mm/min
Code "G90 G31Z-100. F300"

Code "G0 Z20" will rapid to Z= 20mm, which would be 14mm above your plate.