Hello Guest it is March 28, 2024, 06:10:39 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 - TTalma

Pages: 1 2 3 4 »
1
I like the format of the tool table, but I hate that it's a popup.  I would like to use it as is in a new tab I create. Do I need to recreate it or is it possible to just use it on a new screen?

2
I have made a module file 'PocketPositions.Lua' with a bunch of functions.

In the screen load script I added the following:
Code: [Select]
-- Pocket Positions
package.loaded.PocketPositions = nil
PocketPositions = require "PocketPositions"

From a tab On enter script I have:
Code: [Select]
local pocketNums = PocketPositions.GetUsedPocketNumbers()
if pocketNums[1] ~= nil then
wx.wxMessageBox("pocketNums[1] ="..tostring(pocketNums[1]))
table.sort(pocketNums)
local pocketStr = ""
for i=1, #pocketNums do
pocketStr = pocketStr .. pocketNums[i] .. "|"
end
wx.wxMessageBox("pocketStr="..pocketStr)
scr.SetProperty("GROUPBOX_CurrentToolPocket", "Strings", pocketStr)
else
wx.wxMessageBox("pocketStr=nil")
end

the function 'PocketPositions.GetUsedPocketNumbers()' looks like:
Code: [Select]
-- Gets a table of the pocket numbers that are configured
function PocketPositions.GetUsedPocketNumbers()
local PocketNums={}
local n=0

-- make sure the pockets have been loaded
if PocketDetails == nil or PocketDetails[0] == nil then
PocketPositions.ReadPocketData()
end

for k,v in pairs(PocketDetails) do
  n=n+1
  PocketNums[n]=k
end

return PocketNums
end

When it calls the function 'PocketPositions.ReadPocketData()' (which is also in the  'PocketPositions.Lua' file) I get an error that 'PocketPositions' is null.

If I step through 'PocketPositions.ReadPocketData()' in the script editor it works fine.

Any idea what's happening and how I fix it?


3
I created a new m code, m500 and put it in the folder 'C:\Mach4Hobby\Profiles\AXYZ\Macros'.

The contents of the file are:
Code: [Select]
function m500()
wx.wxMessageBox("Works")
end

if (mc.mcInEditor() == 1) then
m500()
end
I'm running the profile in AXYZ and have confirmed this.

When I type 'M500' in the MDI window, or put it in a gcode file it does not execute. It just sits on the line and the cycle time counter goes up. I don't get any errors, it doesn't do anything.

I tried making a simple gcode file that looked like:
Code: [Select]
X0 Y0
m500
X1 Y1

The machine moves to 0,0 then just sits on the m500 line.

I tried calling the command from a button and it works fine

I stepped through the function and the message box pops up correctly.

What am I doing wrong?



4
I was editing a screen and added a button. I set the click script to call macro 'm500', and typed it in that way. It should be 'm500()'. But now when I load the screen it gives the error:
Lua: Script error during pre compilation
c:\mach4hobby\Screenscript.Lua:861'Syntex error near 'end'

I tried removing the line from Screenscript.lua, (I did remove the read-only status). Saved the file and and verified my change was saved. But when I restart Mach 4 I get the same error, and when I check Screenscript.lua the line with the error is back.

How do I fix this error?

5
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.

6
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?
 

7
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?

8
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?

9
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.

10
My tool change scripts are writen in inches. When I have a file in MM It messes up the tool change script.

When the gcode file is using mm and switches the coordinates to mm, what  do I need to add to my tool change script to switch to inches at start of script and switch back to mm at the end of the script?

Pages: 1 2 3 4 »