Hello Guest it is July 17, 2019, 09:35:13 AM

Author Topic: M6 Macro tweaking  (Read 1990 times)

0 Members and 1 Guest are viewing this topic.

Offline Davek0974

*
  •  2,556 2,556
    • View Profile
    • DD Metal Products Ltd
Re: M6 Macro tweaking
« Reply #10 on: January 01, 2018, 02:33:25 PM »
Ah, ok

I think adding the knee as an axis - A, B or C will be ok.

As soon as M6 T10 is called, the Z axis should lift to machine zero and the knee should move to the difference between the Haimer probe (T100) and T10. The knee AND Z axis both zero together when setting Z ref.

The macro reads ok i think, the code makes sense to me, whether it will work in reality i'll have to wait and see :)

Bridgeport Mill, Mach3 V062, CSMIO-IP/A controller, AC Servo Drives
Re: M6 Macro tweaking
« Reply #11 on: January 01, 2018, 06:54:38 PM »
Yes, the issue I thought was that you couldn't make a motion move while the M6 macro was active.

Offline Davek0974

*
  •  2,556 2,556
    • View Profile
    • DD Metal Products Ltd
Re: M6 Macro tweaking
« Reply #12 on: January 02, 2018, 03:03:13 AM »
I will need to test it again, I know the Z move to zero works ok in the M6Start as that has been running for some time successfully, so i presume having the code move the knee will also be ok.

IIRC it was something to do with manually moving the table while the machine was paused inside the M6 pair, but i need to check that again as it was some time ago and pretty specific to the CSMIO.

I am hoping to put the knee positioning code in the M6End macro as it would make sense to drop the knee in M6Start for easy tool change then lift it at the end.
Bridgeport Mill, Mach3 V062, CSMIO-IP/A controller, AC Servo Drives

Offline Davek0974

*
  •  2,556 2,556
    • View Profile
    • DD Metal Products Ltd
Re: M6 Macro tweaking
« Reply #13 on: January 03, 2018, 08:07:03 AM »

IIRC it was something to do with manually moving the table while the machine was paused inside the M6 pair, but i need to check that again as it was some time ago and pretty specific to the CSMIO.


With reference this issue, another forum member forwarded a very useful link that fully explains the issue, http://www.calypsoventures.com/forums/viewtopic.php?f=9&t=75#p337

It is all to do with Mach3, CSMIO and auto tool length setting while INSIDE the M6 loop - I had long since given up on this and have disabled the button macros on my 2010 screenset as any attempt to set tool length in the M6 loop will put Mach into reset with an ePid error. It seems CS Labs have no intention of fixing the issue.

I can confirm that tool probing works well OUTSIDE the M6 loop as i use it on the mini-mill setup on my CSLABS controller.
Bridgeport Mill, Mach3 V062, CSMIO-IP/A controller, AC Servo Drives
Re: M6 Macro tweaking
« Reply #14 on: January 23, 2018, 03:40:30 AM »
SetVar(1, GetOEMDRO(800))
SetVar(2, GetOEMDRO(801))
SetVar(3, GetOEMDRO(802))


Somehow, I don't think the M6Start macro you have is the normal one distributed with Mach3. It suggests someone was playing all sorts of games at some stage, transferring the X, Y & Z DROs into #1, #2 & #3. I can see why one might do that while experimenting though.

A bit embarrassing if you were already using those variables for something else of course.

Cheers
Roger

Offline Davek0974

*
  •  2,556 2,556
    • View Profile
    • DD Metal Products Ltd
Re: M6 Macro tweaking
« Reply #15 on: January 23, 2018, 04:46:02 AM »
I think they are superfluous to the current usage, the macro came originally with the 2010 screenset which does all sorts of clever stuff in the M6 etc.

I have deleted them now and will see what happens when i get the knee axis up and running this week.
Bridgeport Mill, Mach3 V062, CSMIO-IP/A controller, AC Servo Drives
Re: M6 Macro tweaking
« Reply #16 on: January 27, 2018, 12:28:36 AM »
Yes, the issue I thought was that you couldn't make a motion move while the M6 macro was active.
IF (IF) I understand you correctly, that is wrong.
I move all 3 axes around after M6Start has been called, so I can change the tool. And I can also change the Z axis zero as well to compensate for tool length. I think most people do (unless they have a fully functional ATC).
Caution: when you hit the continue button, the spindle will return to where it came from - subject to any changes in the axis zeroes. Make sure nothing is in the way!

Cheers
Roger

Offline Davek0974

*
  •  2,556 2,556
    • View Profile
    • DD Metal Products Ltd
Re: M6 Macro tweaking
« Reply #17 on: January 27, 2018, 03:14:12 AM »
Yes i was in error there, it was related to probing while in the loop, that is a major issue for some versions of Mach3, the earlier ones tend to be better it seems.
Bridgeport Mill, Mach3 V062, CSMIO-IP/A controller, AC Servo Drives

Offline Davek0974

*
  •  2,556 2,556
    • View Profile
    • DD Metal Products Ltd
Re: M6 Macro tweaking
« Reply #18 on: January 27, 2018, 03:16:49 AM »
Just as an update, here is my M6 code presently....

Code: [Select]
Sub Main()

If GetSelectedTool() = GetCurrentTool() Then Exit Sub '***Do nothing if current tool is called again

If GetOEMLED(1866) Then Exit Sub '***Ignore M6 calls LED

Tool = GetSelectedTool()'***Set the requested tool to be the current tool
SetCurrentTool(Tool)

Code "G53 G0 Z0" '***Move Z axis to machine zero - fully retracted for tool change
While IsMoving()
  Sleep(100)
Wend

'***Get the respective backlash clearance allowance for knee moves
If GetOEMLED(801) Then '***On  = English Measure INCH
  ClearAllow = 0.125   
Else                   '***Off = Metric Measure MM
  ClearAllow = 3.0   
End If

'***Lookup the offset in the tool table, T100 is our 3d Haimer Probe
ToolOffset = GetToolParam(GetCurrentTool(), 2)
ProbeOffset = GetToolParam(100, 2)
OffSetDifference = ProbeOffset-ToolOffset'***Calculate the difference between the probe and the new tool - can be negative or positive

'***Calculate the new knee machine coordinate value based on tool length difference
'KneeRefPosition = GetUserDRO(1012) '***Get the knee ref position - set when pressing "Z Zero" at probing stage, this is a hidden DRO
KneeRefPosition = GetVar(179) '***Get the knee ref position - #var is set when pressing "Z Zero" at probing stage
TargetKneePosition = KneeRefPosition - OffsetDifference

'***Check if knee axis has enough travel to make the move - C position is always negative
If TargetKneePosition + ClearAllow >0 Then
  Response=MsgBox("Not Enough Travel On Knee Axis - Move Aborted!", 48, "Axis Travel Error")
  Exit Sub
End If

'***Rapid to a position lower than needed
Code "G53 G0 C" & (TargetKneePosition + ClearAllow)
While IsMoving()
  Sleep(100)
Wend

'***Now move the knee UP slowly to its final position
Code "G53 G1 C" & TargetKneePosition & " F100"
While IsMoving()
  Sleep(100)
Wend

End Sub
       
Bridgeport Mill, Mach3 V062, CSMIO-IP/A controller, AC Servo Drives