Hello Guest it is April 26, 2024, 03:43:36 AM

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 - stephanbrunker

Pages: « 1 2 3 4 5 6
51
General Mach Discussion / Re: Bug in G77 / M1077 macro
« on: October 02, 2014, 12:31:19 PM »
If you use the Tooltable, then these macros have an additional error: The "T" word initiates a tool change and/or the taper. So, you have to rewrite them with a variable for the taper.

52
Update: Part of the problem was using the g77/g78 macros with the tooltable active. Because these macros use the "T"  word for the taper, but Mach3 interprets them as tool change. T0 is tool 0 and/or taper 0.

53
General Mach Discussion / Re: Bug in G77 / M1077 macro
« on: October 01, 2014, 07:15:24 AM »
I've solved my problems by rewriting the M1077 and M1078 macros. I use them quite often, because it's the simplest way to machine standard parts on the lathe - by combining G77 / G78 words. It first does roughing with the values in the general options when no h word is given and makes a sizing move with 40% feed and 40% of the roughing amount. Also, it evens the roughing passes out so that they are all the same amount. So, here is my code, without warranty of course:

M0177:
' G77   
'(Xx.*********x XDia NEEDED)
'(Zx.*********x End Z NEEDED)
'(Fx.*********x Feedrate)
'(can be Set In the settings page: 'Hx.*********x Depth of cut)
'(Cx.*********x Clearance In the X)
'(Qx.*********x Clearance In the Z)
'(Kx.*********x ZStartpoint)
'(Rx.*********x XStartpoint)
'(Tx.*********x Taper In Deg)   

Sub Main()                     
ZClearance = Abs(tZClear()) 'This one it not avalable                     
XClearance = Abs(tClearX())                     
StartX = tXStart()                     
StartZ = tZStart()                     
EndX = tEndX()                       
EndZ = tEndZ()                     
Taper = tTaper()                     
FirstPassDepth = tFirstPass()                     
RoughAmount =  abs(tCutDepth())                   
Feed = Feedrate()                     

SizingAmount = RoughAmount * 0.4
SizeFeed = Feed * 0.4
PI = 3.1415926

If StartZ > EndZ Then                     
    RightLeft = 1                     
Else                     
    RightLeft = -1                     
    ZClearance = ZClearance * -1                     
End If 

If StartX < EndX Then   'Inside Turning                 
    IDOD = -1                     
    XClearance = XClearance * -1
Else                     
    IDOD = 1           'Outside         
End If   
                                     
'Calc the distance X needed to make the taper angle                     
TaperX = Abs(StartZ - EndZ)* Tan((Taper * PI)/180)                     
If TaperX > Abs(StartX - EndX) Then
    EndZ = StartZ - Abs(StartZ - EndZ) * RightLeft * (  Abs(StartX-EndX) / TaperX )
    TaperX = Abs(StartX - EndX)
End If             
                               
code "G0 X" & StartX + XClearance & " Z" & StartZ +  ZClearance           
code "F" & Feed           
PassNum = 1                     
LastPassDia = StartX                   

'optimize roughing value
Passes = (Abs(StartX - EndX) - SizingAmount) / RoughAmount
If CInt(Passes) <> Passes Then
    passes = CInt(Passes) + 1
    RoughAmount = (Abs(StartX - EndX) - SizingAmount) / Passes
End If

Do  'Roughing Loop         
    PassDia = StartX - (RoughAmount * IDOD * PassNum)           
         
    code  "G0 X" & PassDia           

    If TaperX <> 0 And Abs(PassDia-EndX) < TaperX + SizingAmount Then
        'Taper turn section                         
        ZCalc = StartZ - RightLeft * Abs(( (StartZ - EndZ) * (Abs(PassDia - EndX) - SizingAmount)) / TaperX )         
        code "G1 Z" & nFmt(ZCalc,4)   
           
        If (Abs(PassDia-EndX) < TaperX + SizingAmount) And (Abs(LastPassDia-EndX) > TaperX + SizingAmount) Then 
            code  "X" & EndX + (TaperX + SizingAmount) * IDOD & " Z" & EndZ + SizingAmount * RightLeft           
            code  "X" & LastPassDia     
            PosZ = EndZ + SizingAmount * RightLeft       
        Else   
            ZCalc = StartZ - RightLeft * Abs(( (StartZ - EndZ) * (Abs(LastPassDia - EndX) - SizingAmount)) / TaperX )           
            code "X" & LastPassDia & " Z" & nFmt(ZCalc,4)           
            PosZ = nFmt(ZCalc,4)           
           
        End If
         
        If PassNum = Passes Then Exit Do

        code  "G0 X" & LastPassDia + XClearance & " Z" & PosZ + ZClearance   
       
    Else           
        'Straight turn section           
        code  "G1 Z" & EndZ + SizingAmount * RightLeft         
        PosZ = EndZ + SizingAmount * RightLeft
        code  "X" & LastPassDia                     

        If PassNum = Passes Then Exit Do
       
        If Abs(LastPassDia - PassDia) < Abs(XClearance) Then
            code  "G0 X" & PassDia + XClearance & " Z" & PosZ + ZClearance   
        End If
    End If           

    code  "G0 Z" & StartZ + ZClearance           
   
    LastPassDia = PassDia           
    PassNum = PassNum + 1           
Loop           

'sizing
code "F" & SizeFeed   

If Abs(EndX - StartX) > TaperX Then
    If TaperX = 0 Then
        code "G0 X" & PassDia + XClearance & " Z" & PosZ + ZClearance
    End If
    code "X" & StartX + XClearance     
    code "Z" & EndZ       
    If TaperX <> 0 Then
        code "G1 X" & EndX + (TaperX + SizingAmount) * IDOD
        code "G0 X" & EndX + XClearance + (TaperX + SizingAmount) * IDOD & " Z" & EndZ + ZClearance
    Else       
        code "G1 X" & PassDia
        code "G0 X" & PassDia + XClearance & " Z" & EndZ + ZClearance
    End If
End If

code "Z" & StartZ + ZClearance     
code "X" & EndX       
If TaperX = 0 Then
    code "G1 Z" & EndZ
    code "X" & PassDia
    code "G0 X" & PassDia + XClearance & " Z" & EndZ + ZClearance
Else
    code "G1 Z" & StartZ   
    If Abs(StartX-EndX) > TaperX Then
        code "G1 Z" & EndZ & " X" & EndX + TaperX * IDOD 
        code "X" & EndX + (TaperX + SizingAmount) * IDOD 
        code "G0 X" & EndX + (TaperX + SizingAmount) * IDOD + XClearance & " Z" & EndZ + ZClearance   
        code "X" & StartX + XClearance & " Z" & EndZ + ZClearance   
    Else
        code "G1 Z" & EndZ & " X" & EndX + TaperX * IDOD 
        code "G0 X" & StartX + XClearance & " Z" &  EndZ + ZClearance   
    End If
End If

code  "G0 X" & StartX & " Z" & StartZ           
code "F" & Feed
End Sub                     
Main



=================================================================================


M0178:
'G78
'(Xx.*********x XDia NEEDED)
'(Zx.*********x End Z NEEDED)
'(Fx.*********x Feedrate)
'(can be Set In the settings page: 'Hx.*********x Depth of cut)
'(Cx.*********x Clearance In the X)
'(Qx.*********x Clearance In the Z)
'(Kx.*********x ZStartpoint)
'(Rx.*********x XStartpoint)
'(Tx.*********x Taper In Deg)

Sub Main()
ZClearance =  Abs(tZClear()) 'This one it not avalable
XClearance = Abs(tClearX())
StartX = tXStart()
StartZ = tZStart()
EndX = tEndX()
EndZ = tEndZ()
Taper = tTaper()
FirstPassDepth = tFirstPass()
RoughAmount =  tCutDepth()
Feed = FeedRate()
 
SizingAmount = RoughAmount * 0.4
SizeFeed = Feed * 0.4
PI = 3.1415926                                                     

If StartX < EndX Then
    IDOD = -1
    XClearance = XClearance * -1
Else
    IDOD = 1
End If
 
If StartZ > EndZ Then
    RightLeft = 1
Else
    RightLeft = -1
    ZClearance = ZClearance * -1 
End If

If Taper <> 0 Then
    TaperZ = Abs(StartX - EndX) /  Tan((Taper * PI)/180)
    If TaperZ < Abs(StartZ - EndZ) Then
        TaperX = Abs(StartX - EndX)
        EndZ = StartZ - TaperZ * RightLeft
    Else
        TaperX = Abs(StartZ - EndZ) * Tan((Taper * PI)/180)         
    End If
End If

code "G0 X" & StartX + XClearance & " Z" & StartZ +  ZClearance
code "F" & Feed
PassNum = 1                     
LastPassDepth = StartZ                                       

'optimize roughing value
Passes = (Abs(StartZ - EndZ) - SizingAmount) / RoughAmount
If CInt(Passes) <> Passes Then
    Passes = CInt(Passes) + 1
    RoughAmount = (Abs(StartZ - EndZ) - SizingAmount) / Passes
End If

Do     
    PassDepth = StartZ - (RoughAmount * PassNum * RightLeft)                                       
    code "G0 Z" & PassDepth                     
    If taper <> 0 Then
        XCalc = EndX + IDOD * Abs((StartX - EndX) * (Abs(StartZ - PassDepth) + SizingAmount) / TaperZ )                     
        code "G01 X" & XCalc             
        XCalc = EndX + IDOD * Abs((StartX - EndX) * (Abs(StartZ - LastPassDepth) + SizingAmount) / TaperZ )                     
        code "X" & XCalc & " Z" & LastPassDepth                       
        PosX = XCalc
        If PassNum = Passes Then Exit Do
        code "G0 X" & PosX + XClearance & " Z" & LastPassDepth + ZClearance
    Else
        code "G1 X" & EndX + SizingAmount * IDOD 
        PosX = EndX + SizingAmount * IDOD
        code "G1 Z" & LastPassDepth   
        If PassNum = Passes Then Exit Do
        If Abs(LastPassDepth - PassDepth) < Abs(ZClearance) Then
            code "G0 X" & PosX + XClearance & " Z" & PassDepth + ZClearance   
        End If
    End If
   
    code "G0 X" & StartX + XClearance                   
    LastPassDepth = PassDepth                     
                   
    PassNum = PassNum + 1                     
Loop                     

'sizing
code "F" & SizeFeed   
If Taper = 0 Then
    code "G0 X" & EndX + SizingAmount * IDOD + XClearance & " Z" & EndZ + SizingAmount * RightLeft + ZClearance
    code "Z" & StartZ + ZClearance
    code "X" & EndX
    code "G1 Z" & EndZ + SizingAmount * RightLeft
    code "G0 X" & EndX + XClearance & " Z" & EndZ + SizingAmount * RightLeft + ZClearance
Else
    code "G0 X" & PosX + XClearance & " Z" & EndZ + SizingAmount * RightLeft + ZClearance
End If
code "X" & StartX + XClearance
code "Z" & EndZ
code "G1 X" & StartX
If taper = 0 Then
    code "X" & EndX
    code "Z" & EndZ + SizingAmount * RightLeft
    code "G0 X" & EndX + XClearance & " Z" & EndZ + ZClearance
Else
    If Abs(StartX - EndX) > TaperX Then
        code "X" & EndX + IDOD * TaperX
    End If
    code "X" & EndX & " Z" & StartZ
    code "G0 X" & EndX + XClearance & " Z" & StartZ + ZClearance
End If

code "G0 X" & StartX & " Z" & StartZ                     
code "F" & Feed

End Sub                     
Main             
         


54
After I got a manual Tool changer, I was going to set it up and just with luck I avoided a major crash. But from the beginning: If you've a tool changer its a good idea to have a home switch too, so I configured Mach3 with these swiches and referenced my machine. According to the handbook version 1.84 I then selected my Master Tool as #1 and zeroed the axis. The first issue then is that the description in the handbook is wrong. For the next tool, if you push the "Touch X" button in the tool setup screen, the entry for the x offset in the tooltable is to the machine coordinates, not to the part coordinates. In a way, this makes actually sense: If you setup your machine and reference it, after entering the actual tool number the x coordinate is directly the radius of the workpiece. But, different from the handbook, the master tool also has that offset and not zero.

The Z axis is different as it really copies the offset to the work coordinates (which is 0 for the master tool) in the tool table.

The gravely issue are the default options in the turn xml file. If you have your tool table and switch between the tools, everything seems fine, the coordinates adjust and you can also work with manual G code input. The really bad surprise is if you type your G code in a file and let it run. Because it starts with an rapid move in a surprising direction. Why? Because the "Tool Selections Persistent" box is unchecked. So, even if you've everything set up correctly (right tool, part zero ...), it runs the program with Tool 0 - and that's of course very different from your actual tool. Luckily, because of the behaviour above, it has run in x+ direction, what was away from the workpiece.

After I checked that option, I tried tool change and the next problem arised. With the Option "Manual Tool Change - Press Cycle start" the program uses internally the M6 macros even if for example only a T0303 word is in the code. And this macro is by default the same as for the mill:

M6Start:
  tool = GetSelectedTool()
  SetCurrentTool( tool )

M6End:
REM The default script here moves the tool back to m6start if any movement has occured during the tool change..

x = GetToolChangeStart( 0 )
y = GetToolChangeStart( 1 )
z = GetToolChangeStart( 2 )
a = GetToolChangeStart( 3 )
b = GetToolChangeStart( 4 )
c = GetToolChangeStart( 5 )
if(IsSafeZ() = 1) Then
   SafeZ = GetSafeZ()
   if  SafeZ  > z then StraightTraverse x, y,SafeZ, a, b, c
      StraightFeed  x, y,  z  , a, b, c
else
Code"G00 X" & x & "Y" & y
end if


I don't know what exactly happens, but if I pressed "Cycle Start" after the T word Toolchange the x axis runs rapidly in the minus direction until it hits the limit switch. And in this case, the DRO tells correctly something far in the minus. No idea to what position it wants to go. I emptied the M6End macro, and that fixed it. Perhaps because the SafeZ is not defined in Turn, who knows ...

Now, it seems to work correctly, but these are dangerous bugs because it's different than in the handbook and the default values are simply wrong (another was "Reversed Arcs in Front post" )

55
General Mach Discussion / Re: Bug in G77 / M1077 macro
« on: August 29, 2014, 10:51:40 AM »
Seems that they were some other bugs in that macro too. I'm going to rewrite it with a roughing and a sizing stage - like in the wizard. But the OD Turning wizard has also a kind of bug inside. If you've a tool with an angle of around 80°, then you'll produce a nice crash in the sizing stage. Because after the last turning, it continues the z axis move to Z End and removes all the material at once because it takes the turn from inside out - it has to be the other way.

56
General Mach Discussion / Bug in G77 / M1077 macro
« on: August 18, 2014, 06:42:48 AM »
Because mentionend in the Turn Handbook, i tried the G77 / G78 canned cycles. But in G77 I found two bugs.

Line 48-52 must be:
Code: [Select]
If( Taper = 0 ) Then
  ZCalc = Abs(StartZ - EndZ)   'was ZCalc = 0, which ignores EndZ further on
Else                     
  ZCalc = Abs(StartX - EndX) /Tan((Taper * PI)/180) 
End if

and Line 71-74 must be:
Code: [Select]
  If IDOD =1 And PassDia <= EndX Or IDOD =-1 And PassDia >= EndX Then        'was < and > instead of <= >=, which causes to repeat the final cut
   PassDia = EndX           
   LoopExit = 1           
  End If

seems that nobody has used these two since creation (2009).


57
Problem solved! The "Jog Mode" button actually toggles and includes MPG jog mode on/off, but that is not shown. Now I just have to modify the surface and include a "Jog MPG" LED.

58
There're two seperate issues here - sorry. Why the default file doesn't run, doesn't really matter. I redid the complete configuration from a blank new file and it worked fine until i used the external MPG. So, my problem is how I return from MPG jog mode to keyboard jog mode?

59
I have the same problem in simulation mode with the default xml file. If I press any arrow key, the feedrate jumps to 0 and jumps back to whatever is defined if i release the arrow key. And if the feedrate is zero, then the axis doesn't move. But is there any other feedrate for jogging? Or any option?

60
Hello,

as a newbie I've just configured my lathe and successfully machined my first part. But I've still a problem with jogging with the arrow keys. If I go to manual mode, switch "Jog on", nothing happens when I press the arrow keys. With "Jog inc" the axis moves, but not in continuous mode. What do i wrong?

Pages: « 1 2 3 4 5 6