Hello Guest it is May 16, 2021, 11:52:42 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 - da40flyer

Pages: 1
1
Mach4 General Discussion / Button for Auto Z-Zeroing Tool
« on: March 18, 2017, 08:52:03 PM »
I am relatively new to CNC and certainly a novice at coding...

I have watched Daz's M6 tool change videos several times and believe I have grasped the concepts.  Thank you for posting those  :)

I have a gantry mill with an ER collet and want to automate z-zeroing my tools.  I do not use M6.  I use separate gcodes at each tool change.  This is a hobby, so production efficiency is not needed.

With that, I want to create a Button on my main screen which will run an auto Z-zeroing sequence.  All of my tool lengths are 1.75 - 2 inches and I do not want to use the tool table.
I would rather provide enough space below my longest tool and the height sensor which will cover me.

My basic work process today:
Reference all axis Home, Load gcode into M4, manually set Work Coord X0 Y0, install tool and manually set Work Coord Z0, run gcode, when complete I change the tool for the next procedure, manually re-zero Work Coord Z for new tool, return to Work Coord X0 Y0, load new gcode and run, repeat as necessary...

This is what I came up with for the coding.  It is fairly basic.  If anyone has suggestions, sees any glaring mistakes, or if I missed a step, please let me know.  I appreciate it!

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

-- set height of Z axis at start of probe in Machine coordinates
local probestart = -2.5

-- move Z to safe location = Z0 in Machine Coords
mc.mcCntrlGcodeExecuteWait(inst, "G90 G53 G0 Z0")

-- move to probe location in Machine coordinates
mc.mcCntrlGcodeExecuteWait(inst, "G90 G53 G0 X3 Y0")

-- Move to probe start position, begin probe move, save Z Work coordinate value
mc.mcCntrlGcodeExecuteWait(inst, "G90 G53 G0 Z"..probestart)
mc.mcCntrlGcodeExecuteWait(inst, "G91 G31 Z-1 F2")
local toolz = mc.mcAxisGetPos(inst,2)

-- Move to tool change location in Machine coordinates
mc.mcCntrlGcodeExecuteWait(inst, "G90 G53 G0 Z0")
mc.mcCntrlGcodeExecuteWait(inst, "G90 G53 G0 X12")
wx.wxMessageBox("Change Tool and Press OK to Continue")

-- Move back to probe location and probe again, set new Work Z coord to previous measurement = toolz
mc.mcCntrlGcodeExecuteWait(inst, "G90 G53 G0 X3 Y0")
mc.mcCntrlGcodeExecuteWait(inst, "G90 G53 G0 Z"..probestart)
mc.mcCntrlGcodeExecuteWait(inst, "G91 G31 Z-1 F2")
mc.mcAxisSetPos(inst,2,toolz)

-- Move to Machine Coord Z0 and return to Work Coord X0 Y0
mc.mcCntrlGcodeExecuteWait(inst, "G90 G53 G0 Z0")
mc.mcCntrlGcodeExecuteWait(inst, "G90 G54 G0 X0 Y0")

wx.wxMessageBox("Tool Change Complete")

2
Mach4 General Discussion / Touch Button - Outside Diameter
« on: March 01, 2017, 03:29:55 PM »
Looking at the measurements that can be taken under the "Touch" button, I see one for finding the center of a hole. 
Is there one for finding the center of a solid rod (measuring via the outside diameter)?

3
Mach4 General Discussion / Setting Soft Limits On as the Default
« on: May 20, 2016, 03:53:15 PM »
Is there a way to set the soft limits to ON as the default?

Pages: 1