Hello Guest it is October 21, 2019, 06:47:38 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.

Topics - joeaverage

Pages: 1 2 3 4 5 »
Mach4 General Discussion / Mill Profile Initialisation String
« on: July 05, 2019, 09:13:14 PM »
Hi All,
I am struggling to find the code that results in the initialization string that occurs in my mill profile.

In particular I wish to delete the G54 from the list. I have scanned through the machine.ini file and not found anything
that appears to be the init. string.

I am aware that I can provide my own init. string in Machs Control plugin but I still want to delete the G54. The correct
work coordinate set will provided by a script and may well vary between sessions. Therefore a fixed initialization string
as the one in the Control plugin is not suitable.


Mach4 Toolbox / Enums,Pound Variables,Return Codes,Machine States
« on: April 17, 2019, 05:41:44 PM »
Hi All,
over a period of time I have a few documents that have lists of various Enums, pound variables, return codes,
machine states and the likes. In some cases I have written or compiled them myself but others I have edited poppabear's
lists (posted on this board). I thought I would bring them altogether.

May I suggest that if you find any of them useful download it to Mach4Hobby/Docs and then you will have access during
a Mach session via the <Help Docs> screen button.

If you have any additions or corrections please post.


General Mach Discussion / Have you ever blown up a PC?
« on: March 21, 2019, 02:02:40 AM »
Hi All,
trying to get a feeling for the number of people who may have damaged a PC because they chose not use
opto-isolated inputs.

Thanks for taking the time to respond.


General Mach Discussion / Do you use a Charge Pump?
« on: March 21, 2019, 01:56:48 AM »
Hi All,
just trying to get a feel for the numbers of people who use a charge pump to 'safe' their machine.

Thanks for taking the time to respond.


Mach4 General Discussion / Un-Supported wxNumberEntryDialog
« on: January 20, 2019, 01:27:32 PM »
Hi All,
I have always struggled to make sense of wxLua. I have started doing some reading and experimenting and a glimmer of
understanding/hope is coming.

I have encountered a difficulty that maybe someone can explain.

I was experimenting with wx.wxNumberEntryDialog() As found in the wxWidgets web pages but found that neither
ZeroBrane supported it neither would the dialog execute.

I found that the convenience dialog wx.wxGetNumberFromUser() works but that is limited to positive integers only.

I was hoping that wx.wxNumberEntryDialog would allow the entry of real numbers which would be appropriate for
a dimension in a CNC job say.

Is there a means of real number entry in wxLua?


Mach4 General Discussion / Poor Mans Wizard
« on: January 19, 2019, 01:29:30 PM »
Hi All,
as I promised I thought I would start a new thread to show an idea that I have used on a few occasions to generate
Gcode files.

This thread started with:


Where I wrote some code for OP to 'jewel' some material. Chad was interested in the idea of opening a file and putting
the Gcode in it rather than executing it immediately with successive mcCntlGcodeExecuteWait() API commands.

Here it is:

Code: [Select]
function m125()
local inst=mc.mcGetInstance()
-- create the wxFrame window
    mainframe = wx.wxFrame( wx.NULL,          -- no parent
                        wx.wxID_ANY,          -- whatever for wxWindow ID
                        "DummyFrame", -- frame caption
                        wx.wxDefaultPosition, -- place the frame in default position
                        wx.wxDefaultSize,     -- default frame size
                        wx.wxDEFAULT_FRAME_STYLE ) -- use default frame styles

    -- create a panel in the frame
    panel = wx.wxPanel(mainframe, wx.wxID_ANY)--We are not going to show it but we need to have this to use the File dialog

local file = wx.wxFileDialog(panel, "Select Data File", "", "", "Text files (*.txt)|*.txt|Tap files (*.tap)|*.tap",
                             wx.wxFD_SAVE,wx.wxDefaultPosition,wx.wxDefaultSize, "File Dialog" );
        if(file:ShowModal() == wx.wxID_OK)then
            path = file:GetPath()
-- Jewel Data.....to be edited as required
local jewelWidth=50
local jewelLength=100
local toolDiameter=6
local nominalStepover=0.66
local plungeSpeed=300
local retractZ=2
local safeZ=20
local jewelDwellTime=500
-- End of data block
local startXpos
local startYpos
local jewelZheight

local stepoverX,numjewelX
local stepoverY,numjewelY
local i=0
local j=0
-- Save the current position as the start of the jeweling area....you have jogged to the start haven't you????
-- Calculate the required step over to meet the nominal step over as closely as possible but be an integral
-- number of 'jewels'
-- Reduce jewelWidth in X and Y by the diameter of the tool
-- Calculate the exact number of 'jewels' required to match the nomininal Steppover
numjewelX=jewelWidth / (nominalStepover * toolDiameter)
numjewelY=jewelLength / (nominalStepover * toolDiameter)
-- Find the integer number of 'jewels'
-- Calculate the actual stepover to be used so that an integral number of 'jewels' are perfomed
stepoverX=jewelWidth / numjewelX
stepoverY=jewelLength / numjewelY
local retract="g0 z "..tostring(jewelZheight+retractZ)
local safeHeight="g0 z "..tostring(jewelZheight+safeZ)
--mc.mcCntlGcodeExecute(inst,retract..'\n'..'g1 f'..tostring(plungeSpeed)..'\n')
fileHandle:write(retract..'\n'..'g1 f '..tostring(plungeSpeed)..'\n')
for i=0,numjewelX,i+1 do
for j=0,numjewelY,j+1  do
jewelX=startXpos + (i * stepoverX)
jewelY=startYpos + (j * stepoverY)
--mc.mcCntlGcodeExecute(inst,'g0 x '..tostring(jewelX)..' y '.. tostring(jewelY)..'\n'..
-- 'g1 z '..tostring( jewelZheight)..'\n'..
-- 'g4 p'..tostring(jewelDwellTime)..'\n'..
-- retract..'\n')
fileHandle:write('g0 x '..tostring(jewelX)..' y '..tostring(jewelY)..'\n')
fileHandle:write('g1 z '..tostring(jewelZheight)..'\n')
fileHandle:write('g4 p '..tostring(jewelDwellTime)..'\n')
if (mc.mcInEditor()==1)then

Essentially all I have done is open a file dialogue so you can open a new file, or open an existing file with a normal Browse window
and then use exactly the same code that did the jeweling but replaced the mc.CntlGcodeExecuteWait() commands (I just
commented them out) with suitable file write commands.

Note that this code will run if you MDI <m125>.

The procedure would then be:
1) Jog to the location of the first (lower lefthand) 'jewel'
2) Lower the Z axis until the tool/brush makes contact with the material with sufficient force to effect the jewel
3) MDI <m125>

I have attached a coy of the file generated. Not very sophisticated....at best a poor mans Wizard.....and I am a poor man!


Mach4 General Discussion / Out-Of-Band Axes in Hobby vs Indusrial
« on: May 05, 2018, 07:44:44 PM »
Hi All,
in Mach4Hobby we are limited to one out-of-band axis and that axis is always the spindle. As such there is good control over it via the API but not indexing. That is to say that the spindle
is meant to be free running and cannot without some work-around be stopped at some precice location/angle.

If I understand Mach4Industrial allows all six out-of-band axes. Does anyone know what control mechanisms exist for those axes? I imagine for instance it would be highly desired that there
could be more than on free running spindle for multispindle machines. I imagine also that position/index control would be available. I'm thinking that such a feature would be required of a 'tombstone'
type workpeice which required indexable movement in order that multiple parts could be made from the one tombstone as an example.

The workaround I have used with Mach4Hobby is to programmatically reassign my spindle as a rotational axis, C say, then call a C axis move to the required index. Provided no other axes are called
on the same line of Gcode then it could be considered that the C axis moved independently of all other axes ie a quasi 'out-of-band' axis.

I must say that until I understood the implication of the restriction to one out-of-band axis and that its always a spindle as applies to Mach4Hobby I would have said there is nothing about
Mach4Industrial that I'd miss. I'm now thinking that I miss not having indexable out-of-band axes, even one would be good.

Notwithstanding Chads use of MacroB and the glowing report he makes of it, it is not a feature that I require at this time, but would like at least one indexable out-of-band axis.


Mach4 General Discussion / Functions vs Actions
« on: March 23, 2018, 01:38:44 PM »
Hi All,
when using the keyboard plugin you can assign a function to each defined key, the functions in the drop down list are of the form JogX+, JogA--
for example. A poster in another thread is looking to use keyboard short cuts for estop and feedhold for instance.

In the screen editor buttons have events LeftUpAction  and LeftDownAction and the drop down list of Actions include all the features required by our poster.

Is there a way of making the Actions available as choices as keyboard shortcuts?


Mach4 General Discussion / List of Control States?
« on: February 08, 2018, 01:15:11 PM »
Hi All,
have had reason recently to consider Machs control states, I've had my nose rubbed in 'Idle' but I'm not sure what all the other states are or what they mean.
Is there a list or explanation somewhere?


Mach4 General Discussion / MERROR_NOT_NOW from GcodeExecuteWait() API Call
« on: February 03, 2018, 06:50:45 PM »
Hi All,
have run into a problem with some code.This is a snippet, I've left the wxMessage boxes etc in there, they are for testing purposes only.

Code: [Select]
        --Mach enabled but servos 'offline'
        --Need to restore current position and reset servos 'online'
        local Xpos=mc.mcCntlGetPoundVar(inst,500)
        local Zpos=mc.mcCntlGetPoundVar(inst,501)
local state=mc.mcCntlGetState(inst)
local statename=mc.mcCntlGetStateName(inst,state)
local rc=       mc.mcCntlGcodeExecuteWait(inst,'g53 g0 x'..Xpos..' z'..Zpos)

What appears to be happening if there is a Gcode file loaded and has partly run then Stopped, the control is Idle,
but when I execute the GcodeExecuteWait() statement it returns -18 or MERROR_NOT_NOW. My guess is that the Gcode interpreter is still loaded with
the Gcode file and is unavailable to execute the Gcode within my API call in MDI context?

Has anyone encountered this? Is my guess as to why the GcodeExecuteWait() API call does not complete correct? That same stament does execute correctly
under other circumstances so I am reasonably confident that its not some syntax error in my code.

If my guess is correct is there some way to shove the Gcode file out of the way, have the MDI Gcode execute, then shuffle the Gcode file back in?


Pages: 1 2 3 4 5 »