Hello Guest it is April 27, 2024, 06:37:29 PM

Author Topic: How to change probe parameters  (Read 506 times)

0 Members and 1 Guest are viewing this topic.

How to change probe parameters
« on: August 10, 2023, 01:52:45 AM »
Hello,
I am using Mach4 (with a Pokeys57CNC card) on a home-designed mill.
I am now trying to add a 3D probe. The probe signal seems to be working working.
But I cannot change the parameters in the settings or calibration pages.
For example, how to specify the "Gauge diamameter" in the calibration page. Each time I enter a value, it goes back to 1.
On the main page, when I enter a RPM value for the Spindle, it stays... why are some paramaters "untouchable"?
I guess I have still a lot to learn... but I am ready for your advice!
Thank you in advance for your help & kind regards!
Re: How to change probe parameters
« Reply #1 on: August 10, 2023, 06:44:07 AM »
Hello,

Today I had the same experience with Mach 4 Hobby 4.2.0.5165.

Hope somebody has good advice for us.
Re: How to change probe parameters
« Reply #2 on: August 10, 2023, 07:23:27 AM »
Sorry if I am "teaching you to suck eggs" but if it's like M3 you have to type in a value in the box and hit return to store it?
Re: How to change probe parameters
« Reply #3 on: August 10, 2023, 07:37:20 AM »
Thank you John... but this does not work. After return jey, the value is back to default (1)!
Re: How to change probe parameters
« Reply #4 on: August 11, 2023, 03:14:58 AM »
So everyone agrees that I should be able to type in a value for gauge diameter and it should stay???
Re: How to change probe parameters
« Reply #5 on: August 11, 2023, 05:30:12 AM »
It sounds like you may be using old code that no longer works. I first experienced this issue with 5036 .

You need to open the screen editor, highlight the dro, select Events and open the On Modify script to see if it resembles the following :

Code: [Select]
local inst = mc.mcGetInstance()
local val = select(1,...) -- Get the user supplied value.
mc.mcProfileWriteString(inst, "PersistentDROs", "droName", string.format (val)) --Create a register and write to it
return val

If not , modify your  script to match the above template, being sure to use the actual dro name in line 3.

Assuming this works for you, repeat the process for each dro in turn. It’s a bit tedious, but at least in my case, effective. 

Hope this helps.

Allan
Re: How to change probe parameters
« Reply #6 on: August 11, 2023, 08:56:44 AM »
Thank you Allan for your input.
I check the code behind the dro on the calibration page. Indeed, it is different from your example (see dros_orig).
I changed the one related to the Gauge diameter according to your suggestion (see dros_new).
Unfortunately, the behavior is the still the same. As soon as the return key is pressed, the value go back to 1... :-\
Re: How to change probe parameters
« Reply #7 on: August 11, 2023, 12:09:46 PM »
Something has gone wrong for you, as the new file refers to a different dro to the original one, and shows its original code using scr.GetProperty(), which, as you’ve discovered, no longer works.

Taking your example of droGageDiameter , you should modify and save the script so that it reads as follows:

Code: [Select]
local inst = mc.mcGetInstance()
local val = select(1,...)
mc.mcProfileWriteString(inst, "PersistentDROs", "droGageDiameter", string.format (val))
return val

This should then work, though you may find that you need to restart Mach4 after saving your changes. The secret lies mainly in the select statement on line 2, which retrieves the value you type in rather than the pre-existing value of the dro.

Allan

Re: How to change probe parameters
« Reply #8 on: August 12, 2023, 05:23:22 AM »
Thank you Allan! With the code you provided, I was able to enter another value to DRO. I had to modify several of them...
And for other dros, there is another code (see attachement) that also does not accept user values... I do not even know what to do with this.
How is all this possible? I have installed the latest version, with a hobby license and the code is completely corrupted??? :-\
Re: How to change probe parameters
« Reply #9 on: August 12, 2023, 05:53:24 PM »
The dro code for the OnModifyScript of each of the Probing settings needs to be changed in exactly the same way as you have already done for the PersistentDROs. See the example heare that I use for the FastFeed dro:

Code: [Select]
local inst = mc.mcGetInstance()
local val = select(1,...) -- Get the user supplied value.
mc.mcProfileWriteString(inst, "ProbingSettings", "FastFeed", string.format(val))
mc.mcCntlSetLastError(inst, "Probe: Fast find feedrate updated")
return val

Essentially, you should only need to modify line 2, replacing it by the select(1, …) statement, which retrieves the numeric value you typed into the field and saves it in the variable val; and to add the last line, if it  is missing, which returns your changes and allows the new value to be stored in the dro. The return statement must always be on the last line. That’s it!

Line3 saves a text representation of the new value in the machine.ini file. You can open this file in a text editor, e.g. Notepad, if you wish and search for the section [ProbingSettings] . Under this heading you will see all of the values that have been saved from the Settings screen. Previously, you were saving values in another section, [PersistentDROs]. All of these values are saved in the machine.ini file so that they can be retrieved and used to populate the on-screen dros next time you start Mach4.

Notice that val is a number and needs to be converted to a text string for use in the function mcProfileWriteString(). This conversion can be done with either the tostring() or string.format() functions, which are similar, so  either should work. In short, you shouldn’t need to change line 3. .

Line 4 simply writes a message to the status line at the bottom of the screen: its use is optional and you can alter the message element to suit your preferences should you wish. Again, it is not necessary to change this line.

I hope this helps you to see the similarity between what you are faced with now and what you previously tackled. As I said earlier, the sheer number of functions that need to be updated makes this a tedious procedure, but you may as well do all of them whilst it is fresh in your mind – it doesn’t actually take that long once you get into the swing of it. Best of luck!

Allan