Hello Guest it is April 27, 2024, 06:01:53 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 - Screwie Louie

Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 »
31
Here ya go. Try this. I had to put Lua to sleep for 5 seconds to let Mach4 report, exit, enter the appropriate machine state to continue.

The 5 seconds should be reset to the time it takes for your machine to home the X axis. To fast and Mach4 cannot properly communicate with the controller. In the simulator, I had it as fast as 2 seconds. But that's the sim and not real life. After the m101 macro, the X axis is re-homed, the next block of gCode is executed.

function m101 ()
    local inst = mc.mcGetInstance ()
    mc.mcCntlCycleStop (inst)
    mc.mcAxisHome (inst, 0)
    wx.wxSleep (5)
    mc.mcCntlCycleStart (inst)
end

Sample gCode:
    G00 G90 Z0.0
    X4.5 Y3.5
    m101
    X2.5 Y1.5
    m101
    X1.333 Z2.123
    X3.6 Z4.234
    m101
    X1.0 Y1.0 Z0.0
    m02

Hope this helps a little.  --josh



32
It resets your X axis work offset coordinates back to zero.

33
close!...for example this macro just resets the X DRO in work coordinates:

function m100 ()
    local inst = mc.mcGetInstance ()
    mc.mcAxisSetPos (inst, 0, 0.0)
    mc.mcCntlSetLastError (inst, "Reset X Axis position.")
end

It will not change the machine coordinate DRO.

But you want to actually go through the homing process. For this we need to put the machine state into idle in order to let the axis home, then wait until the axis is homed before moving onto the next block. There are a couple things I'm gonna try and let ya know.

34
Mach4 General Discussion / Re: Activate input
« on: June 30, 2015, 02:23:19 PM »
nevermind my last comment about changing the state...it's retarded.

35
Yep! You're getting it.

The absolute distance is from work coordinate position 0.0
To utilize this script in machine coordinates you would use the G53 command; something like :
     gCode = gCode ..string.format("G0 G90 G53 X%.3f\n", Xmove)

Be careful just replacing X with Y. You are right in a sense but notice in this function:
     mc.mcJogIncStart (inst, 0, Xmove)

"0" is the X axis identifier for mach4, as you set it up in your config.

You would change the function to:
     mc.mcJogIncStart (inst, 1, Ymove)

"1" is the Y axis identifier.

36
It just clicked in my head, nevermind G53...it isn't what you want.

37
Can you use G53? G53 can send the axis back to home position in machine coordinates.  btnRefX just calls mc.mcAxisHome(inst, 0)  --0 is the X axis id

G53 X0.0

although, try this instead....it would make me feel better, haha

G53 Z0.0
G53 X0.0

If you must "Re-home" the axis and not just send the axis back to home position (machine coordinates) then you would have to pause the run, execute mc.mcAxisHome(inst,0), then return and restart the run (similar to the m6 Tool Change macro) We can code this so it is automated like you wish. I would just have to work on it....I have an idea, to be continued...

38
Mach4 General Discussion / Re: tool height probing
« on: June 30, 2015, 12:10:16 PM »
I have Solidworks and HSM Express. I'm just learning. I won't let myself start on Solidworks until I understand Mach 4, gCode, macros, etc. I am forcing myself to start from the ground up so I am able to read gCode and understand the machine language. I just got Peter Smid's book on FANUC custom scripts (I believe it was ya-nvr-no's recommendation in one of the threads). I'm just having too much fun! There is so much to learn.

39
Sorry Pedio...sometimes I have a little whiskey, open my mouth and insert my foot.

40
Mach4 General Discussion / Re: Custom DRO script
« on: June 30, 2015, 11:52:12 AM »
good catch!

Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 »