Machsupport Forum

Mach Discussion => VB and the development of wizards => Topic started by: Nitromuse on November 10, 2012, 08:35:30 AM

Title: Persistent Parameters
Post by: Nitromuse on November 10, 2012, 08:35:30 AM
Hello World,
I'm having a hard time finding a parameter (a Double) that will persist from one Mach session to the next that can be used in a macro.  I assume it would have to be saved into the XML but scanning that I don't see any likely candidates.  If you can help me solve this and/or lead me to the documentation on this subject it is much appreciated.
Thank you,
Title: Re: Persistent Parameters
Post by: BR549 on November 10, 2012, 09:04:02 AM
500-600

Title: Re: Persistent Parameters
Post by: Nitromuse on November 10, 2012, 09:14:51 AM
Thanks, from what I can see in the Reference Manual GetParam and SetParam are looking for a string value as to the parameter name.  How do I get and set these parameters, 500 - 600?  And if you could lead me to the documentation it would be greatly appreciated.
Thanks again,
Title: Re: Persistent Parameters
Post by: BR549 on November 10, 2012, 09:37:39 AM
SetVar(500,1) sets the var to the secondary value (1)

GetVar(500)  retrieves the Var value


(;-) TP
Title: Re: Persistent Parameters
Post by: ger21 on November 10, 2012, 10:30:55 AM
You can also write to a UserDRO, the value of which get's saved in the .xml I think.
Title: Re: Persistent Parameters
Post by: Nitromuse on November 10, 2012, 01:24:53 PM
Gentlemen,
I've spent the past couple of hours trying to get a (double) value to persist through a shut down and re-start of Mach.  Params, Vars, OEMDRO's, UserDRO's, none of these will hold the value when Mach is re-started.  I have Persistent DRO's checked in General Config but when I re-start Mach the value is at default, not the value at last shut down, isn't this the definition of Persist.
What am I missing?
Thank you.
Title: Re: Persistent Parameters
Post by: Nitromuse on November 10, 2012, 01:55:30 PM
Getting a little closer, it doesn't appear to be a problem with the Set and Get commands but rather when I set a OEMDRO from a macro it doesn't persist, even though I can watch the DRO change when I run the macro.  If I manually change the DRO and enter as you have to after entering the new value it persists and can be verified in the XML.  So now the question is how do I get the value to 'stick' when it's changed via a macro?
Thanking you once again.
Title: Re: Persistent Parameters
Post by: BR549 on November 10, 2012, 02:25:53 PM
I just checked and HERE it works just fine. It saves Vars and dros and I see them in the XML and after I restart they are still there and can be called up via macro. Where are you running the macros from. What type dro are you setting. OEM,USER?

Same with VARs they stay persistant in the range of 500-600. THOSE are the only ones that will by the way.

(;-) TP
Title: Re: Persistent Parameters
Post by: ger21 on November 10, 2012, 03:20:28 PM
Are you using an old version of Mach3?
Title: Re: Persistent Parameters
Post by: Nitromuse on November 10, 2012, 03:51:15 PM
I'm running the macro from Mach3\macros\Mill.  Version 3.042.040  I'm using an obscure OEMDRO right now, Tangential Lift Angle #92 since I figured it wouldn't be influenced elsewhere and it is part of the XML, not all DRO's are.  Doing more investigation I find 2 XML files, both with the same mod date and time, one in the Mach3 directory and the other in Mach3\macros\Mill directory, HERE'S the WEIRD THING, the XML in the Mach3 directory is holding the default value, in this case 45; the XML in the Mach3\macros\Mill directory is showing the value I set via the macro.  I always thought the XML of the profile was in the main directory only.  Can you shed any light on this.
I sincerely appreciate your help, thanks.
Title: Re: Persistent Parameters
Post by: ger21 on November 10, 2012, 05:20:30 PM
You really should be using a UserDRO, I think the range is 1200-2000. There's no guarantees that any OEMDRO's will allow you to store your own values.
I wasn't aware of an alternate .xml. I just checked. I have about 25 profiles on this PC, as I do a lot of testing for other peoples problems. The only one that an an .xml in the macro folder is my main profile. But, the date on it is 2 years old, and I run Mach3 with that profile several times per week.

As I said, try using a User DRO above 1200, and the value should be saved in the regular .xml
Title: Re: Persistent Parameters
Post by: Nitromuse on November 11, 2012, 11:00:02 AM
Good'ay
I've spent an hour or so this morning with a fresh mind and here are my findings; I tried the User DRO way of going, I can set it and retrieve it in one session, but when I close Mach down and re-start it I loose it.  Checking 2 different PC's and 2 different configurations neither has any User DRO's in the XML files.

Setting and Getting Vars works about the same and I can find the value in the XML, but not the XML in the main Mach directory but rather in a XML file in the macros\profile directory, trouble is when the new iteration of Mach starts it reads the XML in the Mach directory and returns the default value.  Why these work for you and not me leaves me baffled but I know if it won't work for me it probably won't work for someone else so I can't rely on it, which is disappointing.  Don't get me wrong, I still think Mach is a great program, especially considering bang for your buck.  I've devised a way around this for my app but it would be nice if I could depend on setting a Var or Param and get it days later via the XML.  Why are there 2 XML's, why does it write to one and read from the other?

Thanks for listening, if you've got any further ideas I'd like to hear them, and bottom line if we can help make Mach better it is to everyone's advantage.
Title: Re: Persistent Parameters
Post by: BR549 on November 11, 2012, 11:28:42 AM
(;-)  The active XML will be the one in the active directory. IF you are using mach3millXYZ  then the active xml should reside in that directory as well. How else is MACH3 to know what you have setup ?  The xml in the mach3 directlry will be a default XML not the active.

Now IF you do a defalut setup of mach3 as installed then the xml MAY reside in the default dir C:\mach3.

It is MY understanding that when using User dros  they will not be saved UNLESS they are active in a screenSet. I will test that for you.

#Vars in the range of 500-600 ARE saved every time to the "active" XML. Here it has NEVER failed to do so.

(;-) TP
Title: Re: Persistent Parameters
Post by: Nitromuse on November 11, 2012, 11:56:07 AM
This is most likely my problem but I've gone round and round so much now I'm confused honestly.  Why is the XML in the Mach3\macro\profile directory?  It contains the right value but when Mach is re-started it evidentally doesn't read from that file since it doesn't return that value.  Could I be missing a whole sub directory to the Mach3 directory?  Also the 2 XML's are different sizes but both have the same mod date/time stamp.
Pretty confused right now!  Could you give me an example of the path to your active directory containing the XML?  On 3 different configs the only place the XML's are in the main Mach3 directory and in the macros\profile directory.  Thanks again.
Title: Re: Persistent Parameters
Post by: BR549 on November 11, 2012, 11:59:04 AM
OK more input IF you are using say Userdro(2000) and expect to find it in the xml you will not find it as such. Art created a unique save function for such and it is NOT saved directly into the XML as the original ID.

For instance I created a Userdro(2000) dro and input data of 9999. IF you look for the Usedro#2000 in the saved xml you will not find it as such. In this case the actual value was saved in OemDro2_747. Changed that value to 8888 saved then reload mach3 and the value in userdro(2000) is now 8888.

It does NOT really matter HOW he saved it as LONG as he did. (;-).

You do have to have persistant dros checked(;-).

(;-) TP
Title: Re: Persistent Parameters
Post by: BR549 on November 11, 2012, 12:02:51 PM
Look at you MACH3  ICON where you load MACH3. Right click on it then click properties. At the end of the string you should have a P/ string that POINTS to the active XML that MACh3 uses to run with. WHERE does yours point to c:\Mach3  or C:\Mach3\MAch3mill  ?

You can literaly have dozens of MACH3 versions set up to run from different profiles BUT MACH3 will ONLY run the one it is pointed to.

(;-) TP

Title: Re: Persistent Parameters
Post by: Nitromuse on November 11, 2012, 03:52:29 PM
Well a long day but I finally got it and learned a bit in the offing.  No matter what I did the use of SetVar and GetVar, the best easiest way to do what I've been trying to do, upon closing Mach would write the value to the XML that was in the Mach3\macros\profile directory. I even deleted this file a couple of times but it would re-write itself on closing.  When I re-started Mach it would read the value of the Var from the XML in the Mach3 directory, that was with version 3.042.033.  Finally I decided to try version 3.043.066 and it worked like a charm, no XML in the Mach3\macros\profile directory!  So Gerry when you asked if I was using an old version of Mach I guess we should have taken it more to heart.  Maybe I can get back to making chips tomorrow.  Thanks for your help gentlemen.