Hello Guest it is May 11, 2024, 08:24:03 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.


Messages - Cbyrdtopper

71
I was going to suggest something similar to what Craig said, looking at the unit itself.  Some servo units that use absolute encoders have their own homing process that they can do internally, all they need is an input to tell it to start.  If you can do that with the servo drive, you may be able to home the motor with the unit and then have Mach use the home in place feature once you get a complete signal from the servo drive unit.

72
I get it.
We have 5 mills with Mach and 5 lathes with Mach.  They understand to check the tool before hand.  And if they stop the tool change, it usually requires me or my brother to reset it anyway, so we check to be sure it is good to go.
Post your code in here as well, if you don’t mind, let’s get a wealth of knowledge up in this forum!

73
How would you check to see if the user presses stop during the macro?
 If something isn’t right, I just hit the e stop. Hard reset for everything and it inhibits z axis movement just in case.

74
I have had zero issues stopping in the middle of my macro. I have buttons to reset my magazine, drawbar, etc if something goes wrong.
Mach seems to handle macro stopping much better than in the past.
I have a gear motor that controls the carousel, so I keep track of the carousel position inside the Click PLC I use on the machine.  If Mach closes, I have to re reference the machine and part of that reference sequence is to home the carousel. If the actual tool doesn’t match what is in the spindle, I just change the DRO to match.
Lastly, I have this macro set to use 20 tools because that is what my carousel holds and the jobs I plan to run on this machine uses less than that.
If I needed more tools, I would make it empty the spindle and force a manual tool change prompt to complete the tool change sequence.

75
Sorry, it has been a while.  But here is the m6 from the mill I have been working on.

76
Mach4 General Discussion / Re: lua in Mach 4
« on: August 11, 2022, 02:01:47 PM »
Just a matter of opinion, but I personally don't make a "GCode" string variable, I just have lines of mc.mcCntlGcodeExecuteWait with the code inside of it.  You are doing just that in some cases.  Just keep it going. 
Also, I don't think it is necessary to have %.4f every time you call a position.  Also, I'm assuming you are declaring your XPos1, YPos1 etc as local variables at the top of your macro?
Just declare each position as a variable and call it later in your mc.mcCntlGcodeExecuteWait. 

I'm also attaching the m6 I've been working on for my current mill in progress.

Here is how I would do what you've done.

local inst = mc.mcGetInstance()
local selectedTool = mc.mcToolGetSelected(inst)
local TSig1 = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT2)
local TSig2 = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT3)
local TSig3 = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT4)
local TSig4 = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT5)
local DrawBarOut = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT7)
local ZPos = 1.2345
local XPos1 = 1.2345
local YPos1 = 1.2345
local XPos2 = 2.3456
local YPos2 = 2.3456

--Tool 1 Position
mc.mcCntlGcodeExecuteWait(inst, "G00 G90 G53 Z0.0")
mc.mcCntlGcodeExecuteWait(inst, "G00 G90 G53 X" .. (XPos1 + 1.3) .. "Y" .. YPos1)
mc.mcCntlGcodeExecuteWait(inst, "G00 G90 G53 Z" .. (ZPos1 + 1.0))
mc.mcCntlGcodeExecuteWait(inst, "G00 G90 G53 Z" .. Zpos1)
--Raise tool change holder #1
mc.mcSignalSetState(TSig1, 1)
--Move x axis to place too in change holder
mc.mcCntlGcodeExecuteWait(inst, "G00 G90 G53 X" .. XPos1)
--Release the drawbar
mc.mcSignalSetState(DrawBarOut, 1)
--drop tool change holder #1
mc.mcSignalSetState(TSig1, 0)

--Tool 2 Position
mc.mcCntlGcodeExecuteWait(inst, "G00 G90 G53 Z0.0")
mc.mcCntlGcodeExecuteWait(inst, "G00 G90 G53 X" .. (XPos2 + 1.3) "Y" .. YPos2)
mc.mcCntlGcodeExecuteWait(inst, "G00 G90 G53 Z" .. (ZPos2 + 1.0))
mc.mcCntlGcodeExecuteWait(inst, "G00 G90 G53 Z" .. ZPos)

--Raise tool change holder #1
mc.mcSignalSetState(TSig2, 1)
--Release the drawbar
mc.mcSignalSetState(DrawBarOut, 0)
wx.wxMilliSleep(1000)--1 Second
--Move X Axis to grab tool.
mc.mcCntlGcodeExecuteWait(inst, "G00 G90 G53 X" .. (XPos2 + 1.3))

--Drop tool change holder #2
mc.mcSignalSetState(TSig2, 0)

--Move to Z Clearance
mc.mcCntlGcodeExecuteWait(inst, "G00 G90 G53 Z0.0")

77
Mach4 General Discussion / Re: lua in Mach 4
« on: August 09, 2022, 06:42:18 PM »
I have no idea. I have long since forgotten VB script. LUA is so much better.  Function based. I like it quite a lot.
There are some pretty smart people on here though, they may chime in. 
Move made some very very powerful tool change routines with LUA

78
Mach4 General Discussion / Re: lua in Mach 4
« on: August 09, 2022, 04:48:29 PM »
I'm confused on what you are trying to do.
You want to turn on a specific output based on what tool it is on?

If that is the case, just put an if statement.
--Example
function m200()
local inst = mc.mcGetInstance()
local selectedTool = mc.mcToolGetSelected(inst)
local TSig1 = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT2)
local TSig2 = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT3)
local TSig3 = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT4)
local TSig4 = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT5)
   
if selectedTool == 1 then
     mc.mcSignalSetState(TSig1, 1)
    mc.mcSignalSetState(TSig2, 0)
    mc.mcSignalSetState(TSig3, 0)
    mc.mcSignalSetState(TSig4, 0)
elseif selectedTool == 2 then
     mc.mcSignalSetState(TSig1, 0)
    mc.mcSignalSetState(TSig2, 1)
    mc.mcSignalSetState(TSig3, 0)
    mc.mcSignalSetState(TSig4, 0)
elseif selectedTool == 3 then
     mc.mcSignalSetState(TSig1, 0)
    mc.mcSignalSetState(TSig2, 0)
    mc.mcSignalSetState(TSig3, 1)
    mc.mcSignalSetState(TSig4, 0)    
elseif selectedTool == 4 then
     mc.mcSignalSetState(TSig1, 0)
    mc.mcSignalSetState(TSig2, 0)
    mc.mcSignalSetState(TSig3, 1)
    mc.mcSignalSetState(TSig4, 0)
else
    mc.mcCntlSetLastError(inst, "OUT OF RANGE")
end--Selected Tools

end--m200

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

79
Mach4 General Discussion / Re: lua in Mach 4
« on: August 09, 2022, 12:45:26 PM »
Here is how you turn on and turn off outputs in Mach4 Lua.

local TSig1 = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT5) --This get the handle for the output.
mc.mcSignalSetState(TSig1, 1) -- This turns on Output 5
mc.mcSignalSetState(TSig1, 0) -- This turns off Output 5

Once you make the TSig1, Tsig2, etc... variable you can call the mc.mcSignalSetState (Variable Name, 0 or 1) anywhere in your m6 without having to declare the variable again.

80
I’m just saying. I’m not sure what issues you guys are having specifically.
We’re using this on two grinders in our shop that has a tilt in the grinding wheel.  It works fine either way we program it.
We’re using the A axis as the tilt. Either the A axis rotary roll over, it works fine.