Hello Guest it is May 28, 2020, 02:20: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 - jorgenbli

Pages: 1 2 3 »
Is there a way to avoid that mach4 forgets the current spindle speed setting after stopping a program. Sometimes I need to stop a program somewhere into it, and when I then start up the program again (from where I stopped it), the spindle will start at its default lowest speed.  In order to fix this, I need to issue an S command on the MDI every time before starting within a program. This annoys me, as I see no reason why the spindle speed is reset at stop.

Awesome. Thank you!

I'was able to add scripts to stop, reset and feed hold buttons. However, I couldn't find a way to add to the disable buttton and the e-stop routine. Any suggestions?

Tried another version, and tried without the controller. So it looks like it's not supported in the screen set (wx4). I am able to add the g-code in a script for each button, or in the function in the screen load script using, for example, mc.mcCntlMdiExecute(inst, "M9"). However, I find it very strange that such a thing isn't included by default. Especially for the M62 M63 scripts that are designed to control lasers. If you hit the e-stop, feed hold, cycle stop, reset or disable button the laser should switch off without every user having to figure out a way to implement it in the screen.

I'd like to use mach4 to control a laser, using M62/M63 However, if I have to stop the program by the stop button, or even by the emergency stop button, the output does not stop. Is this a bug in mach4 (build 3804)?
I thought I could rather use M8/M9 to control the output, however, I get the same problem here also. The output stays open even if I hit the emergency stop button. Controller is a CSMIO IP-M.

General Mach Discussion / Re: Configuring a light curtain for a CNC router
« on: November 30, 2018, 04:10:46 PM »
Thanks MadDog,
The machine is for my company and will be operated by others than me. The main goal is to avoid anyone getting hurt by it. At the same time, it should be possible to operate it to set work zero etc easily while being inside the curtains. I know on CNC mills it is usually possible to jog the machine with the main door open, and even run the spindle at low rpm.

General Mach Discussion / Re: Configuring a light curtain for a CNC router
« on: November 29, 2018, 10:19:13 PM »
I'm currently working on this setup and this is what I want to happen when the curtain is triggered:
- Stop a running program
- Spindle start not allowed
- Limit max allowable speeds
- Disable JOG, CYCLE START and SPINDLE START buttons
The intention is that after the light curtain has been triggered it can only be moved by the MPG handwheel, and it will be necessary to "reset" the curtain from a button within mach4 to allow the machine to work normally again.

However, are any of you aware of a way that I can the disable the spindle and limit the feed rates? Are there any pound variables or other ways to set these? And are there any way to disable the buttons in mach4?
Thanks for any input.

Mach4 General Discussion / Improve M6 macro for linear ATC
« on: July 18, 2018, 06:16:25 PM »
I am setting up a machine with a linear ATC. The script is based on the example in the Lua scripting guide in the documentation folder of Mach4. The script is working somehow, but there is an issue if you hit the Stop button during a tool change as this causes Mach4 to believe the tool change is finished even though it might haven't done anything yet.

Is there a way to make sure the macro is terminated if the Stop button is hit while the tool change is ongoing?
The only way I could think of solving this is to compare the requested tool change position with the actual machine position before and after the tool is but back or released - and if it doesn't reach that position I could return from the script. But if there is an easier way to see if the Stop button was hit that would be better.

Code: [Select]
package.path = wx.wxGetCwd() .. "\\Profiles\\Mach4Mill\\Modules\\?.lua;"
if(package.loaded.ToolChangePositions == nil) then
tcp = require "ToolChangePositions"

function m6()

local inst = mc.mcGetInstance()
local SelectedTool = mc.mcToolGetSelected(inst)
local CurrentTool = mc.mcToolGetCurrent(inst)

--  local xstart = mc.mcAxisGetMachinePos(inst,0)
--  local ystart = mc.mcAxisGetMachinePos(inst,1)

local en_axis = 0
        local Is_Enabled = mc.mcAxisIsEnabled(inst, en_axis)
            if Is_Enabled == 1 then
                local is_Homed = mc.mcAxisIsHomed(inst, en_axis)
                if is_Homed ~= 1 then
                mc.mcCntlEnable(inst, 0)
                wx.wxMessageBox("RESET: Machine was not referenced")
        en_axis = en_axis + 1
    until( en_axis == 6 )

if SelectedTool == CurrentTool then
mc.mcCntlSetLastError(inst, "No need for tool change!")
do return end
    ------ Get current state ------     
local CurFeed = mc.mcCntlGetPoundVar(inst, 2134)   
local CurFeedMode = mc.mcCntlGetPoundVar(inst, 4001)   
local CurAbsMode = mc.mcCntlGetPoundVar(inst, 4003)

     ------ Get position data for current tool ------
ToolData = tcp.GetToolData(CurrentTool)

if (ToolData ~= nil) then     
Num1 = ToolData.Tool_Number   
XPos1 = ToolData.X_Position     
YPos1 = ToolData.Y_Position     
ZPos1 = ToolData.Z_Position 
mc.mcCntlSetLastError(inst, "ERROR: No place for this tool. Tool number out of range!")
do return end

 ------ Get position data for next tool ------
ToolData = tcp.GetToolData(SelectedTool)

if (ToolData ~= nil) then     
Num2 = ToolData.Tool_Number     
XPos2 = ToolData.X_Position     
YPos2 = ToolData.Y_Position     
ZPos2 = ToolData.Z_Position
mc.mcCntlSetLastError(inst, "ERROR: Requested tool number out of range!")
do return end

------ Move to current tool change position ------     
local GCode = ""     
GCode = GCode .. "G00 G90 G53 Z0.0\n"     
GCode = GCode .. string.format("G00 G90 G53 X%.4f Y%.4f\n", XPos1, YPos1-100)     
GCode = GCode .. string.format("G00 G90 G53 Z%.4f\n", ZPos1)     
GCode = GCode .. string.format("G01 G90 G53 Y%.4f F100\n", YPos1)
mc.mcCntlGcodeExecuteWait(inst, GCode)         

wx.wxMessageBox("Machine will now open drawbar")

------ Release drawbar ------     
local DrawBarOut = mc.OSIG_OUTPUT10     
local hsig = mc.mcSignalGetHandle(inst, DrawBarOut)     
mc.mcSignalSetState(hsig, 1)

------ Move to current tool change position ------     
local GCode = ""     
GCode = GCode .. string.format("G00 G90 G53 Z%.4f\n", ZPos1+20)
GCode = GCode .. string.format("G00 G90 G53 X%.4f Y%.4f\n", XPos2, YPos2)     
GCode = GCode .. string.format("G00 G90 G53 Z%.4f F100\n", ZPos2)     
mc.mcCntlGcodeExecuteWait(inst, GCode) 

------ Clamp drawbar ------     
mc.mcSignalSetState(hsig, 0)

------ Retract from tool holder ------     
local GCode = ""   
GCode = GCode .. string.format("G00 G90 G53 X%.4f Y%.4f\n", XPos2, YPos2-100)   
GCode = GCode .. "G00 G90 G53 Z0.0\n"   
mc.mcCntlGcodeExecuteWait(inst, GCode)

------ Reset state ------     
mc.mcCntlSetPoundVar(inst, 2134, CurFeed)     
mc.mcCntlSetPoundVar(inst, 4001, CurFeedMode)     
mc.mcCntlSetPoundVar(inst, 4003, CurAbsMode)

    -- mc.mcCntlGcodeExecuteWait(inst, "G90 G53 G0 X"..xstart.." Y"..ystart)  --back to initial position
mc.mcToolSetCurrent(inst, SelectedTool)             -- change to new tool
    mc.mcCntlSetPoundVar(inst, 2032, SelectedTool) -- set height offset number
    mc.mcCntlGcodeExecuteWait(inst, "G43 H"..SelectedTool)

mc.mcCntlSetLastError(inst, string.format("Tool change finished - Tool: %.0f", SelectedTool))


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

Is there an easy way to make all buttons except "Reference All Axes" disabled before the machine has been homed?
I use the Wx4 screenset. As of now if I have put a check in the M6 script to avoid a tool change if the machine is not referenced. However, it is still possible to jog the machine out of its limits and even run any g-code which could cause the machine to crash. Any ideas?

The thing with that directive is that it doesn't state any very specific requirements. It is up to the machine builder to decide what is safe for the user of the machine. However I found this document now with some guidelines. http://www.hse.gov.uk/pubns/wis22.pdf

But it is still interesting to hear what your experiences are when i comes to safety for the operator.

Pages: 1 2 3 »