Hello Guest it is April 25, 2024, 04:48:47 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 - Graham Waterworth

871
Mach4 General Discussion / Re: Lathe Tool Turret Change M6
« on: February 08, 2017, 06:58:27 PM »
I have not tried this but I would think this is all the code you need.

-- Mach4Turn 8 positon tool Turret

 function m6()
 
 inst = mc.mcGetInstance()
 selectedtool = mc.mcToolGetSelected(inst)
 currenttool = mc.mcToolGetCurrent(inst)
 Ulock = 10    --'  Sets the Unlock Movement in Degrees Value
 Rlock = 10   -- ' Sets the Relock Movement in Degrees Value 
 T1SafePosX =  2.25
 T1SafePosZ =  1.5
 
if (selectedtool > 8) or (selectedtool < 1) then
    mc.mcCntlSetLastError(inst,"Program Stopped due to Tool Number Out of Range")
       do return end
end
     
if (selectedtool == currenttool) then
    mc.mcCntlSetLastError(inst,"Tool is the same NO tool change needed")
    do return end
end

 --'------------------- Move to Safe Tool Position -----------
mc.mcCntlSetLastError(inst," Move to Tool Safe Pos")
mc.mcCntlGcodeExecuteWait(inst, "G1 F30 X" .. T1SafePosX);
mc.mcCntlGcodeExecuteWait(inst, "G1 F40 Z" .. T1SafePosZ);
mc.mcCntlSetLastError(inst,"Safe XZ Move Completed")

 --'------ Begin Tool Change , UNLOCK turret --------------
 
 mc.mcCntlSetLastError(inst," Tool Turret UNLOCKING ")
 mc.mcCntlGcodeExecuteWait(inst, " G91");   --'Set to INC
 mc.mcCntlGcodeExecuteWait(inst, " G92 C0");
 
 --'------ Select Tool ------------------------------------
 
 mc.mcCntlSetLastError(inst,"Moving to Tool# " ..selectedtool )
    if (selectedtool > currenttool) then
       Moves =  selectedtool - currenttool
    else   
        Moves = ((8 - currenttool) + selectedtool)
    end           
mc.mcCntlSetLastError(" G00 C " ..Moves);   
Moves = (Moves * 45) + Ulock
mc.mcCntlGcodeExecuteWait(inst, " G00 C" ..Moves);       
mc.mcCntlSetLastError(inst,"Tool#1 Loaded")
mc.mcCntlSetLastError(inst," Tool Turret LOCKING ")
mc.mcCntlGcodeExecuteWait(inst, " G92 C0");
mc.mcCntlGcodeExecuteWait(inst, " G00 C-" ..Rlock ); --   ' Lock Turret
mc.mcCntlGcodeExecuteWait(inst,  "G92 C0");
mc.mcCntlGcodeExecuteWait(inst,  "G90");   --' Reset to ABS

tool = selectedtool
 
mc.mcToolSetCurrent(inst, selectedtool)

if (mc.mcInEditor() == 1) then
   m6()
end

end

872
General Mach Discussion / Re: 8 position lathe toolchanger
« on: January 26, 2017, 07:20:06 AM »
There is a M6Start.m1s on here somewhere to run that tool changer using the DC motor I know this because I did the code for it.


873
Slow PC's do that, some fast ones too

874
Mach Screens / Re: Key simulators
« on: January 20, 2017, 03:00:25 PM »
From the Macro Programmers Reference Manual

GetUserLabel
Function GetUserLabel(LabelNu
m As Integer) As String
This function allows the user to retrieve the
value of an on-screen User label.  “User”
labels are those that are create
d in the screen designer with
the default text containing the
String “UserLabel” followed by one or more digits.
Arguments
:
LabelNum is the numeric portion of the user label default text
.  LabelNum must
be between 0 and 255.
Return Value:
            None           
Example:
‘ Change the text in UserLabel25
SetUserLabel(25, “This is Label 25”)
Page 36
...
‘ Retrieve the text from UserLabel25
LabelText = GetUserLabel(25)
See also: 
            SetUserLabel()           

875
Mach Screens / Re: Key simulators
« on: January 20, 2017, 02:47:21 PM »
Has each button got its own bit of VB code because the variables are local to that code so you need to save your string to a LABEL/DRO and read it back before you add to it and then re-save it back to the LABEL/DRO.

876
G-Code, CAD, and CAM discussions / Re: Quick Noob G28 question
« on: January 20, 2017, 07:35:24 AM »
The command G91 G28 X0 Y0 Z0 will send the machine to its home position.

877
General Mach Discussion / Re: ISO, BT, NT Taper angle
« on: January 08, 2017, 11:06:00 AM »
Thanks, that is what a German tooling company and I get but some forums and web site say different so I thought I would open it up to this forum to see what results I got.

878
General Mach Discussion / ISO, BT, NT Taper angle
« on: January 08, 2017, 07:53:03 AM »
I need to machine a spindle taper ISO, NT, BT all the same taper 7:24 included angle, here is my question :-

What angle do I program into the lathe?

ATAN(7/24)/2 or ATAN(7/48) ?????


879
G-Code, CAD, and CAM discussions / Re: Using an M98 sub call as a GOTO
« on: December 23, 2016, 06:06:28 PM »
You could write the g-code into a VB M code macro and use the VB side to to the jumps.

880
Share Your GCode / Re: G code for slowing Z axis
« on: December 16, 2016, 04:18:04 PM »
Why not wire the light output into Mach and use G31 to stop the Z axis when it sees the input.