Hello Guest it is April 23, 2024, 11:56:35 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 - rafiki

Pages: 1
1
Mach4 General Discussion / M6 Script Problem
« on: May 19, 2020, 10:10:01 AM »
I have written the simplest possible script to position the tool over a touch plate at machine zero, capture the Z, change to a new tool,  and update the Z axis for the new tool.

This code runs just fine, but Mach exhibits bizarre behavior.  After the code runs the Z work zero can be off by anywhere between a few hundreths of a mm to 50mm.  This happens even if you leave the same tool in before and after the change.

Code: [Select]
function m6()

local inst = mc.mcGetInstance()

local selectedTool = mc.mcToolGetSelected(inst)
local currentTool = mc.mcToolGetCurrent(inst)

local MoveDistance = -15     
local MoveSpeed = 15                   

local TouchZ
local CycleWait

  if selectedTool == currentTool then
mc.mcCntlSetLastError(inst, "Current tool same as selected tool.  No tool change required.")
  else
    mc.mcCntlSetLastError(inst, "Tool Change")

mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 Z0.0 X0.0 Y0.0")

CycleWait = mc.mcCntlWaitOnCycleStart(inst, "Position the tool less than 1/2 inch over the touch plate and click Start", 1000000)

mc.mcCntlGcodeExecuteWait(inst,"G91 G31 Z"..MoveDistance.." F"..MoveSpeed)

TouchZ = mc.mcAxisGetPos(inst, 2)

mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 Z0.0")

CycleWait = mc.mcCntlWaitOnCycleStart(inst, "Change the tool, reposition it over touch plate and click Start", 1000000)

mc.mcCntlGcodeExecuteWait(inst,"G91 G31 Z"..MoveDistance.." F"..MoveSpeed)

mc.mcAxisSetPos(inst, 2, TouchZ)

mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 Z0.0")
 
mc.mcToolSetCurrent(inst, selectedTool)

CycleWait = mc.mcCntlWaitOnCycleStart(inst, "Turn the spindle on, click cycle start, and we are cutting.", 1000000)

mc.mcCntlSetLastError(inst, "Tool Change Completed.")
  end

end

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

It seems like there is a bug somewhere in Mach4.  I don't see any line in this code that could possibly cause this behavior.  Also, the touch screen hangs, and this code hangs if I run either of them after a fresh boot of Mach4.  After Mach4 loads I need to load a GCode file and start it before the touch screen or this script will run properly.

Very frustrating.

2
Mach4 General Discussion / Mach4 precision problems
« on: April 29, 2020, 12:59:44 PM »
The attached image shows a piece I cut with Mach3 on the left, and the same piece I cut with Mach4.  As you can see, I suffered an extreme loss of precision.

I have a homemade 3-axis mill.  I replaced the Mach3 controller board with a pokeys57cnc motion controller for mach4; otherwise, it is the same machine and the same part files.

Any ideas?

Pages: 1