Hello Guest it is March 07, 2021, 04:31:23 PM

Author Topic: Custom plasma probing code?  (Read 6742 times)

0 Members and 1 Guest are viewing this topic.

Offline Davek0974

*
  •  2,606 2,606
    • View Profile
    • DD Metal Products Ltd
Custom plasma probing code?
« on: December 26, 2015, 04:50:04 AM »
I'm looking at testing a new initial height sensing method on my plasma table, it currently uses G28.1 I think and the Z-limit as the response input from the floating z switch.

I want to trigger the Aux-B relay before lowering the Z to probe and release Aux-b relay after a good probe.

SO the sequence would be

Probe request,
Trigger Aux-B relay
Lower head until Z-Lim is tripped
Lift head back to safety height
Release Aux-B relay
Lower head to pierce height
Continue to M3 etc

Trouble is, while i can do the mechanicals, i have little knowledge of how to achieve the control in my case.
I can tweak the G-code post processor in sheet cam pretty well though :)

Any tips?
Bridgeport Mill, Mach3 V062, CSMIO-IP/A controller, AC Servo Drives.
Plasma table, Mach3 V062, Step motors, C&CNC THC.

Offline Davek0974

*
  •  2,606 2,606
    • View Profile
    • DD Metal Products Ltd
Re: Custom plasma probing code?
« Reply #1 on: December 26, 2015, 07:05:24 AM »
I think this maybe all done in the post-processor, been playing with code and can do this (lines marked ********* added)

N0210 G00 X36.000 Y17.475 Z15.000
N0220 M900 (Check for Z active)
N0230 M08 (Turn on extract fan)
N0240 M07 (Insert probe switch) ***************
N0250 G28.1 Z3.00 (Start Touch-Off )
N0260 G92 Z0.0
N0270 M09 (Retract probe switch)**************
N0280 G00 Z3.400 (Switch Offset Lift)
N0290 G92 Z0.0
N0300 G00 Z3.8000
N0310 M03
N0320 G01 Z1.500 F1300.0
N0330 S20 (DTHC is ON)
N0340 G01 Y11.475 F4100.0
......

I think that will do it, it retracts the probe before lowering the head to pierce height i think.
Might need some short delays adding but testing will prove that.

Might work????
Bridgeport Mill, Mach3 V062, CSMIO-IP/A controller, AC Servo Drives.
Plasma table, Mach3 V062, Step motors, C&CNC THC.

Offline Davek0974

*
  •  2,606 2,606
    • View Profile
    • DD Metal Products Ltd
Re: Custom plasma probing code?
« Reply #2 on: December 26, 2015, 07:22:36 AM »
BTW The idea is to fire an air cylinder to insert a small, very accurate switch under the plasma tip to sense plate height without pressing down on the plate and causing it to deflect.
Bridgeport Mill, Mach3 V062, CSMIO-IP/A controller, AC Servo Drives.
Plasma table, Mach3 V062, Step motors, C&CNC THC.

Offline Davek0974

*
  •  2,606 2,606
    • View Profile
    • DD Metal Products Ltd
Re: Custom plasma probing code?
« Reply #3 on: December 26, 2015, 08:39:35 AM »
someone has just replied over on the sheet cam forum about placing all his touch-off code in a custom macro, the post then only has the one macro call and any changes to switch offset only need making once in the custom code.

trouble is, this was on a linux build, can this be done in a custom mach macro in the same way i.e the g-code calls a custom macro and waits for that macro to do the touch - off???

never done any stuff with macros really.
Bridgeport Mill, Mach3 V062, CSMIO-IP/A controller, AC Servo Drives.
Plasma table, Mach3 V062, Step motors, C&CNC THC.

Offline Davek0974

*
  •  2,606 2,606
    • View Profile
    • DD Metal Products Ltd
Re: Custom plasma probing code?
« Reply #4 on: December 26, 2015, 09:32:31 AM »
Am i on the right tracks here or not...

Custom ref macro M1100.m1s copied from another macro mostly.

Dim Switchoffset  
Switchoffset = GetOemDRO(1045)    

If Switchoffset > 0 Then
   Code “M07”
   Code "G28.1 Z3.000"     
   Code "G92 Z 0.000"  
   Code “M09”                  
   Code "G00 Z " & Switchoffset  
   Code "G92 Z 0.000"
   While IsMoving()                      
   Wend                                                
Else                                                                    
   MsgBox("Your Switch Offset value in MACH needs to be set")
   Code “M30”                                      
End If  



Can i use the M07/9 macro within another macro or do i need to use something like ActivateSignal(????) instead to put the mist coolant o/p on & off?????

When called from the g-code file, will the g-code wait until this macro is complete??
Bridgeport Mill, Mach3 V062, CSMIO-IP/A controller, AC Servo Drives.
Plasma table, Mach3 V062, Step motors, C&CNC THC.

Offline BR549

*
  •  6,944 6,944
    • View Profile
Re: Custom plasma probing code?
« Reply #5 on: December 26, 2015, 11:50:50 AM »
OK from the top. IF you are to fire a solenoid to position a very sensitive switch to detect the metal surface (TOM)then the motion ACTION of the solenoid will more that like trip your sensitve switch(Been There).

It is NOT a good idea to use M7 M8 M9 as they are interrelated and if you turn on M8 then M7 and tried to ONLY turn off M7 with M9 you end up turning off M8 as well.

Yes it is BEST to do all the needed TOM (Top of Material) functions from a macro. There are several advantages on being you have all the needed code in 1 place and you can modify it once and it is a gobal update. Also RFH ( run from here) works very well as the motion Gcode G28.1 does NOT run from a macro when the RFH is called.  BUT sometimes Mach3 can pitch a witch with running Mcodes So it is all a tradeoff.

You may want to consider Ohmic touch off and use it with teh Z switch as a combined backup IF the ohmic misses then the Zswitch will kick in. OR in your case if you use the 30A consumables then it can simple run from the Zswitch .  OR you can use a combination of ALL that and still have your solenoid lower a probe tip for the ohmic side.

The ideal way would be to create a function to  minimize mixing Gcode and macro script in a macro. Do as much Motion in straight Gcode as you can and not have it run inside the macro.  YES that sounds mixed up as I say earlier that doing teh function is better from a Mcode BUT mach3 can be a funny bird sometimes (;-) It all depends

Yes it always a bad idea to call a macro from inside of another macro you can run into timing issue with Mach3. There is a WAY to run outside script code from inside of a macro that does not involve calling teh Mcode. It is only doable in the later versions of Mach3.  Check teh Mach3 CB programers manual for details.

NOW to add to the confusion The more that you hybridize the function the harder it is to deal with in the real world of program useage. You would never be able to share any of your Gcode OR use other's Gcode to run on your table.

I am willing to help you in any way I can so you can try all your options (;-)

(;-) TP



Offline BR549

*
  •  6,944 6,944
    • View Profile
Re: Custom plasma probing code?
« Reply #6 on: December 26, 2015, 12:02:14 PM »
One way around teh switch being effected by motion is to just use the solenoid to swing a transfer bar into play between the material and the switch. That way the switch never moves only the transfer bar does.

Also a way to keep more direct Gcode into play would be to use a SUB routine to hold the motion code for teh TOM routine and call it as a SUB (M98) . Subs are very stable in Mach3. You would store teh SUB in teh SUB directory and call it as needed .

(;-) TP

Offline Davek0974

*
  •  2,606 2,606
    • View Profile
    • DD Metal Products Ltd
Re: Custom plasma probing code?
« Reply #7 on: December 26, 2015, 12:12:46 PM »
Thanks for that, some great tips there,

There is a logic to my reason for experimenting here -

1 - I was going to buy an Ohmic kit for my table until i realised they will not work on the 30A consumables on my PM45 as the nozzle is not shielded so no ohmic contact to connect with the plate surface.
2 - It was suggested to fudge a contact for the 30A setup by adding a contact or stud, but as the cut height is a mere 0.5mm here this sounds a recipe for pulling the torch off mid-cut.
3 - Then i found a capacitive height sensor - this looked good but only went to 1mm min and would likely not be too happy about sensing near the edge with half the sense ring having no metal below, plus the accuracy was listed at +/-0.5mm so not that good.
4 - I like experimenting ;)

The solenoid was just a suggestion, my favoured device would be a small air cylinder - these can be controlled, damped, etc so no need to ram it in and out, you can also have a nice controlled in-stroke and rapid return easily. Air is on hand nearby so seems an ideal choice, a 50mm stroke ram at 45deg should give clearance to the torch when cutting i think.

My M1100.m1s looks like this now

Dim Switchoffset  
Switchoffset = GetOemDRO(1045)    

If Switchoffset > 0 Then
   ActivateSignal(Output2)
   Code "G28.1 Z3.000"     
   Code "G92 Z 0.000"  
   DeActivateSignal(Output2)                  
   Code "G00 Z " & Switchoffset  
   Code "G92 Z 0.000"
   While IsMoving()                      
   Wend                                                
Else                                                                    
   MsgBox("Your Z Switch Offset value in MACH needs to be set")
   Code “M30”                                      
End If  

I think that gets the important bits in the right places and does away with the M-code for relay control.
Is there a code to replace the M30 with?? Or just ignore that one??
Might need a short delay here and there, who knows?

I'm not too worried about sharing code, my post processor is already heavily tailored to my system anyway, if i needed to share i could just send the dxf file.
Bridgeport Mill, Mach3 V062, CSMIO-IP/A controller, AC Servo Drives.
Plasma table, Mach3 V062, Step motors, C&CNC THC.

Offline Davek0974

*
  •  2,606 2,606
    • View Profile
    • DD Metal Products Ltd
Re: Custom plasma probing code?
« Reply #8 on: December 26, 2015, 12:17:56 PM »
One way around teh switch being effected by motion is to just use the solenoid to swing a transfer bar into play between the material and the switch. That way the switch never moves only the transfer bar does.

Also a way to keep more direct Gcode into play would be to use a SUB routine to hold the motion code for teh TOM routine and call it as a SUB (M98) . Subs are very stable in Mach3. You would store teh SUB in teh SUB directory and call it as needed .

(;-) TP

Thanks again, post overlap there;)

How do subs work in practice?
I see I have a subroutines folder in Mach, it has one testfile in it but how does the M98 call it??

any examples of the flow from sheet cam to mach??
Bridgeport Mill, Mach3 V062, CSMIO-IP/A controller, AC Servo Drives.
Plasma table, Mach3 V062, Step motors, C&CNC THC.

Offline Davek0974

*
  •  2,606 2,606
    • View Profile
    • DD Metal Products Ltd
Re: Custom plasma probing code?
« Reply #9 on: December 26, 2015, 12:59:26 PM »
Hmm, mostly guesswork here...

I have a subroutine file called HeightSense.tap in the subs folder of Mach
I have a custom macro M1101 which has one line - ActivateSignal(OutPut2)
I have a custom macro M1102 which has one line - DeActivateSignal(OutPut2)

The HeightSense.tap file contains this....

M1101
G28.1 Z3.000   
G92 Z 0.000 
M1102                 
G00 Z my switch offset goes here
G92 Z 0.000

Am i getting there?

I gather you cannot access the switch offset DRO from g-code?

The main part g-code would then be like

N0200 M00 (Paused:  Check the DTHC Settings  Hit RUN to continue)
N0210 G00 X11.000 Y7.475 Z15.000
N0220 M900  (Check for Z active)
N0230 M08 (Turn on extract fan)
N0240 M98 (HeightSense.tap)
N0250 G00 Z3.8000 (set pierce height)
N0260 M03
Bridgeport Mill, Mach3 V062, CSMIO-IP/A controller, AC Servo Drives.
Plasma table, Mach3 V062, Step motors, C&CNC THC.