Hello Guest it is December 12, 2019, 01:50:48 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.

Topics - secretspy711

Pages: 1
I am trying to get the following script to work, which is based on the one from here: https://www.youtube.com/watch?v=6-4JkDv9AgM.
I am having some trouble figuring out how to get it to actually update the Z axis DRO using the difference between the current and selected tool length offsets.  Can someone please help?

Code: [Select]
local inst = mc.mcGetInstance()

--change lines here to either auto rapid, or manually jog to a tool change position
--Manual Lines. Uncomment line below to allow you to manually jog to a tool change position.
--local MyChoice = wx.wxMessageBox("Click OK, \nThen Jog to A Safe Tool Change Position,\nInsert New tool,\nThen Click Cycle Start.","Click OK to continue" , 16)
--Auto Lines.  Uncomment both lines below (and comment out local MyChoice line above) to automatically move to tool change position.
--Edit to include the machine coordinate values of that tool change position.

mc.mcCntlGcodeExecuteWait(inst, "G90 G53 G0 Z0")--Move Z all the way up.
mc.mcCntlGcodeExecuteWait(inst, "G90 G53 G0 X-16 Y-12")--Move to X, Y Coords for tool change position.
mc.mcCntlSetLastError(inst, 'Now in Tool Change Position. Hit Cycle Start!')
local posmode = mc.mcCntlGetPoundVar(inst, mc.SV_MOD_GROUP_3) --get the current mode so we can return to it when macro ends
local selectedtool = mc.mcToolGetSelected(inst)
local currenttool = mc.mcToolGetCurrent(inst)
local currenttoollen = mc.mcToolGetData(inst, mc.MTOOL_MILL_HEIGHT, currenttool)
if selectedtool == currenttool then
mc.mcCntlSetLastError(inst, "Current tool == Selected tool so there is nothing to do")
wx.wxMessageBox("1. Change to tool " .. tostring(selectedtool) .. "\n2. Then press Cycle Start to perform auto TLO" )
mc.mcCntlToolChangeManual(inst, true);
mc.mcCntlSetLastError(inst, "Current tool == " .. tostring(selectedtool) .. "   Previous Tool == " .. tostring(currenttool))
mc.mcToolSetCurrent(inst, selectedtool)

local MyChoice =
--wx.wxMessageBox("Click Ok to Begin Probing the New Tool","Click OK to continue" , 16)
mc.mcCntlSetLastError(inst, "Probing in Progress!")
mc.mcCntlGcodeExecuteWait(inst, " G90 G53 G0 X-.4 Y-.54")--go to TLO position
mc.mcCntlGcodeExecuteWait(inst, " G91 G1 Z-3 F30")--go down a little to save time.
mc.mcCntlGcodeExecuteWait(inst, " G91 G31 Z-2 F5")--probe the new tool fast
mc.mcCntlGcodeExecuteWait(inst, " G91 G1 Z.125 F30")--pull off the touch pad a little
mc.mcCntlGcodeExecuteWait(inst, " G91 G31 Z-.135 F2")--probe the new tool slow

local probedz =
mc.mcCntlGetPoundVar(inst, mc.SV_PROBE_POS_Z) -- Z Probe position in Machine coords
mc.mcCntlGcodeExecute(inst, string.format('G ' .. posmode))--return to pre macro mode G90, or G91
mc.mcCntlGcodeExecuteWait(inst, "G00 G53 Z0 ")--Retract
local NewOffset = probedz
mc.mcToolSetData(inst, mc.MTOOL_MILL_HEIGHT, selectedtool, NewOffset)
mc.mcCntlSetLastError(inst, string.format("Auto tool setting complete, Offset = %.4f", NewOffset))
wx.wxMessageBox("Toolchange Complete.\nTLO Set")


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

General Mach Discussion / Is this a "look ahead" problem?
« on: December 26, 2018, 02:16:56 AM »
I'm getting this weird corner on a part I machined today in polycarbonate.  It's supposed to be round, just like the adjacent corner and in the model, but it's like the machine started turning the corner too early and then created this sharp-ish corner instead of a nice round.  The opposite corner did the same thing.  Also the radius on the lower section looks too large.

Could this be due to the # of look-ahead lines being too low, or the motor acceleration values being too low?

Backlash compensation is turned OFF.

Images here:

Does Mach4 have a "skip optional block" function?
For example, on a Haas machine, if a block of gcode has a "/" before each line, all of those lines are optional and can be skipped by the operator.

The closest functionality I have found is to insert a M00 or M01 before the block I want to be optional, with a comment that tells the operator to manually skip to the next op if desired.  But that's a little cumbersome.

Mach4 Toolbox / M6: how to add manual spindle RPM with tool change?
« on: October 01, 2018, 12:49:13 PM »
I am using a trim-router as a spindle on my homebuilt machine.  Mach4 controls on/off, but for now, I have to set the speed manually until I get a VFD or SuperPID controller.

I would like to modify my M6 script to get Mach to tell me what RPM to set, in addition to the tool number.  Can someone show me an example script for how to do this?

Pages: 1