Hello Guest it is April 19, 2024, 12:19:44 PM

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Davek0974

571
General Mach Discussion / Re: M6 Macro tweaking
« 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
       

572
General Mach Discussion / Re: M6 Macro tweaking
« 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.

573
General Mach Discussion / Re: Cool CNC Features
« on: January 27, 2018, 03:12:13 AM »
My Bosch VFD has an extension kit that allows you to mount the VFD display on a panel elsewhere.

574
General Mach Discussion / Re: Bridgeport Knee Mill Conversion?
« on: January 26, 2018, 07:00:34 AM »
Its good fun :)

575
General Mach Discussion / Re: Bridgeport Knee Mill Conversion?
« on: January 26, 2018, 06:44:08 AM »
Just to check my sanity with the new method I hacked up a little demo in VB6, one of my favourite apps, it uses the same calculations and variables as the macro will and shows the result with two sliders representing the knee/bed  ;) ;)



Works perfectly, now just have to decide to go with hidden DRO or user variable.

576
General Mach Discussion / Re: Bridgeport Knee Mill Conversion?
« on: January 26, 2018, 04:33:01 AM »
Ok, lets try this flavour - it uses a hidden DRO or a #Var to store the position of the knee when the Z axis is referenced to work zero.

Its a much safer version i think as i can then move the knee anywhere i want anytime and it still knows where to go in the M6 routine.



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
TargetKneePosition = KneeRefPosition - OffsetDifference

'***Rapid to a position lower than needed to allow for a final slow move up
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
      

577
General Mach Discussion / Re: Bridgeport Knee Mill Conversion?
« on: January 25, 2018, 04:54:47 PM »
One more - make sure you don't have any G43 active - i modified the post processor to always output G43 H0 for any tool, having TL comp active as well as knee comp could be good fun :)

578
General Mach Discussion / Re: Cut not going into corners?
« on: January 25, 2018, 02:51:15 PM »
Good you got going:)

Sound like you might benefit from spending some time and doing a tune-up - if the speed is ok, just increase acceleration in steps until it sounds bad, jerks or loses steps then back off maybe 10-15% and test it.

579
General Mach Discussion / Re: Bridgeport Knee Mill Conversion?
« on: January 25, 2018, 02:41:43 PM »
 :D ;D :D ;D

This code version works perfectly, it's one impressive addition to the mill, just increased it's usability 200% I think, she's now got 350mm of Z clearance under code control  8)

Of course, with every new feature there are new ways to mess things up of course -
do not enter a new tool manually in the "Current tool" DRO,
do not jog the knee manually once you have ref'd the Z axis and set the first tool or probe,
always enter the 1st tool/probe manually in the current tool DRO
probably a million other ways to make balls-up :)

I think a good addition will be to add some code to check that the new knee position is still a negative number as the axis runs out of travel at zero :)

One thing that did fail is the Index Homing on the knee - keeps throwing "Index not within allowed distance" error which means the index pulse is out of range, will have read the manual on this one.


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

‘***Get the current G90/G91 state
CurrentAbsInc = GetOemLED(48)

‘***Get Axis Scale factors in use
XScale = GetOEMDRO(59)
YScale = GetOEMDRO(60)
ZScale = GetOEMDRO(61)
CScale = GetOEMDRO(64)

‘***Set All Axis Scales to 1
Call SetOEMDRO(59,1)
Call SetOEMDRO(60,1)
Call SetOEMDRO(61,1)
Call SetOEMDRO(64,1)
Sleep(250)

‘***Get old tool length
OldToolLength = roun(GetToolParam(GetCurrentTool, 2))

‘***Set the requested tool to be the current tool
SetCurrentTool(GetSelectedTool())

‘***Get new tool length
NewToolLength = roun(GetToolParam(GetCurrentTool, 2))

‘***Switch to absolute distance mode
Code "G90"

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

'========================================================================================
' Start of Knee Positioning Code
'========================================================================================
‘***Get the knee position in machine coordinates
CurrentKneePosition = roun(GetOEMDRO(88))

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

‘***Calculate the knee machine move value based on tool length difference
If OldToolLength > NewToolLength then ‘***We need to RAISE the knee
    Code “G53 G0 C” & (CurrentKneePosition - (OldToolLength - NewToolLength)) + ClearAllow
    While IsMoving ()
      Sleep(100)
    Wend
    Code “G53 G1 C” & (CurrentKneePosition - (OldToolLength - NewToolLength)) & “ F100”
    While IsMoving ()
      Sleep(100)
    Wend
End If

‘***If the knee is currently higher than it needs to be, we first
‘***move it down, to ensure the final move is always UP.  This ensures
‘***backlash is taken out and provides more consistent positioning.

If OldToolLength < NewToolLength then ‘***We need to LOWER the knee
    Code “G53 G0 C” & (CurrentKneePosition + (NewToolLength - OldToolLength)) + ClearAllow
    While IsMoving ()
      Sleep(100)
    Wend
    Code “G53 G1 C” & (CurrentKneePosition + (NewToolLength - OldToolLength)) & “ F100”
    While IsMoving ()
      Sleep(100)
    Wend
End If

If OldToolLength = NewToolLength then
    ‘Message “Knee Will Not Move” ‘***Use this line for debugging
End If

'========================================================================================
' End of Knee Positioning Code
'========================================================================================

‘***If G91 was in effect before then return to it
If CurrentAbsInc = 0 Then
  Code "G91"
End If

‘***Put previous Axis Scale factors back
Call SetOEMDRO(59,XScale)
Call SetOEMDRO(60,YScale)
Call SetOEMDRO(61,ZScale)
Call SetOEMDRO(64,CScale)
Sleep(250)

End Sub
   

580
General Mach Discussion / Re: Bridgeport Knee Mill Conversion?
« on: January 25, 2018, 01:49:51 PM »
Just found it, thanks.

Was reworking it with this method as you replied...

NewToolLength = roun(GetToolParam(GetCurrentTool, 2))