Hello Guest it is May 22, 2019, 11:34:48 AM

Author Topic: Update error  (Read 1075 times)

0 Members and 1 Guest are viewing this topic.

Update error
« on: November 02, 2017, 06:50:07 PM »
Today I decided to update Mach4 to the latest build on the PMDX site, Build3481

After downloading and installing the new build I imported the lathe profile package I created just prior to installation.  After answering yes to about 25 windows asking me if I wanted to overwrite files the screen load script ran and then I got the following error window.

I don't know what caused it or how to fix it.

Any help greatly appreciated 
Re: Update error
« Reply #1 on: November 02, 2017, 08:07:29 PM »
Hi,
the last time I updated I had no such issues but did the time before being the first time I updated Mach.

If memory serves the problems I had were because I had been using and modifying the standard screen set
wx4.set but had not renamed it. When a new or fresh copy of wx4.set came along it had to overwrite my
current copy and its backups which had been edited and tweaked.

Since then I have maintained a separate and unique screenset.

Craig
My wife left with my best friend...
     and I miss him!
Re: Update error
« Reply #2 on: November 02, 2017, 08:23:39 PM »
Craig,  thanks for taking time to respond.  The screen set that I use has been saved under another name, My4Lathe.

RT
Re: Update error
« Reply #3 on: November 02, 2017, 08:44:21 PM »
Hi,
go to the profile backup files ans have a look at when they were last written (overwritten), I would guess
it was at the time you updated.

Is the screen set named My4Lathe or your profile?

Craig
My wife left with my best friend...
     and I miss him!
Re: Update error
« Reply #4 on: November 02, 2017, 09:23:29 PM »
Hi,
beginning to recall what happened, I updated and something went screwy with the screenset such that Mach would
crash before I could get to the stage of opening the screen editor. In the event I had to do a fresh install, as I was
just new to Mach4 it wasn't a huge imposition.

Daz pointed out subsequently that if I start Mach from the command line with a '/e' extension Mach fires straight into the
screen editor without running the screen load and first run PLC scripts which I had cunningly corrupted!

Craig
My wife left with my best friend...
     and I miss him!

Offline smurph

*
  • *
  •  1,085 1,085
  • "That there... that's an RV."
    • View Profile
Re: Update error
« Reply #5 on: November 02, 2017, 11:35:14 PM »
The update and modify scripts have changed.  If the scripts exist, they must return a value, otherwise, the control will not get updated.  Even if the actual value isn't changed!

-- Example encoder update script.
local inst = mc.mcGetInstance()
local val = select(1,...) -- Get the system value.
val = tonumber(val) -- The value may be a number or a string.  Convert as needed.
local name = select(2, ...) -- Get the control name.  It is always a string.  You may not need it.  But it is there if you do.
val = val / 1024 -- convert the encoder value to a decimal (assumes 1024 counts per unit).

return val -- the script MUST return a value, otherwise, the control will not be updated.

In your script functions, it would be just a slight change.

Add
local val = select(1,...) -- Get the system value.

to the top of each script and

return val

to the bottom of each script. 

But that is not all.  The error states that the 4th parameter (XWear) is nil.  XWear is pulled from the droXWearOffset DRO.  So I'm thinking that there is an update script that needs to be looked at (probably the same modification as above). 

Steve

Steve
Re: Update error
« Reply #6 on: November 03, 2017, 12:58:30 PM »
Thanks Craig and Steve,

Craig, the profile is My4Lathe and the screen set is wxLathe.

Steve,

I have added 3 Dros to the screen, only one has a onUpdate script.  I added the code as directed and no change.

From the lua script line 931 says: function dro_11__on_update_script  I have searched the entire screen tree for a dro_11 and there is none.

I have searched the startup and PLC scripts for dro_11 and mcToolSetData and there is none to found.

Also searched all lua modules for mcToolSetData and only in the mcAutoTool.mcs is there a call to that function.

Where else should I look for an onUpdate script?

TIA

RT

Re: Update error
« Reply #7 on: November 03, 2017, 02:37:16 PM »
Hi RT,
once you get sorted make a copy of wxLathe and rename it. Any and all screen tweaks you have made have been lost  when you upgraded to the new Mach4 build.
All those windows asking permission to overwrite was Mach overwriting all your wxLathe backups.

Exactly the same thing happened to me. My profile is ESSMill and my screen set is ESSMill.set. The screenset is essentially  a copy of wx4,set plus whatever tweaks
and edits I've added over the last year or so. Now when I upgrade to the latest Mach4 build nothing untoward happens to my profile or screen set.

Craig
My wife left with my best friend...
     and I miss him!
Re: Update error
« Reply #8 on: November 03, 2017, 03:03:25 PM »
Hi,

Quote
I have searched the entire screen tree for a dro_11 and there is none
I think dro_11 was one that got overwritten. The code which populates the dro with numbers is still there, its part of your profile which because of its unique name
was not overwritten.

Sorry, its looking increasingly that you'll have to go back and redo that work. I had to do the same thing. It did teach me to have both unique profiles AND screen sets.

Craig
My wife left with my best friend...
     and I miss him!
Re: Update error
« Reply #9 on: November 03, 2017, 04:41:40 PM »
Found the offending dro.  On the lathe set dro_11 is Dro(11) on the tabPositionsExtens tab with a label of Xwear Offset (doh)

The onUpdate and onModify scripts are the same as in a clean wxLathe screenset that gives no error.

local m_inst, m_currentOffset, XWear

XWear = scr.GetProperty("droXWearOffset", "Value")
XWear = tonumber(XWear)

m_inst = mc.mcGetInstance()
m_currentOffset = mc.mcCntlGetPoundVar(m_inst, mc.SV_CUR_LENGTH_INDEX)
mc.mcToolSetData(m_inst, mc.MTOOL_LATHE_X_W, m_currentOffset, XWear) --set the wear offset

I added:

if XWear==nil then XWear=0 end

before the call to mcToolSetData

The screen loads without complaint but I don't know why XWear comes back nil in my screen and not in the original.  We'll see if other problems arise.  thanks for your help.