Machsupport Forum
Mach Discussion => General Mach Discussion => Topic started by: HimyKabibble on October 01, 2009, 11:01:54 AM
-
All,
Below is the first draft of the Programmers Reference Manuals for Mach3 v3.x posted for user comment. This manual documents almost all of the existing Mach-specific VB functions for Mach3 v3.x. The Modbus and Serial chapters are still in-process, and will be posted in an updated version shortly. Everything here has been tested against Mach3 v3.042.020, so, as pointed out in the introduction, you may find some differences with other, particularly earlier, versions.
Brian and I have had a significant shift of focus since this project began a few months ago. Our original intent was to thoroughly document the existing interface in a Programmer Reference, and add to that a detailed step-by-step tutorial manual, aimed at making it possible for almost anyone to learn to write Mach macros. However, as we started working on the documentation, we realized the interface itself, as a result of its rather "organic" growth, actually made learning to write Mach macros much more difficult than it needed to be - there were missing functions, duplicated functions, and the function naming and argument conventions had little consistency. For example, Feedrate() returns the current feedrate in units/minute, while SetFeedRate() sets the new feedrate in units/second. GetRPM() and SetRPM() don't actually Get and Set RPM, but the S-word value. In addition, there is the need to insert delays in certain operations, in order to get the result you expect.
As a result, we made the decision that Mach3 v4, while it would continue to support the v3 interface, would also begin the shift to a completely new VB interface with very regular naming and argument conventions, and a GREAT deal more functionality. This new interface will make it far easier to write well-documented macros, to do more with less code, and to make maintenance and updates of the underlying code far easier. It will greatly simplify macro writing, and enable you to do many things that are difficult, if not impossible, with the current interface. And, it will be much easier to learn and use, with far fewer of the quirks that those of us who've done a lot of macro programming have torn our hair out over.
This manual is being published to document what is there now, primarily so that existing macro code can be more easily maintained and, if necessary, extended. But development on this interface will eseentially cease. So, what you see is what you get, and there will likely be no further updates or bug fixes to this code. Instead, all efforts will be focused on the new v4 interface going forward. The v3 interface will continue to be supported, and you will be able to enable the "legacy mode" on a script-by-script basis. Once Mach3 v4 is released, it is *strongly* recommended that all new code be written using the new v4 VB interface.
A v4 Programmers Reference will be published in the near future, as a preview of the great things to come.
So, happy reading, and comment away!
Regards,
Ray L.
-
Hi Ray,
It is a great job you did there! It looks very comprehensive and I hope I finally will be able to write my own macros ;)
One thing I noted at first glance was the examples for FeedRate and SetFeedRate - looks like the first FeedRate in the examples has to be replaced with SetFeedRate.
Just curious, what happens if instead of 60 you put another number, will the feedrate change accordingly?
Also, will you make the content linked to the corresponding pages?
Thank you for a great document,
Daniel
-
Great Mach3 interface demistifying job, Ray!
Can't wait for the Modbus chapter, dreaming about a Brain one ;-)
Cheers and keep moving!
Velly
-
New version of the document below:
Fixed the first round of bonehead errors and typos.
Added headers and page numbers
Regards,
Ray L.
-
Nice work Ray :)
Hood
-
Looks very good Ray. ;)
Brett
-
Appreciate the effort Ray.
RICH
-
I only took a quick peek but it looks just like what i have been wanting !
Great Job !
-
Latest version below.
Regards,
Ray L.
-
Many Thanks Ray. Great job.
Ed
-
Nice work Ray, Now we have a great reference it will allow me to clear some of that detail from my grey matter now.
Thanks
Graham
-
I was doing some ad-hoc edits at the mill computer na dwishing I had a reference guide so I logged on here to check progress.
Needless to say . . . I am one happy camper!! :-* :-* :-*
-
Great job! Thank's from us all... it will save a lot of time looking for answers...
Thank's / Olov
-
With Rays permission, I have created a new version of the PDF file with fully indexed contents and bookmarks.
This should make it a bit easier to navigate this wonderful document.
Anthony
-
There seems to be a problem with your attachment, either that or I am doing something wrong, however it is much smaller than Rays original so I am guessing its not something I am doing.
Hood
-
Hood,
Just downloaded it, can't see what problem you're seeing... opens fine here...
Daniel
-
Yes, opens fine here at the workshop, will have to email it home and see if it opens there as I have a different version of Acrobat there.
Hood
-
Very nice,,, I was needing a lot.
Thanks
Rene
-
Hey Ray,
Do you want the stuff (and examples?), of the stuff I have on the VB for Modbus??? (there is only VB for the OLD serial modbus, not the new Serial plugin or TCP modbus).
Scott
-
Hi,
FYI, Ray's manual, with some updates for the new calls released in mach 3.43.6, is now available from the machsupport site documentation page.
http://machsupport.com/docs/Mach3_V3.x_Macro_Prog_Ref.pdf (http://machsupport.com/docs/Mach3_V3.x_Macro_Prog_Ref.pdf)
I want to again thank Ray for his work in creating the manual! I printed off a copy and the pages have become dog eared while developing a new screen set for Mach.
Should you find typos/corrections, please let us know. I suspect the typos will all be in sections I added for the 3.46.6 changes ;D
Dave
-
Hi,
My current licensed version of Mach3 is Version R3.042.038.
I've downloaded and viewed all drafts of the V3.x Prog Ref from v0.11 through June 2010's v0.18 and I must say all these versions are identical for the following sections GetDRO(), GetOEMDRO(), SetDRO() and SetOEMDRO() , but they among these they seem to be contradictory with what forum post discussions say about them. Some clarifications would be greatly appreciated.
The manual states GetDRO and SetDRO are deprecated and to be superseded by GetOEMDRO and SetOEMDRO. I've been using the SetDRO code variant successfully with the following syntax "Call SetDRO( 0, .5)" to set the X axis DRO from someone's example.
My understanding from more experienced Mach3 VB authors is that "SetOEMDRO(800, .5) is the equivalent form, or 801 for Y-axis, 802 for z-axis.
However, examples in all versions of the draft manual give examples one way for GetDRO, no example for GetOEMDRO and one way for SetDRO and another SetOEMDRO. And the Get vs. Set in both variants seem to be reversed.
Do these not have the same syntax format?
Doesn't SetOEMDRO expect the DRO argument to be 800, 801, 802, 803, etc.?
I ask because I've been trying to update my VB script to use SetOEMDRO instead of SetDRO, I've tried it with and without the "Call" prefix, and I experience error beeps when I hit the SetOEMDRO, and sometimes the value written is off by 20-30 ten-thousandths (and I'm using Sleep 100 statements following it).
So, what is the REAL deal?
Thanks
-
The manual appears to have the examples for SetDRO and SetOEMDro mixed up.
For SetOEMDRO and Get OEMDRO, use the numbers in the Wiki. 800, 801, 802.....
http://www.machsupport.com/MachCustomizeWiki/index.php?title=OEM_DROs
-
FYI - As I have access to the Programmer's manual, I have taken the liberty to edit the relevant sections of the manual to clarify this topic.
The new revision (0.21) It will be included with the next MSM beta release. When that is ready, I'll also send the revision to Scott so he can update the version linked to from the download page.
Dave
-
Thanks Dave and Gerry!
-
I found a bug in GetOEMDRO() but maybe it has already been reported. Also found an odd one in the handling of "MsgBox" and variable results on the first GetOEMDRO() depending on the Sleep duration (Sleep 100 is not long enough for the first GetOEMDRO.)
1. Open the attached "TestSetOEMDRO.m1s" file in VB Editor and run it first as is. Note all the Sleep durations are 1000.
2. The first GetOEMDRO() value is very interesting don't you think. See attached screenshot GetOEM Error.jpg
3. then compare it to the GetOEMError2.jpg screenshot. GetOEMDRO value bug occurs if you set the DRO to an all zero value. It isn't handling the first 4 decimal places correctly but reports the 0.00003813065 value as 3.813065...e-009.
4. as long as the value set is none zero, e.g. 0.0001, or 0.0010 then GetOEMDRO reports correctly.
5. now make changes to the Sleep duration, go down to 100, then up to 200. The first GetOEMDRO doesn't have enough time it appears and instead reports the last reported DRO value but the subsequent GetOEMDRO calls seem fine.
MsgBox refresh handling oddity. See attached GetOEMDRO Error2.jpg for an example.
Now, when a MsgBox is displaying, drag it to one side a little or a lot, then click it's OK button.
Cheers,
-
You need to tell us what version of mach you ran the script on...
Dave
-
I did, at the very beginning of this discussion :), Version R3.042.038.
-
I just tested your first Macro and it looks fine. BUT I have seen what you are seeing before. Have you tried shutting down MACH and the computer and do a cold reboot? IF that fixes it fine if NOT,
Try reloading your backup of the XML. NOT the autosave version but the original XML.You did save that right(;-)
You may have a corrupt XML
Just a thought,(;-)
-
Thanks BR549. The cold boot had no affect. So I reverted to my original XML and all those disparities I mentioned vanished, including the screen echoing when the MsgBox was moved on the screen.
I noticed that GetOEMDRO now returned only whole numbers, e.g. "2" rather than "2.0000". So is that as designed?
Once again, rescued by BR549!
-
Well NO it is not normal But that is another story. Just make sure you keep an original XML handy if you need it. DO NOT depend on the autosave version. IF you need to do an update to config as soon as you do the update save off anew copy. I date them so I know what is what.
Just a thought, but it works for me.
-
Well...I'm up for another riveting story BR.
-
FYI -
V0.22 of the manual is avail on the machsupport documentation page.
This revision also adds tables of the magic numbers to the manual.
Dave
FYI - As I have access to the Programmer's manual, I have taken the liberty to edit the relevant sections of the manual to clarify this topic.
The new revision (0.21) It will be included with the next MSM beta release. When that is ready, I'll also send the revision to Scott so he can update the version linked to from the download page.
Dave
-
Great improvement Dave. Thanks for your fast work.
-
Dave did you find all the hidden MAGIC Mach variables hidden inside the code(;-)
(;-)