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

Avs_Fan,

 

Not sure why it's not working for you. I think it's because your sof = 1 (not start of file anymore) flag is in the wrong spot. It's jsut going through and outputing everything on the first pass through the pcomment postblock. It's using rc6 as an automatically incrementing counter so it shouldn't output anything twice.

 

Roger,

 

I'm learning a lot from you here. I didn't know about the 'comm_cnt = 0' command. Nor did I know about the pscomm0 postblock. This will come in handy. Also, I like the way you check through the whole buffer and set a flag if the descriptor was actually used.

 

Brett

Link to comment
Share on other sites

Hi All,

 

Brett, after seeing the very detailed response from Roger I thought I would try that before pursuing the sof=1 placement. Thanks for replying! smile.gif

 

Roger, I tried your sample posts with some of our files & they all do just about what we want. I now need to copy the changes to one of our posts, tweak placement of comments and test. Maybe a day or 2.

This response was awesome! Thank You! biggrin.gifcheers.gif

Link to comment
Share on other sites

Thanks again to all involved but I seem to be the only one that still hasn't figured it out. I get a variable error when I run the posts that Roger provided.

 

"Variable not defined: comm_cnt

Post line number 742

Program execution halted due to error(s) in .pst"

 

I am not sure what to do now, I seems that Avs_fan does not have the same problems that I have.

 

confused.gif

Link to comment
Share on other sites

Kevin this varabile needs to be defined at the top of the post where the other varailbe are defined. Here it is taking from Rogers Martins Psoting in this Thread:

code:

comm_cnt = 0  

Thne put it in this part of the post:

code:

#Misc variables

tcnt : 0 # Count the number of tool changes

toolcount : 1 # Tool counter for logic control

toolcountn : 0 # Next tool counter for logic control

toolcountp : 0 # Previous tool counter for logic control

tooltotal : 0 # Tool tool count

nexttool : 0 # Next actual tool

I hope that helps.

Link to comment
Share on other sites

Kevin,

Yes, Roger's posts worked for us "as is". After adding the changes to one of ours I got a similar error to yours except it was the variable "one".

 

I added this in the same place Millman shows.

code:

one         : 1     #Define constant


That got rid of the error.

For reference, we used the "2-buffer" method.

Also for reference, we have V9.1 SP2 Mill Level 3 Solids with current maintenance.

Hope this helps.

Link to comment
Share on other sites

Millman,

 

Adding the COMM_CNT : 0 would make that error disappear, but the output will not be correct.

 

AVS,

I thought that I'd changed all those 'one', and 'two', references.

 

code:

 pscomm0  # Comment "pre-read" posblock

if sof = yes,

scomm0 = wbuf(one, wc1) # Save the string to Buffer 1

The 'one' in the above line is the reason for this in the 2-Buffer samples.

You can add the definition for 'one' like you did -or- change the (one, wc1) to-> (1, wc1)

 

I'm used to using the 'words' since they are defined in the MPFAN & MPMASTER type posts.

 

code:

m_one       : -1    #Define constant

zero : 0 #Define constant

one : 1 #Define constant

two : 2 #Define constant

three : 3 #Define constant

four : 4 #Define constant

five : 5 #Define constant

c9k : 9999 #Define constant

Then I realized that people may be plugging this code into PSTs that don't have these definitions and changed 'em all back to digits.

Missed that 'one' frown.gif

Link to comment
Share on other sites

Roger,

 

Thanks for the buffer methods. These will come in handy. I prefer the single buffer method. When testing the 2 buffer method I found that if I did not output a file descriptor I did not get the first op comment to appear. I guess it's only writing to the second buffer if it sees the end flag. Works great....thanks again.

 

Brett

Link to comment
Share on other sites

Ah... I see what you described.

 

I know that using the 2-Buffer method, if there where FD comments output to the post, you did not need to [/i]output[/i] the FD comment to the NC file.

Or you could output the FD comment anywhere you wished in the NC file.

I know I tested that!

But if no FD comments were in the MC9 file or you did not output them to the PST, then you got no 1st OP comment(s).

 

A lesson to be learned here... Don't do post work late at night while watching TV wink.gif

 

Here is an easy fix for the 2-Buffer method.

Alter the "poutput_comments" postblock to be this ->

code:

poutput_comments  # Output any SOF Comments 'other' than any FD commnets

if EndMarkerIndex > 0, # Comments AFTER the File Descriptor were saved to Buffer 2

[

size2 = rbuf(2, 0) # Get the size of Buffer 2

while (rc2 <= size2),

[

stemp = rbuf(2, rc2)

"(", stemp, ")", e # Output any "non" FD comments

]

]

else, # There wwere NO FD comments, so any 'other' comments are still in Buffer 1

[

rc1 = 1 # Reset the read index to the start of Buffer 1

size1 = rbuf(1, 0) # Get the size of Buffer 1

while (rc1 <= size1),

[

stemp = rbuf(1, rc1)

"(", stemp, ")", e # Output any "non" FD comments

]

]

Link to comment
Share on other sites

Hi All,

 

Just some (hopefully) useful follow-up on this thread.

 

I encounter a problem when applying Roger's code (2-buffer) to one of our posts that was modified from MPYASNAK.PST. It was already using the rc1 & wc1 strings for some tool change & staging. I just edited Roger's to rc3 & wc3 and also changed rc2 & wc2 to rc4 & wc4 to keep them in sequence.

Worked like a charm! biggrin.gif

Thanks again Roger cheers.gif

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

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