Hello Guest it is April 27, 2024, 02:34:13 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 - barneskite28

Pages: « 1 2 3 4 5 6 7 8 »
41
Mach4 General Discussion / Buggy config in mach4
« on: May 23, 2021, 11:47:45 AM »
Hi Guys,
 In my ongoing saga trying to get a smooth toolchange working, i have found that the radio buttons for config>control>tools keeps reverting to t on m6 line is next tool! i have reset this multiple times but it keeps reverting back to the same setting.
Has anyone experienced this before?

42
Mach4 General Discussion / Re: Tool Length Offset Macro Program
« on: May 23, 2021, 09:12:57 AM »
I have seen A LOT of people asking about a tool length offset macro.
I made this Macro Program (G Code) for my tool length offsets. 

This is not a Macro in the sense of Mach4 Macros.  This is a Macro B Program.  It is G Code.

Put the 9001 and 9002 programs in the Subroutines folder in the Mach4 Directory.
Put two buttons on the screen to probe the tool length offset and to probe a rotating tool.  One or both, you do you.
Put the attached scripts into the appropriate button script.
This will probe the current tool that is active in Mach4. 

This Macro Program will set the tool offsets at a Machine Position.  So homing the Z Axis is a must for this to work well for you.
This will set every tool to the same position (your tool setter).  So you can (and need to) set your Z Work Offset with any tool that has been touched off.
You MUST have your Tool Height Offset active when you set your Z Work Offset. 
You MUST have your Tool Height Offset active when you set your Z Work Offset.
You MUST have your Tool Height Offset active when you set your Z Work Offset.

The rotating tool probe will use the diameter value in the tool table.  So be sure to put something in there if you intend to use that one. 
It will offset half of the diameter and rotate CCW and probe slow.  This is for tools tool large for the tool setter (exp:  Face Mills)

You will see variables inside the code that you will need to change for yourself.
Tool Setter X and Y positions. 
Feedrate for fast probe and slow probe.
Lift Height after fast probe.
ETC.....
Just be sure to adjust to your own needs. 

I also use G31 instead of G28 so I be sure you have something 0.000 in #5183 (I think it's #5183) so it will go to Z Home; or change it to G28, or take it out and make sure you put a safe Z in there first.

USE AT YOUR OWN RISK. 
I am using Mach4 Hobby so I'm not able to do conditions in the Macro Program for safety checks. 
Check the macro manually first.  Get it set up, hit the probe button and press the tool setter manually and be sure everything works.
As always when using CNC Machines, be safe and diligent.   
How do you call this subroutine in an m6?

43
Mach4 General Discussion / Re: Tool Length Offset Macro Program
« on: May 15, 2021, 05:34:02 PM »
GREAT! SEEMS TO WORK PERFECT!
Just need to figure out how to call the subroutine during the m6 script

44
Mach4 General Discussion / Re: Again with the tool setter
« on: May 13, 2021, 11:22:02 AM »
Try this version of the code, read the comments first.
Code: [Select]
function M6()
    local inst = mc.mcGetInstance();
    local changeToTool = mc.mcToolGetSelected(inst)
    local changeFromTool = mc.mcToolGetCurrent(inst)
    local XPositionBeforeToolChange = mc.mcAxisGetPos(inst,0)
    local YPositionBeforeToolChange = mc.mcAxisGetPos(inst,1)
    local XToolProbePosition = "1" -- Change to position of probe in X
    local YToolProbePosition = "1" -- Change to position of probe in Y
    local XManualToolChangePosition = "2"
    local YManualToolChangePosition = "2"
    local ColletAtProbeZCoordinate = -105 -- Machine Z-coordinate when collet tip touches TouchPlate (Must be more than ProbeOperationDistance - DefaultToolLength
    local ExtraProbeDistance = 5 -- SafetyMargin
    local ProbeOperationDistance = -50 -- Length of Probemove before giving up
    local ProbePrepSpeed = 100
    local ProbeSpeed = 25
    local DefaultToolLength = 70 -- Used if tool info is not found. (Should be a value slightly longer than the longest tool in the shop :D)
        -- QUICK REFERENCE
        -- G90 - Absolute (Go to coordinate)
        -- G91 - Incremental (Godistance along axis from current position)
        -- G53 - Machine Coordinate Move

    if changeToTool == changeFromTool then
    return
    mc.mcCntlSetLastError(inst, "ToolChange Activated But Not Required")
    else
    mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 Z0.0\nM5" )
    RunProbe(inst,changeFromTool,XToolProbePosition,YToolProbePosition,DefaultToolLength,ColletAtProbeZCoordinate,ExtraProbeDistance,ProbePrepSpeed,ProbeSpeed,ProbeOperationDistance)
    local ToolZCoordinate = mc.mcAxisGetPos(inst,2)
    mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 Z0.0 \n G90 G53 G0 X"..XManualToolChangePosition.." Y"..YManualToolChangePosition)
    local changeToToolDescription = mc.mcToolGetDesc(inst,changeToTool)
    wx.wxMessageBox("Please change to tool number "..changeToTool.." "..changeToToolDescription.." and press ok to continue")
    RunProbe(inst,changeToTool,XToolProbePosition,YToolProbePosition,DefaultToolLength,ColletAtProbeZCoordinate,ExtraProbeDistance,ProbePrepSpeed,ProbeSpeed,ProbeOperationDistance)
    mc.mcAxisSetPos(inst, 2 , ToolZCoordinate)
    mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 Z0.0")
    mc.mcCntlGcodeExecuteWait(inst,"G90 G0 X"..XPositionBeforeToolChange.." Y"..YPositionBeforeToolChange)
    mc.mcToolSetCurrent(inst, changeToTool)
    wx.wxMessageBox("If Toolchange was Sucessful - click ok to continue")
    mc.mcCntlSetLastError(inst, "ToolChange Finished")
    end
end

function RunProbe(finst,ftool,fXToolProbePosition,fYToolProbePosition,fDefaultToolLength,fColletAtProbeZCoordinate,fExtraProbeDistance,fProbePrepSpeed,fProbeSpeed,fProbeOperationDistance)
    mc.mcCntlGcodeExecuteWait(finst, "G90 G53 G0 X"..fXToolProbePosition.." Y"..fYToolProbePosition)
    local toollen = mc.mcToolGetData(finst, mc.MTOOL_MILL_HEIGHT, ftool)
    if toollen == 0 then
        toollen = fDefaultToolLength
        mc.mcCntlSetLastError(finst, "Tool length not found - using Default Length")
    end
    local probestart = fColletAtProbeZCoordinate + fExtraProbeDistance + toollen
    local GCODE = "G91 G31 Z"..probestart.." F"..fProbePrepSpeed
    GCODE = ""..GCODE.." \n G91 G0 Z1 F"..fProbePrepSpeed.." \n G91 G31 Z"..fProbeOperationDistance.." F"..fProbeSpeed
    mc.mcCntlGcodeExecuteWait(finst,GCODE)
end

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

Tried the code and got the following message in the output window


stack traceback:
   [C]: in ?
   [C]: in function 'require'
   C:\Users\cnc\AppData\Local\Temp\.2D69.tmp:1: in main chunk
   [C]: in ?
Program completed in 0.07 seconds (pid: 2224).

Not sure about this

45
Mach4 General Discussion / Re: Again with the tool setter
« on: May 10, 2021, 03:45:02 PM »
You may have seen this already but this video provides a good walkthrough of setting up the tool offsets in Mach4 https://www.youtube.com/watch?v=tywAByswH2Q
Yes i saw that, but it does not really explain how to use mach with a fixed tool setter, and what procedure top use in context with a program setup, this is not clear.  It shows one method, no relation to tool table and job setup g54

46
Mach4 General Discussion / Re: Tool Length Offset Macro Program
« on: May 10, 2021, 03:35:37 PM »
The macro I put in the zipped folder is not LUA.  Using the program I put in the zipped folder, you’ll need to make sure the tool height offset is active when setting your z work offset. It doesn’t matter when you probe the tool. It only uses the machine coordinates to get the information it needs.
That's great. I used to be a cnc operator 20 years ago but I'm no coder!  I am used to cnc where you put the new cutter in, set the WPC and go..... I'm trying to set up my self build the same so have not been involved with developing lua script etc, though i have some success all i need is for mach to know the difference in tools and bring them to the right place!
Tim

47
Mach4 General Discussion / Re: Tool Length Offset Macro Program
« on: May 10, 2021, 03:26:46 PM »
Wow, you guys are blowing my head with the Lua.... i'm a mechanical guy lol! i have a lua Script, please forgive the amature question, but am i right or wrong in the following,

1. tool offsets off when probing fixed tool setter
2. Tool offsets on when zeroing surface of material

Thanks TIA
 

48
Mach4 General Discussion / Re: Again with the tool setter
« on: May 03, 2021, 06:12:39 PM »
Don't remember exactly, but I was searching for it. I'm not a programmer and I don't really have a grasp on the scripting for Mach so I started from searching. I actually used the code from the Mach support video, which seemed to be ok ISH... IE. it was simple, seemed to work but the tool lengths were coming out wrong- repeatable but still not bringing all the tools to the same wpc z0.

49
Mach4 General Discussion / Re: Again with the tool setter
« on: May 03, 2021, 04:51:29 PM »
Hi Graham,
I will get some photos later of the machine. I know the distance in machine coordinate from z home to the trigger point, and the xy of the tool setter. I got the script to do a calculation for the tool length, which seemed to be ok (all tools set with offsets off), but when I tried to set the wpc z0 with a shim on the offsets page, it was not correct. It was a 0.1mm shim on the top of the stock, entered in the offsets page and the dro changed to 90 mm or so.  Only if I enter 0.1 in the program run page does it read right.
Next thing I ran a program with 2 tools, and Mach completely ignored the toolchange twice. Re started the program, it went for the tool change, measured the tool and the height was all wrong.
I have in my script to turn the tool offsets off after the change, then measure, then in the gcode the tool offset is called straight after.
On the tool panel the offset number did not match the tool offset called by the program or the tool in the spindle..
Seems very buggy and not reliable, but I hope it's just me doing something wrong!
Much appreciated Graham!

50
Did you get anywhere with this? i'm having some problems too

Pages: « 1 2 3 4 5 6 7 8 »