Hello Guest it is June 13, 2024, 02:05:03 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 - boydage

Pages: 1 2 3 4 5 »
Many years experience with a router. Only just enough with a converted lathe. The lathe I installed a 1.5kw VFD driven motor, made a new saddle and added HG rails to the mix with some closed loop steppers. I bought a 4 tool square turret. Very rarely I need to use it for timber turning up decorative house parts that might consist of a 140mm ball so needed a huge amount of X travel for a long tool.

It took a while to get the 4 tool turret to change both with programming and electrical connections. But it works and does the job. The saddle retracts right back to about 10mm before the homing switch before the turret rotates to position.

I am using the tool table offsets and have used a Z tool setter in a jig in my chuck with a G31 move to touch off each tool in the X direction.

Ok. What I didn't setup was any way to drill. And, I now have a part to make in the 100s that needs to be drilled, and a taper honed out. I have a large amount of X saddle and travel. I am going to manufacture a gang tooling setup to sit on the saddle in front of the turret.

I thought I could add some tool-change lines into my tool-change macro which is based on the sensor outputs for the turret. And add in the offsets into the tool table. Was unsure how to set clearances as they will be different to the turret. After reading a bunch of posts I am asking if this is the correct way to set my machine up? I have read people are using G52 offsets, new to me.

With this information in hand. How would I best setup this gang tooling turret lathe to operate? Asking now whilst I am in the machine design stage where to begin in the place of getting it wrong a bunch of times and coming here with a QBL. (quivering bottom lip) because it either does not work or more likely my machine has crashed. Thanks in advance.

Mach4 General Discussion / Mach 4 Stop Cycle creates madness?
« on: January 29, 2024, 01:17:19 PM »
Im about 18 months into upgrading Mach 3 to 4 with an ESS. If I try to stop a cycle mid operation, the machine wont just halt what it is doing, it will lose position. Mostly noticeable in my Z axis, I will see it jerk and move about 5mm. I found a checkbox that I cant remember exactly what it was, something like "stop" was planned or something.

Regardless that did not fix my problem. I had this issue with another totally unrelated machine that if the e stop was hit it would haze out the PLC and the issue was an earth.

But this one, I tried to stop a cycle yesterday and it actually caused the part to be ruined. So here I am. Anyone have an idea or had this one happen?

Also - whilst I am in the mood. Do you guys shield and earth your stepper motor power conductors?

Mach4 General Discussion / Writing macro would someone please show light
« on: November 07, 2023, 01:18:34 PM »
Mach 4. I need to write a couple of simple macros to turn outputs on and off, a bit of a sleep time, with an input to boot. I have seen two types of code, one of them I know works fine I have put the script on a button after adding in some additional lines. But this one I came across and would be keen to know what its for, what it means as it has a hParam section which I do not understand.

So this is the one I am asking about:

function m162_setOutput(number)
   local Osig = mc.OSIG_OUTPUT0
   Osig = (Osig + number)
   local hReg = mc.mcSignalGetHandle(mc.mcGetInstance(), Osig)
   if( hReg ~= nil ) then
      mc.mcSignalSetState(hReg, true) --Turn the output on

function m162(hParam) --The param is a P value called from Gcode. M162P3 for example.
   if (hParam ~= nil) then
      local inst = mc.mcGetInstance()
      local varP = 0
      local flagP, rc = mc.mcCntlGetLocalVarFlag(inst, hParam, mc.SV_P)
      if (flagP == 1) then --Check that the flag has been set so we do not get an unexpected value for mc.SV_P
         varP = mc.mcCntlGetLocalVar(inst, hParam, mc.SV_P)

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

And this is the one I would normally use:

local inst = mc.mcGetInstance() --Get the instance of Mach4
local brake = mc.OSIG_OUTPUT1 --Save the name of the Signal (as stored inside of Mach4)
local ActivateSignalTime = 5000 --Time in milliseconds that we want the signal to be active.
local hReg = 0 --The handle to the signal
local rc = 0

hSig, rc = mc.mcSignalGetHandle(inst, brake)
if (rc ~= 0) then --There was error   
   mc.mcCntlSetLastError(inst, "There was an error")
   rc = mc.mcSignalSetState(hSig, 1) --Turn the output on
   if (rc ~= 0) then --There was error   
      mc.mcCntlSetLastError(inst, "There was an error")
      wx.wxMilliSleep(ActivateSignalTime) --Sleep for the commanded time (so that the output stays on as long as we want).
      rc = mc.mcSignalSetState(hSig, 0) --Turn the output off
      if (rc ~= 0) then --There was error   
         mc.mcCntlSetLastError(inst, "There was an error")

I need to write a brake on/off M10/M11 macro set which is the reason for this. Like I said I have managed to get the multiple outputs into a button script. If its a Macro do I need to do anything much differently except for name it and put it into the Macros folder? Btw I use ChatGpt and managed to write (with a lot of back and forth) a turret change for my lathe in Mach 3

General Mach Discussion / Couple offset questions Mach 3 Turn
« on: October 19, 2023, 06:58:59 PM »
I cant quite understand a couple of things. Mach 3 Turn.

4 post auto turret and the tool offsets appear to work but when I do a manual MDI toolchange the offsets dont appear to change in the DROs but I trust it works and it has been. I dont like just "trusting" something that only appears to work during an operation but it is what it is.

Today after homing the machine, I machined a part to gage accuracy. It ended up 0.1mm dia too small. So I jogged the tool to 0.1 and zeroed the DRO for the X axis. I restarted Mach, clicked "save offsets or fixture" And then restarted Mach 3. The X DRO did not come back at zero but with an offset like 28.0950 or something. I have no idea why? This was when using the mastertool. Is this a user error or a setting or?

I did wonder if I should have done a toolchange even though the tool was correct. Its disappointing when we being to mistrust our gear what should I do?

Really hope someone responds because this is a massive time waster. Please? Thanks in advance.

General Mach Discussion / Machj 3 Turn Tool Offset Questions
« on: September 01, 2023, 03:14:47 AM »
Hoping someone can put some clarification into this for me please:

1) If I set my tool 1 as a master do I need to call it a master somewhere or is tool 1 always the master?

2) Ok so I have set my master tool to zero on a surface. Next is to bring tools 2,3,4 up to the same surface, the X for example, and hit the touch X button. I have a 4 tool turret. When I change from tool #1 to tool #3 (example) I am setting the offset for. Do I change by T0301 or do I change it T0303 and then zero it. Found this a tad confusing.

3) Diameter mode. I use Fusion 360. Threading. This is a Fusion setting which asks for the thread depth. Do I set it to depth diameter or half being radius?

4) Setting the Z on a LH tool no problem. But if I am setting a LH tool up I am unable to touch the part on the X like the RH tool. Would I bring it up level with the X surface I touched off on?

5) Same for a grooving or cutoff tool. Which side of the tool do I touch off with? Ive seen both ways on youtube. Do I set the chuck edge or the forward edge?

Thanks in advance.

Novice coder. Lots of time using machines. I thought I would be able to write a specific piece of code for a 4 turret lathe toolchanger made from other samples I have found online. So many different ways to do it. But no easy path to learn from scratch. I plan to do it with a three phase reverse relay, spin the turret until the selected tool shows an input, reverse the turret to lock it. Toolchange done.

My problem is the Mach 3 VB editor only shows a "syntax error" every time but wont highlight or show where the problem is. Quite similar to troubleshooting an elec system with no meter - all it does is frustrate me.

I need some help please either in what I am doing wrong with the editor so its more useful, or, well thats it in a nutshell - what am I doing wrong? I thought the editor was supposed to jump through each line and highlight the piece of code that wont work. Hey if there is a more suitable editor would I be inclined to use that?

I dont even know the basic laws I am supposed to follow. This is the code I am trying to understand and get to work so I can at least test it on my machine.

'Tool change macro for 4 tool turret
Sub Main()
   'Sets variable OldTool to what is currently loaded
   'Sets Variable MaxToolNum to the max number of tools possible
   'Sets variable Newtool to the one being selected with M6 T#
   tool = GetSelectedTool()
        NewTool = tool   
   'Get positions before moving to do tool change
   x = GetToolChangeStart( 0 )
   'If the current tool loaded is 0 or greater than 4 then tool has been lost
   'so need to ask what tool is currently loaded
   While OldTool=0 Or OldTool>4
   OldTool=Question ("Current tool unknown, enter tool in spindle 1 to " & MaxToolNum)
   'Sets CurrentTool to Oldtool in case it was lost and entered above

   'When the tool asked for is invalid then this makes you select a valid tool
   While NewTool > MaxToolNum Or NewTool <1
   NewTool = Question ("Invalid tool chosen, enter tool number 1 to " & MaxToolNum)
        'If the tool asked for is the same one that is already loaded then exit macro
   If NewTool=OldTool Then
   Message "Tool already loaded or tool not specified with T# (ex:M6 T4)"
      Exit Sub
   End If

'Turn off soft limits if they are on
If GetOEMLED(23) Then
End If

   'Moves X axis to toolchange position

End If
Code"G53 X0 0"                              'Move to tool change location
While Ismoving()

If NewTool= 1 Then
              ActivateSignal(OUTPUT4) 'Begin rotating turret'
              If IsActive(INPUT1) Then 'Turret has rotated until selected tool is in position'
              DeActivateSignal(OUTPUT4) 'Stop turret from spinning"
              ActivateSignal (OUTPUT8) 'Reverse Turret"
              If IsActive(INPUT2) Then 'Tool locked signal'
              Exit Sub
If NewTool= 2 Then
              ActivateSignal(OUTPUT5) 'Begin rotating turret'
              If IsActive(INPUT1) Then 'Turret has rotated until selected tool is in position'
              DeActivateSignal(OUTPUT5) 'Stop turret from spinning"
              ActivateSignal (OUTPUT8) 'Reverse Turret"
              If IsActive(INPUT2) Then 'Tool locked signal'
              Exit Sub
If NewTool= 3 Then
              ActivateSignal(OUTPUT6) 'Begin rotating turret'
              If IsActive(INPUT1) Then 'Turret has rotated until selected tool is in position'
              DeActivateSignal(OUTPUT6) 'Stop turret from spinning"
              ActivateSignal (OUTPUT8) 'Reverse Turret"
              If IsActive(INPUT2) Then 'Tool locked signal'
              Exit Sub               

If NewTool= 4 Then
              ActivateSignal(OUTPUT7) 'Begin rotating turret'
              If IsActive(INPUT1) Then 'Turret has rotated until selected tool is in position'
              DeActivateSignal(OUTPUT7) 'Stop turret from spinning"
              ActivateSignal (OUTPUT8) 'Reverse Turret"
              If IsActive(INPUT2) Then 'Tool locked signal'
              Exit Sub               



Mach4 General Discussion / Two issues I need help with. Please.
« on: May 03, 2023, 12:43:14 AM »
These may be old and I am digging up the same problems. I cant seen to find answers though. Mach 4. ESS. Upgraded CNC Router. Slightly above average technician slightly below average user. Very basic programming knowledge. Have been using the machine to manufacture parts. Mostly working well.

Probing. I hate it and my probe has been destroyed by several non commanded actions - the worst one was trying to use the Fusion 360 routine with Mach 3 - it just smashed my probe straight into a vice at high speed before I could react. The Mach 4 Touch module Z and corner operation only works with the "Probing failure disables Mach 4" unchecked. If its checked the probing operation stops during repositioning move. I dont know what to do with this? It works with the box unchecked. I just dont know how accurate the touch option is, it only touches once instead of backing off and touching a second time.

Probing Mach 4. If I try to use the other Mach 4 Probing program it fails immediately. I have setup several probing inputs on different pins with a tool setter, probe and additional probe. These all correlate to the blue lights on the interface, G31, G31.1, etc. My main probe being G31 the correct blue light comes on with activation as do the others. But, the Mach 4 probing routine says the incorrect probe has been activated and it errors out contrary to its indication. Stumped how to fix this. To explain further, the Mach Touch operation works, the Mach Probe operation says the wrong probe is activated even though the Touch module and GUI seems correct.

Soft Limits. If I toggle the soft limits it reverses my jogging direction - gee - no idea whats going on there. Machine is in a homed condition.

Zero idea what to do. Tell me I have to learn LUA would be undesirable I just want to use my machine but if there are no options I guess it is what it is. It would be nice though to be able to use the script an expert has written instead. Thanks in advance. Apologies for the old ground. Almost there.

Mach4 General Discussion / Script Debugging
« on: February 28, 2023, 06:15:39 PM »
I managed to get a small M6 macro to work in a sense. I dont understand how the debugger helps me with my mistakes though. A section of this code is working on my machine. Call a toolchange it goes to position. Tool changes. All good.

What doesnt work is the tool will not return to its original position this line:

--mc.mcCntlGcodeExecuteWait (inst, "G90 G53 G0 X"..xstart.. Y"..ystart..") Take the tool back to original position this doesnt seem to work.

My other scripting problem. If the machine is not homed, (obviously) on first attempt my 150kg gantry almost raced right off the machine. E-Stop - pleased I have one of those.

if yhomed = true then = return -- check if y is homed
else mc.mcCntlSetLastError (inst "Please home your Y Axis")

I tried debugging but dont know what to do. if someone has time to give me the bits I went wrong on would be appreciated. I know this is a standard M6 thing. But if I can get this sorted I would be able to use the same info for the other bits and pieces I need to program into my machine. Know what I mean? Big thanks in advance. B

Full Code:

function m6()

   local inst = mc.mcGetInstance()
   local selectedTool = mc.mcToolGetSelected(inst)
   selectedTool = math.tointeger(selectedTool)
   local currentTool = mc.mcToolGetCurrent(inst)
   currentTool = math.tointeger(currentTool)
   local ystart = mc.mcAxisGetPos (inst, 1)
   local xstart = mc.mcAxisGetPos (inst, 0)
   local zhomed = mcAxisIsHomed (mInst, Z_AXIS, 2)
   local xhomed = mcAxisIsHomed (mInst, X_AXIS, 0)
   local yhomed = mcAxisIsHomed (mInst, Y_AXIS, 1)
if zhomed == true then = return -- check if z is homed
else mc.mcCntlSetLastError (inst "Please home your Z Axis")

if xhomed = true then = return -- check if x is homed
else mc.mcCntlSetLastError (inst "Please home your X Axis")

if yhomed = true then = return -- check if y is homed
else mc.mcCntlSetLastError (inst "Please home your Y Axis")
if selectedTool == currentTool then
   mc.mcCntlSetLastError(inst, "Current tool == Selected tool so there is nothing to do Dork")
      --Remove this line if you would not like the Z axis to move
   mc.mcCntlGcodeExecuteWait (inst, "G90 G53 G0 Z-10");--Move the Z axis all the way up
   mc.mcCntlGcodeExecuteWait (inst, "G90 G53 G0 Y60 X35") -- Move to tool change position
   mc.mcCntlSetLastError(inst, "Change to tool " .. tostring(selectedTool) .. " and press start to continue") --Message at beginning of tool change
   mc.mcCntlToolChangeManual(inst, true) --This will pause the tool change here and wait for a press of cycle start to continue
   --mc.mcCntlGcodeExecuteWait (inst, "G90 G53 G0 X"..xstart.. Y"..ystart..") Take the tool back to original position this doesnt seem to work.
   mc.mcCntlSetLastError(inst, "Current tool == " .. tostring(selectedTool) .. "   Previous Tool == " .. tostring(currentTool)) --Message that shows after Cycle Start
   mc.mcToolSetCurrent(inst, selectedTool)

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

Mach4 General Discussion / Does anyone setup their probe as a master tool?
« on: February 23, 2023, 11:28:28 PM »
Mach 4. Ess SmoothStepper. Router/Mill. New setup with an ATC I am going to use for manual tool change for now. Seems to be a good idea any reason why not? If I set my probe up in a holder and leave it there as #1 master tool. My very first op is almost always to probe the top and WCS with the remainder of my tools following. Is there any reason why I wouldnt?

The only issue I might see in the future is when I flip a part and set the WCS on the underneath the issue being my probe might not be long enough for the higher parts I manufacture. In this case I have used a long 8mm endmill to get my Z.

Anyways. If someone is keen to give me feedback would be appreciated.

Mach4 General Discussion / Little help with a script please?
« on: February 20, 2023, 10:26:52 PM »
ESS with Mach 4. I have a problem during startup where in some situations during different stages of abnormal times, if my VFD is running but my PC crashes or similar, my VFD will be commanded to run, at full speed. The VFD will stop once Mach 4 is loaded. Its rare but I dont like it. I have placed a button on my run screen to enable power to the PWM converter with redundancy, ie loss of power = no power to my PWM converter.

In addition I want to activate the main pneumatics with the same button. So, output 2 pins with one button.

I thought this script would work but it wont:

-- Main Spindle PWM Board and Pneumatics Enable
inst = mc.mcGetInstance()
local hSig, rc = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT1)
local hSig, rc = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT2)
local state, rc = mc.mcSignalGetState(hSig)
if state == 1 then
    mc.mcSignalSetState(hSig, 0)
    mc.mcSignalSetState(hSig, 1)

I am able to remove the script and just have an output on the button, works, but not 2 outputs, so wrote this script. Well copy/paste anyway.

The other weird thing, if I try to use a script to on/off an output, I have to press or hit the button twice for any action. double click for on double click for off. Weird. A little help please? Just want to have 2 output pins off the same button. Only needing a single click on/off. Looking forward to hearing what I am doing wrong. Thanks

Pages: 1 2 3 4 5 »