Hello Guest it is April 18, 2024, 07:11:56 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 - Inertia

Pages: 1
1
Mach4 General Discussion / Re: Need a simple 5 axis NC file for testing
« on: September 20, 2016, 02:49:41 AM »
I'm using inverse time on my 5 axis router with Mach4 and it seems to be quite buggy. It constantly violates the acceleration parameters and causes my stepper motors to stall and ruin the whole job.

2
I can't manage to get a string of the current line, I've got mc.mcCntlGetGcodeLineNbr() working, but I can't get mc.mcCntlGetGcodeLine() to work. It's being executed in a module, I've make test functions in the module work when I click a screen button in Mach, so I know the button is accessing the module file correctly.

I've tried copying the documentation exactly with:

Code: [Select]
char gline[128]
gline[0] = '0'
mc.mcCntlGetGcodeLine(inst, counter, gline, 128)
But when I use a char, the script in the Mach screen button that tries to link to the module file crashes as it tries to link to it, when I switch gline back to a string everything links up fine.

Here's the screen button script:
Code: [Select]
local inst = mc.mcGetInstance()

-- get access to module functions
package.path = wx.wxGetCwd().."\\Modules\\?.mcs;"
if (package.loaded.dialogTest == nil) then
    module = require "dialogTest"
end

local gcodeProgram = getGcode()
mc.mcCntlSetLastError(inst, gcodeProgram[5])
test()    -- just to make sure the module file is being accessed

And here's my module code:
Code: [Select]
function getGcode()
    local inst = mc.mcGetInstance()
    local lineNumber = mc.mcCntlGetGcodeLineNbr(inst) + 1 -- not being used
    local lineCount = mc.mcCntlGetGcodeLineCount(inst)
    local gcodeProgram = {}
    local count = 1
    loca curLine = ""
    while counter <= lineCount do
        mc.mcCntlGetGcodeLine(inst, counter, curLine)
        table.insert(gcodeProgram, curLine)
        counter = counter + 1
    end
    return gcodeProgram
end

function test()
    local inst = mc.mcGetInstance()
    mc.mcCntlSetLastError(inst, "It worked.")
end

Thanks guys.

3
You're exactly right Steve. Thanks for clarifying for Wallerawang.

I didn't even know about subroutines until you mentioned them. Putting the entire program in a subroutine and passing the tool length seems like a good solution. After sleeping on my last post I got the idea to write a wizard where you simply select the gcode program, and hit 'Go' and it takes the current tool length and translates the program and posts it to Mach. What are your thoughts?

4
The purpose of this macro was to take 5 axis gcode and interpret it in real time so that the tool length can be changed between jobs and not have to regenerate the gcode. I've since learned that apparently Mach has a 500ms delay before execution of the M code script. Each Gcode line moves the machine no more than 1mm, a 500ms delay every 1mm movement is unacceptable.

I've read the M62 and M63 execute the next line immediately, but I don't think that can be used for this purpose. So now my attention is turned to writing a plugin. I don't really know where to start with this... I've got a working 5 axis Gcode interpreter and machine simulator working in Blender (the 3D modelling program) and it works great, but that's written for Blender in Python language, translating the logic over to Mach4 is proving a challenge.

Please, I ask all who have information so share, what's my best course of action at this point? I'm hoping a plugin is the solution, if so, is there documentation to help me get started?

5
Hi everybody!

I'm writing a macro (M11) for Mach4 that must:

> Read current gcode file line (X-26.306 Y-4.449 Z10.603 I-0.05081 J0.094506 K0.994227 M11)
> Derive new line based on its values
> Execute derived line
> Move to next line in gcode file without ever having executed the X, Y, Z, I, J, K values on the original line from the gcode file

I figure that since it has to execute the line to start the M11 macro, it might also have to execute all the X, Y, Z, I, J, K values too.

Is this the case or does the M11 take priority before any other values in the line?
An example of code to achieve this would be bonus point for you if you would be so kind.  ;D

Thanks guys.

Pages: 1