Z-axis modification using macro
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?
4) anything els that needs to be done?
This is the only problem I have before building my Cnc table ,help will be highly appreciated.
Sent from my iPhone using Tapatalk
Re: Z-axis modification using macro
Im confused. if you are using SheetCAM you can do everything in the POST including adding the values you want set in the UI in SheetCAM.
A touch off and lift to top of material , zero the Z and raise to pierce height is about 4 lines of G-code and no macros. is a super easy snip of code. You have a variable named swtichOffset. It's always in mm if its set in the post as a hard number.there is another variable named refDistance .
Using a Plasma Post like the MP1000-THC, it will have the variables defined and you simply put them in . The touch off stored G-code is a call of a G31 (probe) or G28.1( homing move
All of the code is there in that post and all you have to do is put in the switchOffset and the refDistance (distance between touch off) and it does the rest. You can even enable and disable the THC after the pierce if you want.
The code to zero the Z in MACH is : G92 Z0.00
SheetCAM has built in numbers for each plasma tool for prierce height, pierce delay, cut hight and end of cut delay. You don't have to write macros . Open the Plasma Tools and see the built in numbers and those are passed to the POST and put in the ONPenDown() function
You are using the built in and defined variables in SHeetCAM not MACH
SheetCAM uses LUA language for POST. While it resembles some aspects of VB Script in MACH its not the same. You also need to be aware that Macros running from MACH via a call from the Gcode will cause a motion pause in MACH.
THere is a rich set of POSTS in SheetCAM for MACH
Re: Z-axis modification using macro
Hi torchhead ,thank you for your reply, I'm new to cnc concerning mach3 and sheetcam so I'm not really clued with what you are saying, so this is basically what I've done.
I nested and posted a drawing of a square shape then I edited the tap file by removing a few lines and added the m300 (macro) in order to achieve this z setting
this is how it originally is before editing
N0010 (Filename: Square 1.tap)
N0020 (Post processor: Mach3 plasma.scpost)
N0030 (Date: 01/01/2003)
N0040 G21 (Units: Metric)
N0050 G53 G90 G91.1 G40
N0060 F1
N0070 S500
N0080 (Part: Square)
N0090 (Operation: Outside Offset, 0, T1: Plasma, 1.5 mm kerf)
N0100 M06 T1 F400.0 (Plasma, 1.5 mm kerf)
N0110 G00 Z10.0000
N0120 X33.2000 Y-3.9500
N0130 Z3.0000
N0140 M03
N0150 G04 P0.5
N0160 G01 Z1.5000 F100.0
N0170 G03 X30.0000 Y-0.7500 I-3.2000 J0.0000 F400.0
N0180 G01 X0.0000
N0190 G02 X-0.7500 Y0.0000 I0.0000 J0.7500
N0200 G01 Y30.0000
N0210 G02 X0.0000 Y30.7500 I0.7500 J0.0000
N0220 G01 X30.0000
N0230 G02 X30.7500 Y30.0000 I0.0000 J-0.7500
N0240 G01 Y0.0000
N0250 M05
N0260 G00 Z10.0000
N0270 M05 M30
this is the way i want it to be
N0010 (Filename: Square 2.tap)
N0020 (Post processor: Mach3 plasma.scpost)
N0030 (Date: 01/01/2003)
N0040 G21 (Units: Metric)
N0050 G53 G90 G91.1 G40
N0060 F1
N0070 S500
N0080 (Part: Square)
N0090 (Operation: Outside Offset, 0, T1: Plasma, 1.5 mm kerf)
N0100 M06 T1 F400.0 (Plasma, 1.5 mm kerf)
N0120 X33.2000 Y-3.9500
N0130 M300
N0140 M03
N0170 G03 X30.0000 Y-0.7500 I-3.2000 J0.0000 F400.0
N0180 G01 X0.0000
N0190 G02 X-0.7500 Y0.0000 I0.0000 J0.7500
N0200 G01 Y30.0000
N0210 G02 X0.0000 Y30.7500 I0.7500 J0.0000
N0220 G01 X30.0000
N0230 G02 X30.7500 Y30.0000 I0.0000 J-0.7500
N0240 G01 Y0.0000
N0250 M05
N0260 G00 Z10.0000
N0270 M05 M30
So I removed....
N0110
N0130
N0150
N0160 then added m300 and it works the way I want it to
So my question is is there a way to get sheetcam to post all my tap files like this for every line it cuts?
Thanx.
Re: Z-axis modification using macro
Quote:
Originally Posted by
Bradnicent
So my question is is there a way to get sheetcam to post all my tap files like this for every line it cuts?
Of course it is. You just need to edit the Sheetcam post. Its just a text file.
Re: Z-axis modification using macro
Can the demo/trial version of sheetcam's post proseccor be edited? No matter what I edit or change I can't seem to ge the tap file to change. Everything stays the same
Re: Z-axis modification using macro
It seems if you edit a default POST, it creates a copy so make sure the copy is installed. I think this is to deal with the restrictions WIndows imposes on where you can write files to (eg not into the program files folder
Re: Z-axis modification using macro
So do u suggest I find the actual post files of sheetcam in c drive/sheetcam then copy 1of them somewhere els let's say desk top then rename it ,edit it and import it into sheetcam post processor?
Re: Z-axis modification using macro
Quote:
Originally Posted by
Bradnicent
Can the demo/trial version of sheetcam's post proseccor be edited? No matter what I edit or change I can't seem to ge the tap file to change. Everything stays the same
Yes but if you edit it outside the Post Processor Edit button in SheetCAM it saves it in another location and you mi\ust IMPORT it to the SheeCAM library of Posts. If you change the name and save it as something else and import and use that its a lot easier (and safer) The license has noting to do with the POSTS that are written in an open language called LUA.
Re: Z-axis modification using macro
Ok got it thanx ...
ok so I'm using a post processor called "mach3 flame with THC -G31" ,so after I do a nesting of a basic square shape ,in the tap file after a G04 P0.5 there's a G01 x33.2000 y-3.9500 z1.5 f100 ..... I understand that the x & y are coordinates and z is the up or down movement of the z axis and the f is the feed rate?
In the is post processors I don't see the 1.5 value of z as I want to change this value, I don't see the G01 code after the G04 code, is the a way find and change the z value?
I managed to change the z value in the tap file ,but it wouldn't be sufficient to go and change it every time especially if I have a lot of parts with a lot of holes, I want it to be changed before all pierces
This is the tap file
N0010 (Filename: Square.tap)
N0020 (Post processor: Mach3 flame with THC - G31.scpost)
N0030 (Date: 03/01/2003)
N0040 G21 (Units: Metric)
N0050 G53 G90 G40
N0060 F1
N0070 S500
N0080 (Part: Square)
N0090 (Process: Outside Offset, 0, T1: Plasma, 1.5 mm kerf)
N0100 M06 T1 (Plasma, 1.5 mm kerf)
N0110 G00 X33.2000 Y-3.9500 Z10.0000
N0120 G31 Z 100 F500.0
N0130 G92 Z5.0000
N0140 G00 Z3.0000
N0150 M03
N0160 G04 P0.5
N0170 G01 X33.2000 Y-3.9500 Z1.5000 F100
N0180 G03 X30.0000 Y-0.7500 I-3.2000 J0.0000 F400.0
N0190 G01 X0.0000 F400
N0200 G02 X-0.7500 Y0.0000 I0.0000 J0.7500 F400.0
N0210 G01 Y30.0000 F400
N0220 G02 X0.0000 Y30.7500 I0.7500 J0.0000 F400.0
N0230 G01 X30.0000 F400
N0240 G02 X30.7500 Y30.0000 I0.0000 J-0.7500 F400.0
N0250 G01 Y0.0000 F400
N0260 M05
N0270 G00 Z10.0000
N0280 M05 M30
Is there a way to change the z value of 1.5 to something els in sheetcam post processor?
Re: Z-axis modification using macro
SheetCAM has INTERNAL variables and EXTERNAL (defined by you) it can use. That particular variable is set in the Job Options/ Rapid Height. 1.5mm is not much clearance for rapids
If you open the POST tab in SheetCAm you will see a button that says Post Documentation. it would be a good place to start to understand how the POST and SheetCAM exchange data.