Hello Guest it is December 01, 2021, 07:37:48 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.

Topics - jorgenbli

Pages: 1
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.

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.

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?

I am setting up a CNC router, 2500x1800 mm, with a linear ATC running on a CSMIO IP-A controller. I will surround the machine with safety light curtains to make the machine safe to use according to EU Machinery Directive. However I am not sure what is the best way to implement such a safety feature.  What is best practice on this area?

Is it sufficient to let Mach4 go into feed hold and turn off spindle if the light curtain is triggered? Or should the machine go into E-stop mode and disable power to the servos and spindle?

My main concern is that I will need to be inside the curtains for setting up the work piece while jogging the machine with the hand wheel. Is this considered "unsafe" if I limit the max allowed rapid speeds while being inside the curtains?

Thankful for any input on this.

Feature Requests / Comment field in Fixture Offset Table Mach4
« on: July 14, 2018, 09:01:13 AM »
It would be helpful if you could add another column in the fixture table that allow the user to write a comment on what the fixture position is used for. As of now I regularly forget where I store the different fixture coordinates.

Mach4 General Discussion / machine.ini file corrupted on mach4
« on: May 23, 2018, 11:09:27 AM »
The machine.ini file is suddenly corrupted and I only have a very old backup of the file, so I hope someone can help me out recovering it.

I think the file got corrupted because a user of the machine shut down Mach4 during initialization of the program, probably just when mach4 read from the file. Do you know if it stored a backup somewhere, or does any of you know a way to restore the attached file (had to zip it to allow upload). File appears to be full of data, however not something I am able to read with notepad or notepad++.

I'm making a macro for probing the work piece. I put a probe block on the work piece or table top, and lowers the spindle until getting contact with the block. When contact I want to set the current fixture offset to zero. However I cannot find a way to read out which is the current active offset, and write to this same offsets Z-position.

This could be the same functionality that is in the Zero z button on mach4 mill screen, but I don't fin what is behind that button. Any Ideas on which pound variables to write to or other ways to solve it?

Running mach4 3390 on wx4 screen. When I click the Reference All Axes button the homing cycle starts, but is interrupted by the limit switch being triggered. Is there a way to tell Mach4 to disable the limit switch inputs while homing? I use the same switches for homing and limits, and this setup worked perfectly on the version 2803 which I had before I upgraded. Any ideas on how to solve this?

CS-Lab / CSMIO-IP/S or CSMIO-IP/A for a servo controlled router
« on: February 23, 2017, 06:48:58 PM »
I am planning to rebuild an old MultiCAM router to servo control. Now I start to realize that servo control is more than servo control. At least I have decided I want to use Mach 4 and a controller from CSMIO. But which should I use; the analog IP/A or the step/dir controller IP/S? Has any of you experience with setting up one of these with servo drives and can give me some recommendations? What will the drawback of a step/dir servo system be?

Which is the most affordable option, step/dir or analog control? Should I choose AC or DC servo? These are just a few of my questions. But anything that can point me in a direction is welcome.

Pages: 1