PDA

View Full Version : Learning to write MC Posts



skyline
05-07-2006, 06:27 PM
Hello everyone, I was wondering what is the best approach in learning how to write MC posts. What language does it use and where can I find information regarding the conventions of this programming language? Thanks. Also where can I find information on rewriting generic posts to be machine specific..

Alex_Cole
05-07-2006, 08:02 PM
Mastercam's post processors are not really any specific programming language. It's kind of there own language where they have some of there own functions.

A mastercam post processor is just a config file if you will. There is a c file called mp.dll that does all the processing. When you post a program in Mastercam the mp.dll file uses the .pst(post) file to format the lines of data that come from the NCI file. The NCI data file is read 2 lines at a time until the entire file has been processed. There is a PDF reference guide available from your local Mastercam dealer. Call them and ask them if they could send you a copy. Some distributors might charge for it, but now it is electronic instead of printed I am not sure if they still are or not.

The post reference guide explains how post processing works and what files are involved. It also has reference to available functions, and variable lists. If you do not have experience with programming it might take you a little bit to catch on, but you can get it figured out. If you do have programming background then it will probly be much easier for you to get up and writing posts.

There are posting classes available from CNC software in CT that you could take. They cover a good base of posting and how to get started. I think they have a class sometime in may but it might be too late to get signed up for it. Once again your local Mastercam dealer should be able to help you out with getting this information.

One thing I want to point out is Mastercam X posts are a little different than previous versions and are not covered in the general post reference guide yet. You can reference the Mastercam X parameter reference that gets installed in the documentation with the Mastercam X software. They have changed some things with the new version. One of the 1st things you will see is the "$" that is now at then end of all pre-defined variables and post blocks. They have also change some things about selector tables adding two digets to the fstrsel(format string select) line. The major logic methods have all stayed the same, but there are new thing to get to like the Machine def and control def parameters.

If you have questions about things feel free to ask...just send an email to alex_melissa at sbcglobal.net (replace at with @ and no spaces) I will try to help you in as timely mannor as possible.

Hope this helps

alex

skyline
05-08-2006, 06:57 PM
So there's really no good literature on this topic other than the reference guide? I saw some information in the MCAM9 Getting started book but it was very vague and gave no clues as to the modification of the post. I'll send my reseller an email and see what response I can get. Thanks

skyline
05-08-2006, 10:35 PM
Also forgive my ignorance but does the machine defs and control defs effect the way the code is generated? So in effect if this is true you can effect the way the post, post out code by changing the variables in the control/machine defs.

Alex_Cole
05-09-2006, 09:13 AM
yes the machine def and control def do have an impact on the generated code and also the toolpaths you have avalible at the time of programming.

The machine definition contains info about the physical machine and components, along with how coolant and feeds are handled. For example if in your machine build in the machine definition you do not have a 4th and 5th axis in your machine then when you are programming you should not have the multiaxis toolpaths available at the time of programming.

The control definition plays the largest part in the gcode that is output. In previous versions there were a series of switches at the top of the post processor that the user/post person would configure to change things like how arc's are output (IJK values or R values), If line numbers were output..things like this. Now in the control def most of these things are set in the different control topics. This does not apply to custom switches that might have been added to your post, and not all default switches are supported yet.

There are a lot of options in the machine def especially that are not supported yet in most post processors including the ones that come with the X system. These things somtimes can be added into your post so that they are supported but some things are not available in the NCI file yet so we cannot impliment them. They are there for future use.

Overall posting in the X system has proven to be very nice once you get some of the main differences figured out.


Just a side note: when you update a post from a previous version into X make sure you check the boxes to create a machine and control definition. When the post is being updated the system scans and reads all the switches at the top of the post processor and configures the control definition to match as closely as possible. This saves you the grief of having to go into the control def and configure everything. The machine def file that is generated is just a copy of the default which should support everything from 3 axis up to 5 axis machining. Once these files have been updated they are then associated together. Do not re-name or move these files from there current locaiton or they will loose there association to each other and then your program format will most likley change. THey must then be re-associated together for the post to function the way you are expecting. Explaining this here would take to long...I apoligise but your local reseller I am sure would be happy to walk you through it.


Hope this helps.

Alex

Rekd
05-09-2006, 11:38 AM
Writing a post would be a daunting task indeed. Your best bet would be to find a post that's close to what you want, and start modifying it.


Mastercam's post processors are not really any specific programming language. It's kind of there own language where they have some of there own functions.


Actually, MP is Mastercam's propriatary programming language. It uses all the basic features of any other language, with it's own syntax, functions, methods etc.

In order to make minor modifications to your posts, you can likely open it and do things. But if you want to use the advanced features, (if/then/else, buffer files, using strstr() and brksps() etc), then you'll need a basic knowledge of just about any other programming language, plus the reference guide. There was a book several years ago for posts, but I don't know if it's available any more.

Mike Mattera
05-22-2006, 03:03 PM
I wrote a tutorial about editing posts. It's an introduction to structutre. Click the link below and go to "Stuff for V8 & V9". Then to "How To Edit A Post".
http://www.mmattera.com/html/mastercam_stuff.html

Mike Mattera

doug6949
07-09-2006, 11:58 AM
There is a PDF reference guide available from your local Mastercam dealer. Call them and ask them if they could send you a copy. Some distributors might charge for it, but now it is electronic instead of printed I am not sure if they still are or not.
alex

Some resellers prefer not to share information on how to edit posts as this is how they earn a living. I gave up trying to get the reference guide until I stumbled across one on ebay. I ordered and it turned out to be a pirated copy - oh well. At least I got what was promised and never delivered when I bought Mastercam.

The reference guide is helpful for understanding how post processors work but you must be aware that it was written by programmers. It is poorly organized, cryptic, and not very useful to someone who doesn't understand C programming (or C programmers). Expect to read it several times as you experiment with your posts.