Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: shag on May 11, 2012, 10:44:07 PM

Title: m03 floating head programing
Post by: shag on May 11, 2012, 10:44:07 PM
I need some help programing the m03 macro

I want my torch to come down and touch the plate until the switch is triggered then retract to Pierce height.

I have my switch connected to the mach3 probe input

I guess I need to know
how to make the torch move up and down
how to read the switch
how to zero the z axis
How to put a value into the z axis

Any help would be greatly appreciated
Title: Re: m03 floating head programing
Post by: BR549 on May 11, 2012, 11:25:08 PM
You really don't want it to do it EVERY time the M3 is called(;-) do you??? You will spend more time finding the TOM than cutting.

Just a thought, (;-) TP

Title: Re: m03 floating head programing
Post by: shag on May 11, 2012, 11:28:13 PM
I am cutting some thin plate that warps so yes I want to set my z axis to proper Pierce height every time
Title: Re: m03 floating head programing
Post by: shag on May 11, 2012, 11:31:28 PM
I have a proma Thc so I do not have a problem with cutting just tired of having to baby sit the machine when making multiple cuts
Title: Re: m03 floating head programing
Post by: BR549 on May 12, 2012, 12:03:57 AM
This should get you close to what you wanted. You will have to adjust the switch offset to match your machine and the Feedrate to what you want.

'M3 Macro for TOM G31 Version
Cfr = GetDro(18)
Code"G31 Z-5 F20"
While Ismoving()
Wend
Code"G92 Z0"
While Ismoving()
Wend
Code"G0 Z .080"     'Switch offset
While Ismoving()
Wend
Code"G92 Z0.000"
While Ismoving()
Wend
COde" G0 Z0.120"    'Pierce Height
While Ismoving()
Wend
SetDro(18,Cfr)
While Ismoving()
Wend
DoOemButton(110)  'Fires Torch reset THC height
END

Title: Re: m03 floating head programing
Post by: shag on May 12, 2012, 12:08:15 AM
Thank you
Title: Re: m03 floating head programing
Post by: shag on May 12, 2012, 11:41:12 PM
The code worked perfectly. Thank you so much
Title: Re: m03 floating head programing
Post by: Tony Spencer on May 13, 2012, 10:05:40 AM
Hi
Re MO3 macro, could the G31 be replaced with G28.1 ? I have read that the G28.1 might be better in this sort of routine. Do you have a G28.1 version of the macro?
I am new to plasma and any help would be appreciated.
Title: Re: m03 floating head programing
Post by: BR549 on May 13, 2012, 10:27:05 AM
YES the G28.1 can be used BUT with a G31 routine you can STILL have the Z home to the top AND the G68 part rotation will work. With the G28.1 method those 2 functions will not work.

G28.1 version

'M3 Macro for TOM G31 Version
Cfr = GetDro(18)
Code"G28.1 Z0 "
While Ismoving()
Wend
Code"G92 Z0"
While Ismoving()
Wend
Code"G0 Z .080"     'Switch offset
While Ismoving()
Wend
Code"G92 Z0.000"
While Ismoving()
Wend
COde" G0 Z0.120"    'Pierce Height
While Ismoving()
Wend
SetDro(18,Cfr)
While Ismoving()
Wend
DoOemButton(110)  'Fires Torch reset THC height
END

Title: Re: m03 floating head programing
Post by: Tony Spencer on May 13, 2012, 02:18:16 PM
Thanks for the prompt reply. I have a floating head switch so z homes to the surface plus some free travel and then trips. On the mach plasma screen I have added four extra DRO, Pierce height, Pierce delay, Cut height and z offset. Reading some of your old post and others, on plasma set up, I am trying to understand the code.
At the moment I have a macro adapted from one that I think was written by you (not sure):-
PierceHeight =GetUserDRO(1000)
CutHeight= GetUserDRo(1001)
PierceTime=GetUserDRO(1002)
Zoffset=GetUserDRO(1003)
Code “G28.1Z0”
While IsMoving( )
Wend
Code”G92 Z0” (set z to 0)
While IsMoving( )
Wend
Code”GO Z”&Zoffset ( Retract to top of material)
While IsMoving( )
Wend
Code”G92 Z0” (set z to 0)
While IsMoving( )
Wend
Code”GO Z”&PierceHeight
While IsMoving( )
Wend
DoSpinCW( )  (Turn torch on)
While IsMoving( )
Wend
Code”G4P”&Pierce Time (Pierce delay)
While IsMoving( )
Wend
Code”GOZ” &CutHeight (Go to cut height)
While IsMoving( )
Wend
End
If I run this macro step by step in the VB editor it appears to run OK but on the actual machine I get variable results in the cut height setting. Very new to macros and on a steep learning curve! Is the macro correctly structured?
Thanks for your help




Title: Re: m03 floating head programing
Post by: BR549 on May 13, 2012, 07:52:47 PM
What you are seeing is one reason WHY I never recomend using a MACRO over just running Plain Gcode .  The macro WILL depend on the computer running it as to IF it will run acturately (not jumping out of sync and skipping codes).

Normally I would see it on FAST cpu PCs.  

You Code seems correct, You may want to try it this way, adding in a few more wait states. (;-) Also corrected a few GO instead of G0 issues. (;-)

PierceHeight =GetUserDRO(1000)
While IsMoving( )
Sleep(20)
Wend
CutHeight= GetUserDRo(1001)
While IsMoving( )
Sleep(20)
Wend
PierceTime=GetUserDRO(1002)
While IsMoving( )
Sleep(20)
Wend
Zoffset=GetUserDRO(1003)
While IsMoving( )
Sleep(20)
Wend
Code “G28.1Z0”
While IsMoving( )
Sleep(20)
Wend
Code”G92 Z0”          '(set z to 0)
While IsMoving( )
Sleep(20)
Wend
Code”G0 Z”&Zoffset '( Retract to top of material)
While IsMoving( )
Sleep(20)
Wend
Code”G92 Z0”          '(set z to 0)
While IsMoving( )
Sleep(20)
Wend
Code”G0 Z”&PierceHeight
While IsMoving( )
Sleep(20)
Wend
DoSpinCW( )             '(Turn torch on)
While IsMoving( )
Sleep(20)
Wend
Code”G4P”&Pierce Time    ' (Pierce delay)
While IsMoving( )
Sleep(20)
Wend
Code”G0Z” &CutHeight      '(Go to cut height)
While IsMoving( )
Sleep(20)
Wend
End
Title: Re: m03 floating head programing
Post by: Tony Spencer on May 14, 2012, 04:34:40 AM
Thanks for the tips. The Go G0 was a typo and I will try the extra sleep commands .I do not have a specific Cam for plasma yet but use Vectric for most of my wood work. Rather than calling the m3 macro is it possible to automatically insert the raw g code at the start of each cut file?
Thanks
Title: Re: m03 floating head programing
Post by: BR549 on May 14, 2012, 06:51:18 PM
WIth a CAM you can modify the POST to insert the Gcode sequence BEFORE each M3.

(;-) TP
Title: Re: m03 floating head programing
Post by: stirling on May 15, 2012, 06:07:19 AM
Heh He - I know Terry has a thing about wait states but to suggest this is why the original code you posted "doesn't work" is frankly pushing things a bit.

1) As pointed out you were using the letter "O" instead of a zero in several places.
2) It may be an artifact of how the forum translated the code text you posted but the quotes ("") are not syntactically correct as far as the interpreter is concerned. Please post code using the #code tags in future - this will help a lot in debugging.
3)  Code”G92 Z0” (set z to 0) is incorrect syntax. You're using GCODE style comments in CB. This will cause the CB interpreter to fail. Either use Code "G92 Z0 (set z to zero)" (look where the closing quote is) OR preferably use CB comments i.e. Code "G92 Z0" 'set z to sero.
4) Code”G4P”&Pierce Time (Pierce delay) is a syntax error (the space between Pierce and Time. (as well as the reason in 3) above. (The missing spaces are also syntax errors but may again be an artifact of you posting the code on the forum without #code tags.

If you did indeed run the code you posted step by step then there is NO WAY it ran OK - impossible.

As far as putting wait states after a FUNCTION call like PierceHeight=GetUserDRO(1000). This is completely pointless. Unlike a SUB call from CB to Mach which can be ASYNCHRONOUS, a FUNCTION call by its very nature is always SYNCHRONOUS.

Ian
Title: Re: m03 floating head programing
Post by: Tony Spencer on May 15, 2012, 07:17:38 AM
Hi Ian
The bracketed comments in my post are my understanding of what the code does, not part of the code. I didn’t realise you could attach code in reply section so thanks for that tip
The actual code is:-
PierceHeight=GetUserDRO(1000)
CutHeight=GetUserDRO(1001)
PierceTime= GetUserDRO(1002)
zoffset=GetUserDRO(1003)
If GetOEMLed(836)=0 Then
Code "G28.1z0"
While IsMoving()
Wend
Code "G92 z0"'set z 0
While IsMoving()
Wend
Code"G0z"&zoffset' move to surface,inc switch free play
While IsMoving()
Wend
Code"G92z0"'set z 0
While IsMoving()
Wend
Code "G0 z"&PierceHeight' move to pierce height
While IsMoving()
Wend
Code "G4P" &PierceTime'pierce delay
While IsMoving()
Wend
DoSpinCW()' Turn torch on
While IsMoving()
Wend
Code "G0z" &CutHeight'move to cut height
While IsMoving()
Wend
Else
MsgBox "Torch on surface"
End If
         
I have it in as a m3 macro at the start of a cut file but it doesn’t always run consistently. If I run it step by step in the VB editor it runs OK.
I just wanted the code checked for any errors and suggestions

Tony
Title: Re: m03 floating head programing
Post by: stirling on May 15, 2012, 07:39:20 AM
OK I've re-formatted your code so we can read it a tad easier (There's no charge for spaces - feel free to use them ;))

Plus this is what I meant by #code tags (see the # button on the regular reply screen - not the quick reply)

Code: [Select]
PierceHeight = GetUserDRO(1000)
CutHeight = GetUserDRO(1001)
PierceTime = GetUserDRO(1002)
zoffset = GetUserDRO(1003)

If GetOEMLed(836) Then
  MsgBox "Torch on surface"
Else
  Code "G28.1 z0"
  While IsMoving()
  Wend

  Code "G92 z0" 'set z 0
  While IsMoving()
  Wend

  Code "G0 z" & zoffset' move to surface,inc switch free play
  While IsMoving()
  Wend

  Code "G92 z0" 'set z 0
  While IsMoving()
  Wend

  Code "G0 z" & PierceHeight' move to pierce height
  While IsMoving()
  Wend

  Code "G4P" & PierceTime'pierce delay
  While IsMoving()
  Wend

  DoSpinCW()' Turn torch on
  While IsMoving()
  Wend

  Code "G0 z" & CutHeight'move to cut height
  While IsMoving()
  Wend
End If


Now then....

What do you mean by...

I have it in as a m3 macro at the start of a cut file but it doesn’t always run consistently. If I run it step by step in the VB editor it runs OK.

i.e. what EXACTLY does it NOT do that you'd like it to do and what EXACTLY does it DO that you DON'T want it to do? - I'm a tad down on my psychic capabilities at the moment  ;D

Ian
Title: Re: m03 floating head programing
Post by: Tony Spencer on May 15, 2012, 01:57:35 PM
Thanks for the re –formatted code and the free spaces-  :) sorry to hear about your failing psychic capabilities so here are some details- :)

I have been running the test code on a live machine and expect to see the torch:-

1 Travel down to the surface of the material
2 Take up the free play of the floating head
3 Retract back to the surface (which should now be z 0)
4 Go to pierce height
5 Torch on
6 Pierce delay
7 Go to cut height
8 Start cutting.

The free play between the torch touching the material and the limit triggered is measured at 3.6mm. (This becomes my zoffset parameter in the code-UserDRO (1003))

The first problem is my mistake in that the Torch on command should be before the Pierce delay command in the code-easy fix.

The second problem is if I use the zoffset (3.6mm), pierce height of 2mm and cut height of 1mm and run the code the actual pierce height on the machine is high and subsequently the cut height is high, although the measured difference between the two is 1mm as expected.

I can get the correct pierce height-cut height by reducing the zoffset figure but I must have something wrong!

 I have rechecked the zoffset measurement and the z axis calibration and both are correct. Could the problem be associated with the G28.1 command? I notice that the z axis backs off from the switch at the end of the homeing sequence and so I have the z axis home set to auto 0 but is this conflicting with the G92z0 in the macro and resulting in an incorrect offset?

 Tony
Title: Re: m03 floating head programing
Post by: BR549 on May 16, 2012, 08:38:25 AM
What you think the offset should be and what it ends up being can be 2 different things. The way I get teh correct offset is trial by error. Run the routine and have it stop before the M3 and MEASURE the set height IF it is NOT correct change the offset value untill it is correct.

The real question IS will it repeat itself every time ending at the same value ? 

WHile some may tell you too many wait states spoils the pie I have found them required many times over many machines and PCs to keep from breaking things(;-). As a rule I only use as many as it takes to make it run reliably. and not a mili secound longer BUT that may not run on your machine.

I do have a PC here that requires little to NONE on wait states but it is a old slow machine @ 1.2ghz. The faster one 3ghz you never know where the code will blow up.

BUT that is just my story your milage may vary due to local conditions (;-) LOLOLOL

(;-) TP



Title: Re: m03 floating head programing
Post by: stirling on May 16, 2012, 08:58:54 AM
Could the problem be associated with the G28.1 command?
Well I've just spent a while scoping G28.1's behaviour and I'm not sure if you'd call it a problem or just the way it is but G28.1 appears to behave a little weird depending on WHERE you start from,  where the commanded point is and where the switch is made ACTIVE. If you make sure the commanded point is always ABOVE where the switch will go ACTIVE then you're ok. Otherwise it can be - well let's say - "inconsistant". I can do the details if you want but generally if the switch goes ACTIVE at or above the commanded point then G28.1 behaves quite differently.

Another quick point: Just because the home LED is on doesn't mean your ACTUALLY "Torch on surface" - it may be slightly above it depending on HOW you homed.

@Terry - Hi Terry

I'm not disputing that wait states are sometimes required and that WHERE they're needed appears to be version and perhaps system hardware dependant. All I was saying above is that this was NOT the fundamental reason why the first code posted didn't work and also I stand by what I said that there is ZERO point in putting them after a FUNCTION call.

Ian

EDIT: Hmmmm - Seems G28.1 doesn't do what it says on the tin as far as the speed to the commanded point either. According to the blurb it travels at current feedrate - nope - it travels at rapid rate!
Title: Re: m03 floating head programing
Post by: BR549 on May 16, 2012, 02:51:33 PM
hIYA Ian I was just pulling your leg(;-).

The G28.1 method uses a % of rapid as defined in Config/homing. It IS adjustable.

Also with the G28.1 function there IS a waypoint feature. With this you can direct the Z to move to the way point at rapid then finish the function at home speed.  With Plasma you are rarely anywhere but a  0.100 " or so off the top of material at any time. So I just do

G28.1 Z.500   That sends the Z UP to .500 at rapid as a SAFEZ and then resumes the Home function at the preset speed I have defined.

I use SafeZ as .500 as it is not safe to go zooming around the thin guage material as it warps and there may be kickups hidding that will tear the torch right off the head IF you are just skimming the top of the material.

BUT the G28.1 method does NOT allow you to use the G68 function(EXTREMELY USEFULL IN PLASMA) as the Z homing routine will not run in rotated XY space. Yes I know it does not make sense NOT to be able to HOME the" Z".   XY I understand as that is what is rotated BUT it is what it is.

(;-) TP

Title: Re: m03 floating head programing
Post by: stirling on May 17, 2012, 08:34:59 AM
hIYA Ian I was just pulling your leg(;-).
I knew that  ;D

The G28.1 method uses a % of rapid as defined in Config/homing. It IS adjustable.
In the SECOND stage yes - but the guide says the FIRST stage is done at FEEDRATE - which it isn't - it's done at 100% RAPID.

Also with the G28.1 function there IS a waypoint feature. With this you can direct the Z to move to the way point at rapid then finish the function at home speed.
That's what I'm saying

With Plasma you are rarely anywhere but a  0.100 " or so off the top of material at any time.
Well I'd say that depends on what you're cutting and how much it's warped/may warp upwards for whatever reason - but anyway let's say 0.1 is OK

So I just do

G28.1 Z.500   That sends the Z UP to .500 at rapid as a SAFEZ and then resumes the Home function at the preset speed I have defined.
I don't get this bit. If 0.1 is safely above the material why would you send it further up before coming down again - seems a complete waste of time to me with no benefit.

I use SafeZ as .500 as it is not safe to go zooming around the thin guage material as it warps and there may be kickups hidding that will tear the torch right off the head IF you are just skimming the top of the material.
Sorry if I'm being a bit slow but a minute back you seemed to be saying 0.1 was safe.

Ian
Title: Re: m03 floating head programing
Post by: BR549 on May 17, 2012, 03:13:23 PM
HIYA IAN, That.080-  .100 is where the torch spends most of its time when cutting. While it is cutting  the THC does a decent job of regulating the height on warped steel. AS compared to milling where you could be all over in Z height. SO a simple move UP to .500 as a safe Z is minimal movment BUT it gives the torch a chance to reset the TOM safely. COULD be an old habit to always retract to safe Z before ANY functionmove(;-) I can assure you the short move at rapid to Z.500 is not wasting much time and the G28.1 is running at %80 of rapid for the Z .

YES some steels WARP badly when cutting some don't. You can watch the steel warp up when cutting and down as it cools DURING the cuts. USING Scam allows you to use a POST that helps account for warpage by moving the cuts around the table to minimise HEAT build up and warping. We cut anywhere from 20ga to 3/4" plate of various metals. AND that is very wide range for a single table and operator to keep up with. Our auto preset for the THC based on Gcode helps a LOT to keep things striaght settings wise. The OP just has to make sure the OLD torch is set correctly AMP wise and consumables wise. THAT ifo pops up on the screen before each new part is started.

TOO cheap to buy a new modern torch as long as the old one cutts so well. (;-)

I would not consider anything LESS than .500 for a safe Z. AS broken torch couplers at $100 each HAVE proven it is not safe below that point(;-) at least around here cutting guage metals. POPUPS can get you anytime(;-)

AS I remember the G28.1 has ALWAYS did the move to midpoint at rapid speeds and the secondary (homing) move at % of rapid as defined.  WHere does it says the midpoint is done at feedrate? 

(;-) TP

Title: Re: m03 floating head programing
Post by: stirling on May 17, 2012, 03:52:21 PM
All I'm saying is if your at z=0.1 then there's no point in doing a g28.1 Z0.5 cos all that will do is raise to 0.5 at rapid and then lower at % home speed until you get switch trip. You might as well have done a G28.1 Z0.1 - that would just do a % home downwards without going up to 0.5 first for no reason whatsoever.

The gcode button in Mach says:

Quote
G28.1 Reference Axis

Program G28.1 X~ Y~ Z~ A~ B~ C~ to reference the given axes. The axes will move at the current feed rate towards the home switch(es), as defined by the Configuration. When the absolute machine coordinate reaches the value given by an axis word then the feed rate is set to that defined by Configure>Config Referencing. Provided the current absolute position is approximately correct, then this will give a soft stop onto the reference switch(es).

Wrong!

Ian
Title: Re: m03 floating head programing
Post by: BR549 on May 17, 2012, 04:46:06 PM
HIYA Ian I see where the confusion is. When I run the G28.1 before the M3 it is already at safeZ .500 as I would NEVER rapid to the next startpoint at pierce hight(;-) A lot of people run Z1.00+ as safeZ JUST to make sure. Then the midpointmove is handy and saves time.

(;-) TP
Title: Re: m03 floating head programing
Post by: stirling on May 18, 2012, 04:01:01 AM
OK - so now we're getting to the nub of the original problem (remember that?).

That's why YOURS works as desired and why the OP's is inconsistant - look at the G28.1 in HIS code. He will only get consistant results if the metal is ALWAYS BELOW Z=0.

Jeez this is hard work  ;D

Ian
Title: Re: m03 floating head programing
Post by: BR549 on May 18, 2012, 08:44:24 AM
Darn I had to go back and read the whole thing again. YEP I was the culpret that stared the wrong CODING.

The orginal code I posted for the G28.1 version FOR PLASMA was wrong as written

G28.1 X0

Should have been

G28.1 X0.500

WHich includes the safety move up to  Z0.500.

I work in so many type of machines I forget from time to time which one I am working with.

I get the Dumb Dumb award today, (;-) TP
Title: Re: m03 floating head programing
Post by: stirling on May 18, 2012, 09:19:25 AM
 ;D ;D ;D Easy there Terry - no need to beat yourself up - you know that's what I'm here for  ;D ;D ;D

Ian
Title: Re: m03 floating head programing
Post by: BR549 on May 18, 2012, 09:25:02 AM
 ;D ;D  Just because you get up about 4-5 hrs earlier than me . You need to wait until I get a couple cups of Coffee down the hatch.

(;-) TP
Title: Re: m03 floating head programing
Post by: leon crist on March 15, 2017, 01:33:46 AM
 so do i copy past in mt edit scipt and put it in the auto tool cange or where just making shure
Title: Re: m03 floating head programing
Post by: leon crist on March 15, 2017, 06:00:22 PM
ok i am new to the plasma so i put these codes in my mach in tool change and it all works but i need to no what soft ware to use for plasma i am trying aspire 4.0 but no post p to turn on tourch and shut off when done  any help ..
Title: Re: m03 floating head programing
Post by: leon crist on March 15, 2017, 11:03:01 PM
ok i have this all working on my cnc  i hit auto tool zero and it goes down and set the lift hight  now need to figger out soft ware to  do my tool passes  i have vectric asire but no m3 m5  any help  wish there was some one to work my post p over for mach
Title: Re: m03 floating head programing
Post by: leon crist on March 16, 2017, 12:23:24 PM
any  one  no how to get vectric post p to work for plasma  
Title: Re: m03 floating head programing
Post by: leon crist on March 23, 2017, 12:20:05 PM
so could you help me on this where do i put these files to make cnc run this file  every time i load a file to cut   
Title: Re: m03 floating head programing
Post by: leon crist on March 27, 2017, 03:18:11 AM
You really don't want it to do it EVERY time the M3 is called(;-) do you??? You will spend more time finding the TOM than cutting.

Just a thought, (;-) TP


             got these codes in mine but my m3 from my post p comes on at  start point then hits float switch and lifts like it should but how can i get rid of the m3 that comes on when z is going down and come on with the code above
Title: Re: m03 floating head programing
Post by: leon crist on March 27, 2017, 03:27:37 AM
 got these codes in mine but my m3 from my post p comes on at  start point then hits float switch and lifts like it should but how can i get rid of the m3 that comes on when z is going down and come on with the code above  any help
Title: Re: m03 floating head programing
Post by: leon crist on March 27, 2017, 10:57:24 PM
This should get you close to what you wanted. You will have to adjust the switch offset to match your machine and the Feedrate to what you want.

'M3 Macro for TOM G31 Version
Cfr = GetDro(18)
Code"G31 Z-5 F20"                                     ok so  what does this do  the is it the distence from switch  Code"G0 Z .080"     'Switch offset  ok my swich kicks probe light on at .340 so do i put that in the pierce height then   
While Ismoving()
Wend
Code"G92 Z0"
While Ismoving()
Wend
Code"G0 Z .080"     'Switch offset
While Ismoving()
Wend
Code"G92 Z0.000"
While Ismoving()
Wend
COde" G0 Z0.120"    'Pierce Height
While Ismoving()
Wend
SetDro(18,Cfr)
While Ismoving()
Wend
DoOemButton(110)  'Fires Torch reset THC height
END