Hi guys I'm trying to use a macro called m300 for my z axis for plasma and downloaded it here.. Plasma - detection of material I'm using mach3 for Cnc and sheetcam for nestings

This is the m300 macro

HeightOfDetect = 20
SpeedOfDetect = 300
Offset = 5
HeightOfTransfer = 2
HeightOfPierce = 5
HeightOfCut = 1
Delay = Param1()

Dim MaterialPos As Double

If (GetOEMDro(186)>HeightOfDetect) Or GetOEMDro(186) Then
code "G00 Z" & HeightOfDetect
While IsMoving()
Wend
End If

message("Detecting of material pos.")
code "G31 Z-10 F" & SpeedOfDetect
While IsMoving()
Wend
If GetOEMDro(186)=-10 Then
message("No material detected")
code "G00 Z" & HeightOfDetect
While IsMoving()
Wend
1: GoTo 1
Else
MaterialPos = GetOEMDro(186) + offset
message("Material detected pos = " & MaterialPos)
code "G00 Z" & MaterialPos + HeightOfTransfer
While IsMoving()
Wend
DoSpinCW()
If Delay>200 Then
code "G00 Z" & MaterialPos + HeightOfPierce
While IsMoving()
Wend
End If
Sleep(Delay+1)
code "G00 Z" & MaterialPos + HeightOfCut
While IsMoving()
Wend
End If

The m300s job is to lower the to torch till the tip touches the metal and closes a micro switch to zero it then reverses back up and opens the micro switch to reverse further up to a curtain distance before firing the plasma

Before I do a test run of the m300 I need to manually zero the z axis in mach3

I'm trying to add the m300 to the post processor of sheetcam so that I can create a g code from my nestings to call in mach3 to perform the m300 in it.

I have added the m300 macro to the macro directory in mach3

My questions are
1)How and where do I add the m300 macro to sheetcam post processor?
2) Are there codes that need to be removed from the sheetcam post processor?
3) is there a code to zero the z axis after the m300 automatically?

This is the only problem I have before building my Cnc table ,help will be highly appreciated.