Jump to content

Welcome to eMastercam

Register now to participate in the forums, access the download area, buy Mastercam training materials, post processors and more. This message will be removed once you have signed in.

Use your display name or email address to sign in:

Need to post two files at once during same posting


Recommended Posts

I have been trying to create a buffer file, but I haven't gotten it to work. The info in the MP post guide doesn't do a great job of explaining it. Do you have an example of the code to get it to work (create a text file)?

 

In the text file, I want to output a miscellaneous integer and some other data along with the toolpath.

 

End product is a text file that can be brought into a database to show us in our own form what toolpath parameters are for what feature on a part. The miscellaneous integer will correspond to the bubble number on the drawing. This way, we can tell what features are done with what tool, cycle, feed and speed, etc...

Link to comment
Share on other sites

For what you are trying to do, you'll probably want to generate the file using a String buffer, so that you can save both numeric and string data. That means you need to have your logic take the parameters, and format them for output, that way you get the prefix string characters.

 

Creating the buffer is dead simple. Just use the 'fbuf' command in the first column, and enter the 5 parameters needed. The 2nd parameter is the "keep flag" that tells MP to write the file when posting has finished. The key point to remember is that you also need to set the file path/name/extension of where you would like to write the file.

sbufname8$    :  "C:\TEMP\buffer8.txt"
size8    : 0
rc8      : 1
wc8      : 1
str8     : ""  #Empty string to be input for buffer write

fbuf 8 1 256 0 1

The documentation is a bit cumbersome sometimes, but I generally find that the answer is available, which is hugely helpful. Starting with the release of Mastercam X, several enhancements were made to the way buffer files are defined. They added a 5th parameter to the 'fbuf' definition. This parameter specifies a "real number" buffer (0), or a "string buffer".

 

When doing large projects like this, I break them down into small tasks. First, verify that the buffer file you've defined is working, by writing some stuff to the buffer file. At the end of posting, MP will write the String Buffer to a text file.

 

After adding the buffer definition above, add some simple lines to 'psof$' to make sure everything is working.

psof$            #Start of file for non-zero tool number             
      size8 = rbuf(8, 0) #Reading record zero initializes buffer
      str8 = "This is a test string, and should show up on line 1"
      str8 = wbuf(8, wc8)
      str8 = "This is a another test string, and should show up on line 2"
      str8 = wbuf(8, wc8)
      str8 = drs_str(2, t$)
      str8 = str8 + " - Tool Number"
      str8 = wbuf(8, wc8)
      str8 = drs_str(2, tloffno$)
      str8 = str8 + " - Tool Offset Number"
      str8 = wbuf(8, wc8)
      str8 = "The whole point here is that you can build up a string of info, "
      str8 = wbuf(8, wc8)
      str8 = "write it to the buffer, and once you've written the data to the "
      str8 = wbuf(8, wc8)
      str8 = "buffer, the 'write counter' (wc8) is auto-incremented. This lets"
      str8 = wbuf(8, wc8)
      str8 = " you continue to write the data on a new line, each time you invoke"
      str8 = wbuf(8, wc8)
      str8 = " the wbuf command."
      str8 = wbuf(8, wc8)

So hopefully that gets you started.

  • Like 1
Link to comment
Share on other sites
  • 2 weeks later...

Thanks so much, it got us started, but we were a little confused on what the following means:

 

drs_str(2, t$)

 

 

Also, how do you get the file name to automatically be named either the mastercam file name or some other variable of our choice?

We try to put a variable in where the t$ is and it doesn't work. Is that just for integers, or can we put a string or variable in there?

 

Each tool is going to have a description. How and where do we put the logic in the post to get this to capture and add lines in the buffer file?

Link to comment
Share on other sites

The 'drs_str' function is used to convert a numeric variable (in this case 't$', which holds the current "tool number") into a string variable that has been formatted. You can do a search for 'drs_str' on the forum to learn more about its use.

 

As Ex-WCC mentioned, the amount of work you want to do to get this to happen is extensive. I'm not going to be able to walk you through the entire process by making a few forum posts.

 

You only need to use the 'drs_str' function if you want to convert a numeric variable into a string. The program name 'snamenc$' string will have the name of the NC file. Here are some of the common string variables you might want to include:

snamenc$
snamenci$
snamepst$

spathnc$
spathnci$
spathpst$

smcname$
smcext$
smcpath$

You would just use concatanation to add the string values together.

str8 = sncpath$ + snamenc$ + ".txt"
str8 = wbuf(8, wc8)

str8 = smcpath$ + "OUTPUT.TXT"
str8 = wbuf(8, wc8)

Hope that helps,

 

Colin

Link to comment
Share on other sites
  • 4 weeks later...

Hi,

 

Can please someone give me a Little help, something similar to this topic.

So, I Need to build a postprocessor that will run 3 subpostprocessors.

Why do I want that ?
I´m working on post for 6 axes machine, and I´we concluded (maybe I´m wrong and someone has other idea ?) that first I would build 3 Posts that would process different kinematics :

1) X,Y,Z,A,B

2) X,Y,Z,A,C

3) X,Y,Z,B,C

Then, the "main postprocesor" would have logic to detect which post would be used for particular operation.

And then, while posting, we would, for example, have something like this :

OP1 -> post 2)

OP2 -> post 3)
OP3 -> post 2)

OP4 -> post 1)

.... etc. .... all together go to one .NC file

 

So, can I do something like that ?

Is there a function that can call another post from post ?

 

Thanks all,

Edi.


 

Link to comment
Share on other sites

While it is possible to use external files while post processing, I do not believe that it is possible to pass the variables required to another post.  It would be better to have a custom 6-Axis post made for your machine.  One post can do it all.

 

Hi,

Thanks for a start.

How can I process external file ... I´we searched and can´t find proper way to do it ?

I´d like to test it, to see if it takes me anywhere.

I was thinking how to make one 6-ax post, but I allways get stuck with issue that the whole post is set up for one specific kinematic, and that kinematic uses 5 axes. 

 

Edi

Link to comment
Share on other sites

It is my understanding that external files can be read from and written to as text files.  There are also a few limited functions that can be done, like checking to see if a file exists, deleting a file and renaming a file.  There are no commands to pass processing to another file as you would with a machine subprogram.

 

There are companies that write totally custom posts that can make what you need.

Link to comment
Share on other sites

It is my understanding that external files can be read from and written to as text files.  There are also a few limited functions that can be done, like checking to see if a file exists, deleting a file and renaming a file.  There are no commands to pass processing to another file as you would with a machine subprogram.

 

There are companies that write totally custom posts that can make what you need.

Hi,

I´m the one writting custom posts :)

But this should be my first post for 6-axis machine.  I´we done 5-axis posts so far, that´s not a problem.

Link to comment
Share on other sites

If you are adept at post writing, use the matrix to calculate position of your A B and C axes.  Conventional toolpaths use the 9-value matrix and multiaxis toolpaths use the 12-value matrix (same as the 9, but vector info added).

Hm, so that would be the way to write 6 axis post ?

Is there some resurce that would give me more info about how to write 6 axis post ?

If there would be something like generic 6 axis post, I´d be the luckiest guy at the moment :)

I haven´t found anything, anything so far !

Thanks,

Edi   

Link to comment
Share on other sites

No generic 6-axis that I have seen.  One other note about generic multiaxis:  None of them use the matrix.  In all of my posts, I have re-written the multiaxis sections based on the matrix, because I like the flexibility of being able to output 3D contour as a multiaxis path.  I also have gone way off the charts and made 3D countour output simultaneous 6-axis (XYZABW) with inverse time.

 

Like JParis said, just because it can be done...  Maybe it's better to buy it.  Developing a post like this can be time consuming and frustrating.  If you have no time pressure, and like a challenge, have at it.  I actually enjoy making my post do things that most others would not try.  :cheers:

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.

Join us!

eMastercam - your online source for all things Mastercam.

Together, we are the strongest Mastercam community on the web with over 56,000 members, and our online store offers a wide selection of training materials for all applications and skill levels.

Follow us

×
×
  • Create New...