Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: hooked on September 16, 2017, 06:10:14 PM

Title: GO TO WORK ZERO - ERROR
Post by: hooked on September 16, 2017, 06:10:14 PM
Hi All,

I recently updated to MACH4 V 4.2.0.3481  and PMDX Plugin V.0.2.254.

Now when I hit the Go to Work Zero button in MACH4 I get the following message - "AXIS 3 COMMANDED WHILE DISABLED"   

The machine does not move to work zero.  Prior o updating to the above versions I had no issues running this command.
My Gcode files still run as expected.

Any suggestions to rectify this issue???

THANKS

Daryl
Title: Re: GO TO WORK ZERO - ERROR
Post by: joeaverage on September 16, 2017, 11:07:37 PM
Hi,
I'm still running an earlier plugin but looking at the code associated with the 'Go To Work Zero'  I found:
Code: [Select]
GoToWorkZero()
--local inst = mc.mcGetInstance()
--mc.mcCntlMdiExecute(inst, "G00 G53 Z0\nG00 X0 Y0 A0\nG00 Z0")

Note that it calls for movement of the A axis. As my machine is not fitted with an A axis and therefore no 'Motor 3' is defined or enabled I would expect an error
if I clicked this button. It sounds rather like your machine has the same problem, either alter the code so that it doesn't attempt to move an undefined axis or
define the A axis but not equip it.

Craig
Title: Re: GO TO WORK ZERO - ERROR
Post by: hooked on September 17, 2017, 01:38:48 PM
Hi Craig,

THANKS for your response.  I find MACH4 works great but the issue for me is I'm not interested in "playing" with any application to tune it or alter it other than setting up the motors.  My frustration is that it worked fine before the upgrade. 

Which module is the "Go to Work Zero" reference that I'm looking for and I will edit out the offending reference to A0?

CHEERS

Daryl
Title: Re: GO TO WORK ZERO - ERROR
Post by: joeaverage on September 17, 2017, 02:43:40 PM
Hi,
there are controllers like that, Siemens 840D comes to mind, paltry $20,000 plus.

Craig
Title: Re: GO TO WORK ZERO - ERROR
Post by: joeaverage on September 17, 2017, 02:51:57 PM
Hi,
Screen Load script about line 218.

Craig
Title: Re: GO TO WORK ZERO - ERROR
Post by: hooked on September 17, 2017, 05:15:00 PM
Or.....go the opposite way.  Arduino/GRBL with a simple sender program.  Works really well.
Title: Re: GO TO WORK ZERO - ERROR
Post by: joeaverage on September 17, 2017, 05:18:24 PM
Hi,
if Arduino/GRBL were adequate for CNC machines why is it not all over the place?

Craig
Title: Re: GO TO WORK ZERO - ERROR
Post by: hooked on September 17, 2017, 05:25:45 PM
Hi Craig,

Not really sure.  I built my first CNC and used this combination to great affect. It was cheap and bullet proof. Maybe a power limitation of the shield boards.
Title: Re: GO TO WORK ZERO - ERROR
Post by: RGUERI1 on September 17, 2017, 05:28:07 PM
joeaverage,
What is the correct code, Just deleting the "A0" command? I get another error after I delete it. Also, what is the reason for going to "Z0" twice?
Any help would be appreciated.
Thanks
Rustin
Title: Re: GO TO WORK ZERO - ERROR
Post by: joeaverage on September 17, 2017, 05:38:43 PM
Hi Rustin,
at work at the moment so I can't answer offhand. Will have a look tonite.

Craig
Title: Re: GO TO WORK ZERO - ERROR
Post by: joeaverage on September 17, 2017, 05:56:27 PM
Hi Rustin,
I think that the repeated Z0 is to allow you to customise. For instance you might have clamps in the way so
you might wish to go to X0Y0 but Z50 to clear the clamp and THEN goto X0Y0Z0.

Note that if you alter this piece of code you have customised the screen set. At some later date when you update
Mach again the screen set will be overwritten and your edits/tweaks will be lost. To avoid this when you edit a screen set
you should save it with a distinct name and all your tricks won't get overwritten.

Craig
Title: Re: GO TO WORK ZERO - ERROR
Post by: RGUERI1 on September 17, 2017, 05:59:03 PM
I got it figured out, with the following code in the screen editor:

GoToWorkZero()
local inst = mc.mcGetInstance()
mc.mcCntlMdiExecute(inst, "G00 G90 G53 Z0\nG00 X0 Y0\nG00 Z0")


I found a couple issues, the first being the "--" at the beginning, which ignores anything following! However, I had to add the "G90" as well, to switch to absolute mode.
Not sure if I need to put a "G91" at the end, to go back to Incremental, or is that automatic for jogging?

Title: Re: GO TO WORK ZERO - ERROR
Post by: RGUERI1 on September 17, 2017, 06:01:02 PM
Craig,
Thanks for the info on saving the profiles. It looks like there will be plenty "tweaks" and I definitely don't want to lose them!
Title: Re: GO TO WORK ZERO - ERROR
Post by: joeaverage on September 17, 2017, 06:28:24 PM
Hi Rustin,
glad you got it sorted.

The '--' means that everything on the same line after it is a comment. It is common practice to leave
an unused statement in a block of code by 'commenting it out'. It allows for someone else to come along
and see the alternative approach. It is also used in Mach to describe how a function works at some location
likely to be interrogated by a user while the ACTUAL working code is elsewhere, maybe buried in a whole
bunch of other code.

Craig
Title: Re: GO TO WORK ZERO - ERROR
Post by: hooked on September 18, 2017, 01:40:53 AM
Hi Guys,

I'm not  a programmer nor do I have any inclination to be one.  However. looks like I'm going to have to start learning to sort out the issue.  I have a general grasp of Gcode so I just have to see how and what file you are editing.  I only want to set X & Y to go back to work zero without any change in Z.

Sorry we're a bit slow in Australia......something to do with being upside down.  :-)

Cheers

Daryl
Title: Re: GO TO WORK ZERO - ERROR
Post by: joeaverage on September 18, 2017, 02:48:25 AM
Hi,
Whoa there pal, I'm from New Zealand and I can program just fine...its got nothing to do with being upside down but how much your
prepared to try to master something. Aussies are usually pretty fair at sticking to it even if somewhat behind us Kiwis!

Craig
Title: Re: GO TO WORK ZERO - ERROR
Post by: joeaverage on September 18, 2017, 02:57:55 AM
Hi Daryl,
jokes and jibes aside this is a minor piece of work...to do and understand it is very satisfying and the true power of Mach4 becomes apparent.

Mach4 has now gathered a lot of new users but many are like yourself very unsure or unwilling to get to grips with LUA. I can myself only claim
beginner status but what I have learnt is that Mach4 is going to absolutely HOSE Mach3 and the momentum is building. I urge you not to miss out by
Quote
I'm not  a programmer nor do I have any inclination to be one.
If you want to be an expert CNCer that can build and customise machines you need to do this.

Craig
Title: Re: GO TO WORK ZERO - ERROR
Post by: hooked on September 18, 2017, 03:09:46 AM
Hi Craig,

THANKS.....I am actually a scratch builder of  a very capable CNC machine. (Number 2) and I do take your point.

However, my philosophy on this is - I spend my dollars and purchase a piece of software.  I understand I have to set up I/O's, motor tuning etc and don't have an issue doing this.  I want to be able to come out to my workshop turn everything on and produce work.  Something that was happening for me without issue until I updated to the latest version.  Why should I then have to alter a script which I have never touched but now find is giving me an issue?



Cheers

Daryl

Title: Re: GO TO WORK ZERO - ERROR
Post by: joeaverage on September 18, 2017, 03:17:00 AM
Hi,
if it was working why did you update?

People are wedded to the idea that software needs to be updated all the time which is rubbish. You might need anti-virus updates but does your machine
get exposed to viruses, mine sure as hell doesn't.

If you follow the advice I gave Rustin you will find that YOUR screen set, that is to say one of the standard screensets which you have added to and tweaked
remains constant when you update. You only need to update if theres something new that you want.

Craig
Title: Re: GO TO WORK ZERO - ERROR
Post by: hooked on September 18, 2017, 03:20:06 AM
Good question,

I updated because I got an Email from PMDX (the supplier of my BOB) stating there was an issue with their plugin and Mach4 and I needed to update both.
Title: Re: GO TO WORK ZERO - ERROR
Post by: Chaoticone on September 18, 2017, 05:10:04 AM
Hooked, sounds like your A axis no longer has an enabled motor mapped to it. Is that right?
Title: Re: GO TO WORK ZERO - ERROR
Post by: joeaverage on September 18, 2017, 07:27:47 AM
Hi Daryl,
Rustins code should be close to working.

First go to Operator/Edit Screen and <Go To Work Zero>. Open the Left Up script:
Code: [Select]
GoToWorkZero()
--local inst = mc.mcGetInstance()
--mc.mcCntlMdiExecute(inst, "G00 G53 Z0\nG00 X0 Y0 A0\nG00 Z0")

Note that the two lines of code are commented out, they do nothing. They have been put there so you can see and interpret what function GoToWorkZero() does.
The actual working code is in the screen load script.
Open the Screen Load script and scan down until you find the function you want, in my script line 218:
Code: [Select]
function GoToWorkZero()
    mc.mcCntlMdiExecute(inst, "G00 X0 Y0 A0")--Without Z moves
    --mc.mcCntlMdiExecute(inst, "G00 G53 Z0\nG00 X0 Y0 A0\nG00 Z0")--With Z moves
end

Rustin used the second line of code by uncommenting it but I'm dubious about the G53 code, that means that coord system for this move is in machine cords.

May I suggest trying:
Code: [Select]
mc.mcCntlMdiExecute(inst, "G00 X0 Y0 ")which by my reckoning will move at rapid traverse speed to X0 Y0 of work co-ords with no Z axis movement.

Evidently Rustin tried a similar edit and generated an error, I don't know why. One thing which occurred to me was 'what would happen if work co-ords are not defined
yet', would that cause an error that Rustin described?

It seems to work on my laptop...both with and without work co-ords being defined.

As I suggested in an earlier post if you find that this wee mod works save the modded screen set with a distinct name. Then use the new improved screen set in
your profile. That should prevent your favoured screen set being overwritten with an update.

Craig
Title: Re: GO TO WORK ZERO - ERROR
Post by: hooked on September 18, 2017, 04:00:47 PM
Craig, THANKS for the comprehensive post.  I will tackle it today and let you know the outcome.

Cheers
Daryl
Title: Re: GO TO WORK ZERO - ERROR
Post by: hooked on September 18, 2017, 07:44:03 PM
All good.  Worked as per your excellent post Craig.  THANKS for your patience.

Cheers

Daryl
Title: Re: GO TO WORK ZERO - ERROR
Post by: joeaverage on September 18, 2017, 08:09:42 PM
Hi Daryl,
your'e welcome of course.

I'v thought a bit more about the line of code that Rustin used and I realise my doubt about the G53 code
is unfounded.

G53 is not modal, therefore the G53 machine co-ord move applies to the first line only ie the G00 G53 Z0 move,
it causes the Z axis to retract to machine zero, usually the topmost extreme of its travel, ie SAFE.
The subseqeunt moves are in work co-ords as G53 is not modal. The first is G00 X0 Y0 ie X and Y goto work zero
followed by G00 Z0 now the Z axis lowers to material top. Very simple and clever.

I've learnt something new even if no-one else has.

Craig
Title: Re: GO TO WORK ZERO - ERROR
Post by: RGUERI1 on September 19, 2017, 06:04:21 AM
Craig,
Sorry, haven't had time to respond. Your last post describes exactly how my machine was responding, and now that you mention it, that's exactly why.

Daryl,
Glad to hear you've got it working.

I've got a big name tag engraving project, I'm starting on. I'll let y'all know how it goes.

Rustin