Hello Guest it is June 07, 2024, 03:34:40 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.


Messages - TTalma

Pages: « 1 2 3 4 5 6 7 8 »
11
Like the title states I'm trying to call a function that I have placed in a module from a button I've added to a screen.

I plan to add several functions and but even though I've copied examples that I've found they do not work. So far my code is really simple it looks like:

Button: (Clicked Script event)
Code: [Select]
PrintVal("123")
In folder C:\Mach4Hobby\Profiles\AXYZ\Macros
I added File: Load_Modules.mcs, all of the code looks like:
Code: [Select]
package.path = wx.wxGetCwd() .. "\\Profiles\\AXYZ\\Modules\\Test.lua"

package.loaded.Test = nil
require "Test"

In Folder C:\Mach4Hobby\Profiles\AXYZ\Modules
I added File: Test.lua, all of the code looks like:
Code: [Select]
function PrintVal(val)
wx.wxMessageBox("Current val="..tostring(val))
end

When I press the button I get the error:
Lua: Error while running chunk
c:\Mach4Hobby\ScreenScript.lua:854: attempt to call a nil value (global 'PrintVal')
stack traceback:
c:\Mach4Hobby\ScreenScript.lua:854: in function 'BUTTON_Test_Clicked_Script'


Can anyone tell me what I am doing wrong?
All of the files compile. The best I can figure out is that the screenscript.lua doesn't know anything about the modules, but according to the documentation my Load_modules.mcs file should load this.

I have made sure to delete the Load_Modules.mcc file and restart mach to recompile it after making changes to that file.

12
I want oprevent it because it messes up the work offsets.

Once I have my material all set up and the 0,0,0 position of the stock is set, The tool change messes up the Z offset, now my 0,0,0 position is no longer where my stock is. That breaks tools or ruins workpieces which means lost $$$$

13
I have my z offset set to the top left corner of my stock. I jog my machine so that the tip of Tool 1 is touching the zero point. I hit Zero X, Zero, Y, Zero Z on the DRO. My tool table values in the length column are
T1 = 0
T2 = -0.2758
T3 = 0.1304

Then I run the following g-code:
Code: [Select]
G90 G94 G91.1 G40 G49 G17
G20
M5
Z3
T3 M6
G54
M8
G0 X13 Y-24
G43 Z1.3783 H3
Z0.9846
G98 G81 X13 Y-24 Z0. R0.9453 F14.2
Y-23
G80
M5
M9
T2 M6
G55
M8
G0 X13 Y-24
G43 Z1.3783 H2
Z0.9846
G81 X13 Y-24 Z0. R0.9453 F17.2
Y-23
G80
G0 Z1.3878
G90
Z3
G17
M9
M30

When T3 is loaded it doesn't go deep enough, short by about 1/8",
T2 trys to go about an inch to deep

I though the line
Code: [Select]
G43 Z1.3783 H3Would move the machine down an additional 0.1304" when drilling with tool 3, and move down -0.2758 less with tool 2. Why is it going to these seemingly random depths.

What is going on?, what's it supposed to be doing?
 

14
I believe you are correct, this is the way it is normally done. But since I am constantly swapping out tools I would prefer to just measure each time

15
It seems to do this by default.

Is it possible to prevent this from happening?

16
Like the title states why does Mach 4 store machine position during probe strike in G54?

This messes up my work offsets when probing tool length during a tool change.

Is it possible to stop this, or change it to a different location?

17
I'm not sure how the tool offsets would work. My issue is that the work offset is being changed when the tool length is checked. The tool offsets will be used based on the Z offset, and if the Z offset is overwritten to be to low the tool offset will be to low.

Example (for Z axis)
using machine coordinates,
Z= 0 at table surface, Z = -7.5 Is Z axis raised to maximum position
Spoilboard is 3/4" thick piece of MDF
Workpiece is 3/4" MDF

Step 1: I load T1, a 1" long tool in machine and tool change measures tool length and sets Z offset = -6.5 (due to probe strike)

Step 2: I jog machine to X=0, Y=0, Z to top of workpiece(1.5" above table)
Step 3: I set Z = 0 at top of workpiece, now Z offset = -5 (Z offset from tool length + spoilboard thickness + workpiece thickness)

Step 4: Cut with T1, all works correctly

Step 5: Tool change to T2 is called a 1.5" long tool, tool change measures tool length and sets Z offset = -6 (due to probe strike) <- This is where the problem is The Z offset should be -4.5, but due to probe strike overwriting Z offset value set in step 3 the offset is to deep!

I can calculate the -4.5 position, but have no way to write it. I have the information to calculate the offset if it's correct (going from step 3 to 5), but once its overwritten, I can't calculate it on future tool changes!


18
I have an Automatic tool changer on my machine. It only holds 7 tools, and I swap out the tools often for different jobs. So in my tool change script it gets the tool then goes to the depth setter and measures tool length. The depth setter is hooked up to my probe input. It's setup so that when the tip of the tool touches the table Z on the DRO reads 0.

I just do hobby work so I will put a pice of plywood on the machine, jog the axis over to where I want it to start cutting, and jog the z axis down to the top of the piece of plywood. I then hit the Zero X, Y, Z buttons next to the DRO. This makes it so that Z on the DRO reads 0 when the tip touches the top of the wood.

When a tool changes and it sets the depth of the new tool it messes up the work ofsets. To set the measured height I use the command:
Code: [Select]
mc.mcAxisSetPos(inst,2,measuredHeight)
Should I be using a different command? I can read the offsets using:
Code: [Select]
CurToolZOffset = mc.mcCntlGetOffset(inst, 2, 1)
But there is no way to set the value.

Does anyone know how I should be calculating the height so that the workoffset is accounted for?

19
Like the title states When I run the code below the depth of the tool changes. Does anyone know why and how do I stop it? This code is generated by fusion 360.

So before the code starts the top of my material is at 19mm. After it executes the code below it thinks the top of my material is 17mm lower.

M1
T2
M6
S12000 M3
G54
M8
G0 X595. Y77.
Z25.01
G81 X595. Y77. Z0. R24.01 F437.

20
It will take a little coding but this is basically what you need to do.

get current units
mcCntlGetUnitsCurrent

if G20 for inch
do tool change

if G21 for mm
set units to G20
do tool change
set units back to G21



This is great mcCntlGetUnitsCurrent was what I was looking for.

How is this used would I just do:

local units = rc.mcCntlGetUnitsCurrent(inst)
mc.mcCntlGcodeExecuteWait(inst, "G20")
...
do tool change stuff
...
if (units = "mm") then
    mc.mcCntlGcodeExecuteWait(inst, "G21")
end

Is there any documentation of all the mc commands (mcCntlGcodeExecuteWait, mcCntlGetUnitsCurrent, etc.). I have not seen a document with them all listed. I would have expected them to be in the lua scripting manual found here: https://www.machsupport.com/wp-content/uploads/2014/05/Mach4%20Scripting%20Manual.pdf

Pages: « 1 2 3 4 5 6 7 8 »