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:

Outputting comments to NC file. (post)


KevinPro61
 Share

Recommended Posts

I need some post help. I would like to output comments at the beginning of the NC file for Mastercam mill. These comments would be for the operator concerning the type of setup, i.e.(type of fixture, which view the program is for). I know how add comments in the post at the tool changes but that doesn’t work for what I am trying to do. Are there any fields in the job setup page that I can use for this?

 

Thanks

cheers.gif

Link to comment
Share on other sites
Guest CNC Apps Guy 1

Well, the way I would approach this as follows; Create a text file with the notes you want to insert, then where you want the instructions do a Manual Entry then use "Text File" as the source of the information.

 

HTH

Link to comment
Share on other sites

Thanks guys but now I need a little more help.

I have set up my post processor to out put the comment at the beginning of the file. The problem that arises now is that the comment for the first operation is also outputted there also. How do I go about splitting them up? I need to have the comments for the program before the first tool change and the comments for the operation after the tool change.

confused.gif

Link to comment
Share on other sites

No, we really didn't persue it much more after re-reading the quote from Roger Peterson: frown.gif

quote:

I beleive they both come out as nci lines 1008 so I don't know of an easy way to seperate the file descriptor from the first operation comment.

 

 

sorry,

 

--------------------

Roger Peterson

Prototek Engineering


We currently just do a cut&paste to put the File Descriptor where we want it in our .NC file. If there is a way to do this from the post I would love it!

Our reseller doesn't know how to do it either, so we've just been accepting it for now. banghead.gifbonk.gifbanghead.gifbonk.gif

Link to comment
Share on other sites

Hey Guys,

 

Their are several work-arounds that I know of for this problem. If you are a wiz with posts then you can do this. Yes, both the file descriptor and the Op comments come out in the nci file as gcode = 1008 lines. So, the best way to go about splitting them up is as follows. Place a call to the comment postblock in your pheader block wherever you want the first comment. What happens is the post loops through this comment postblock until it is done all of the comments. So, you would have to have some sort of character/flag in your descriptor as the last line (eg. * ). Then as you go through your comment post block you check the contents of the string scomm to make sure it doesn't equal * . If it does, you simply use the subout command to send output to an aux or ext program. The Op comment (the next thing out after the * ) goes to this ext or aux file. Simply place a mergeext, or mergeaux in you toolchange postblock where you would like the comment to come out. You'll have to make sure to use an sof flag to avoid this from happening later on by mistake. This trick is very handy if you want a custom header and don't want to be prompted with any questions upon posting.

 

Later,

 

Brett

Link to comment
Share on other sites

The Manual Entry method is certainly a usable solution.

 

quote:

I believe they both come out as nci lines 1008 so I don't know of an easy way to separate the file descriptor from the first operation comment.

This statement is correct, the File Descriptor Comments & Operation Comments are both '1008' in the NCI

 

It is possible to break them up.

 

But, you must have some method of designating one from the other.

One way to to preface the File Descriptor Comments with some "special character" that will never appear in an Operation Comment. You could use something like '$', or '*', or maybe '(' [Many controls cannot handle nested '(' or ')' within a (COMMENT) line.]

 

You would enter your File Descriptor text, something like this ->

*This is the 1st line of my file descriptor

*This is the 2ndt line of my file descriptor

*This is the 3rd line of my file descriptor

 

Note: The special prefix character can be srtipped out from each line so that it does not appear in the NC file.

 

You Operation Comments could not contain the 'special character' ->

This is the Operation Comment for Tool #1

 

If your are OK with that 'restriction', and willing to do a bit of post modification - it can be done.

 

-----

Brett was too fast for me.

 

Yes, you could also have some special 'throw away' line that ends the File Descriptor. That way you know that any '1008' [i[before[/i] that line are the File Descriptor and any '1008' comment after that is an Operation Comment.

I'd prefer not to use the SUBOUT functionality since the Post may already be using that for other purposes. Use Buffer files to save off the Comments, and read 'em back in where you want them placed.

Link to comment
Share on other sites

Here it is. This problem came at a perfect time as one of my customers was looking for something similar. Just enter the string "end" as the last line in your descriptor.

 

eg.

part no

revision

end

 

code:

pheader

sof = 1

comment

ptlchg_com

sof = 0

 

pcomment

if sof & gcode = 1008,

[

if scomm = strend,

[

scomm = wbuf(6, wc6)

buffer_flg = 1

]

else,

[

if buffer_flg, scomm = wbuf(6, wc6)

else, "(", scomm, ")"

]

]

else,

[

if gcode = 1008, "(", scomm, ")"

]

 

ptlchg_com

if sof,

[

sb6_scomm = rbuf(6, rc6)

"(", sb6_scomm, "(", e

buffer_flg = 0

]

comment

 

# ------------------------------

# Buffer 6 - Operation comments

# ------------------------------

sb6_scomm

strend "END"

buffer_flg : 0

rc6 : 2

wc6 : 1

 

fbuf 6 0 80 0

Brett

 

[ 02-20-2004, 01:52 PM: Message edited by: Dave Thomson ]

Link to comment
Share on other sites

This method needs a little tidying up. If you don't a descriptor it doesn't work so hot. firebounce.gif

 

To make it great you would really need some method of telling the post if you're using the descriptor or not. There's is no internal flag or anything in the nci file to indicate this. Lot's of ways to do this: using * before each line in the descriptor would work good, a misc integer, or if you were really ambitious you could write all of the comments to a buffer and then look ahead to see if the word "end" (in this case) is contained in that buffer. Then just output where desired.

 

Brett

Link to comment
Share on other sites

CAM,

+1 on the "sof : 0". That got rid of the error. smile.gifcool.gif

 

Brett,

I must have something wrong bonk.gif because I can't get it to work correctly. banghead.gif

I have your example verbatim in our post. It strips "END" from the Descriptor as it should. smile.gif However, when posting, as soon as it hits "comment" in "pheader" it still outputs the Descriptor & the 1st Operation comment on consecutive lines, so they're still together rather than being split up. confused.gifheadscratch.gif

 

Thanks for the help so far! cheers.gif

Link to comment
Share on other sites

Subject: Separating File Descriptor (COMMENTS) from Operation (COMMENTS)

 

As simple as (comments) may seem they are handled quite different than other NCI data.

I cannot explain everything here (see the CHAPTER about 'comments' in the Post Processor Reference Guide)

The short lesson is...

 

MP reads the comment lines that appear before the PSOF and PTLCHG data in the NCI and saves them in an internal string array.

(You cannot directly access this array from the PST.)

When the PSOF and PTLCHG postblocks are processed the contents of this array are dumped to the NC file.

Where the comments get output depends on if the 'comment' command word appear, and where is appears.

This 'comment' command tells MP call the PCOMMENT postblock. The PCOMMENT postblock is called for each comment string that was saved in the array.

If the 'comment' command does not appear in the PSOF and/or PTLCHG postblocks, MP will still call PCOMMENT, just at the start of the PSOF and PTLCHG postblocks. So the 'comment' command word lets you "place" the (COMMENT) where you want them in the toolchange code sequence.

 

As mentioned earlier, you cannot access the internal string array, but you can do this...

You can "see" (and capture) each COMMENT string as it is read from the NCI data file.

Knowing this, we can save out the COMMENT strings into our own Buffer.

MP has many 'pre-process' postblocks, such as PLIN0, PCIR0, etc. You probably don't see any of these in your PST, as there are rarely needed, but when you do need them - you can't beat 'em!

You use the PSCOMM0 postblock to accomplish the "capture" of the start-of-file comments.

This postblock is called immediately each time a comment is read in the NCI file.

The comment string is passed to the PST in the 'scomm0' string variable.

A critical note here...

Since we have done an end-run around the posts usual comment processing, we must be sure to reset 'comm_cnt' ->

comm_cnt = 0 # MUST clear MP's "internal" COMMENT buffer counter!

If you don't the (COMMENT) will get output TWICE. Once by our special comment processing and again by the std. (internal) comment processing.

By setting 'comm_cnt = 0' we make the PST think that there are NO comments in its (internal) comment array.

 

That's all fine, but the method of how you capture them depends on what you want to do with the separated File Descriptor comments.

"I just want to separate the File Descriptor Comments from the Operation Comments" really doesn't answer that!

If you know that you are always going to output the FD comments to the NC file before the Operation comment, a method using ONE buffer file will suffice.

-or-

For a bit more flexibility you could use a method that involves TWO buffer files. (This method is not really much more work than the ONE buffer method)

 

I submit for your perusal several sample Posts that implement both of these schemes.

ONE Buffer & TWO Buffer versions of the std. MPFAN.PST and the MPMASTER.PST post processors.

(See the FD-COMMENTS_POST.ZIP located in the Posts folder on the forum FTP)

This really neat thing about this is that it is very easy to drop this code into a PST.

Search the the "ADDED" tag to find the (3) areas where code was addled to the MPFAN.PST & the MPMASTER.PST samples.

The 1st ADDED section is a self contained section of code that handles the buffering (writing to & reading from).

The other 2 ADDED sections are the commands that dump the FD comments and OP comments (where you want them) to the NC file.

The MPMASTER versions have a little bit different logic using the 'sof' flag because of how it uses a 'ptlchg_com' (Tool change common blocks) and the the MPFAN.PST does not.

 

*IMPORTANT* (Other than "Make a BACKUP of your PST - BEFORE doing anything with it!") ->

These methods depend on you having a "special" ending line in your File Descriptor.

This "special" marker is defined in the string variable ->

strEndMarker "*end*" # Look for this to designate the END of the 'file descriptor' COMMENT lines

 

Note that it would be easy enough to restrict the search for this 'ending' marker so that it must appear at the START of the line,

but if you accidently had a before it, you would not "see" it.

 

You can use whatever string you wish. You could use "*" if you wish.

It's just that this string cannot appear ANYWHERE else within the FD comment lines!

"So choose wisely grasshopper" wink.gif

Link to comment
Share on other sites

I modify my post for lathe, and put a header were I have the name of part, the date of postprocesing (this is automaticaly generated), and custom variables for operation, revision, max distance to clamp, stock description.....

If you wanted to inspire mail me and I send it to you.

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...