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:

Comment Location


Recommended Posts

I have spent the last couple of hours trying to get the "machine name" and the "Group comment" to appear in the header of the nc. I am about to go insane!!!!  Can some one point me in the right direction?

 

Here is what I have.

 

X8

Post - Generic Haas 3X Mill ( the one that installs with mastercam)

 

My nc needs to look like this

O12345
(T OP-1)
(GENERIC HAAS 3 - AXIS VMC)<-- I want to add this (how do I do that???)
(GROUP COMMENT)<-- I want to add this here (how do I do that???)
(DATE - 08-13-15)
(TIME - 5:07 PM)
(GROUP COMMENT)<-- or add this here (how do I do that???)
(T1|0.5 FLAT ENDMILL|H1|D1|TOOL DIA. - .5)
(T2|0.25 FLAT ENDMILL|H2|D2|TOOL DIA. - .25)
(T3|NO. 4-40 TAPRH - CUT|H3|D3|TOOL DIA. - .112)
N1 G20
N2 G0 G17 G40 G49 G80 G90
(TOOL PATH COMMENT #1)
N3 T1 M6
N4 G0 G90 G54 X-1.525 Y-.3889 S10000 M3
N5 M8
N6 G43 H1 Z.25 T2
N7 Z.05
N8 G1 Z0. F85.
N9 X-1.3305 Y-.1945 F105.
N10 G3 X-1.25 Y0. I-.1945 J.1945
N11 G1 Y1.
N12 G2 X-1. Y1.25 I.25 J0.
N13 G1 X1.
N14 G2 X1.25 Y1. I0. J-.25
N15 G1 Y-1.
N16 G2 X1. Y-1.25 I-.25 J0.
N17 G1 X-1.
N18 G2 X-1.25 Y-1. I0. J.25
N19 G1 Y0.
N20 Y.02
N21 G3 X-1.3305 Y.2145 I-.275 J0.
N22 G1 X-1.525 Y.4089
N23 G0 Z.25
N24 M5
N25 M9
N26 G53 Z0.
N27 M01
(TOOL PATH COMMENT #2)
N28 T2 M6

It seems like I am missing something simple but I have no idea what I need to add to move the comments. All I had to do to for all the other edits I needed was # out some lines and chance a couple values. Any help is greatly appreciated.

Link to comment
Share on other sites
 

Make sure you X style post and have the following in your post, and the boxes checked in your machine properties. 

 

 

pcomment$       #Output Comments

      scomm$ = ucase (scomm$)

      if gcode$ = 1005, scomm_fx_arg = scomm$, pcomment_out  #Manual entry - as comment

      if gcode$ = 1006, scomm$, e$                           #Manual entry - as code

      if gcode$ = 1007, sopen_prn, scomm$, sclose_prn        #Manual entry - as comment with move NO e$

      if gcode$ = 1026, scomm$                               #Manual entry - as code with move NO e$

      if gcode$ = 1008, scomm_fx_arg = scomm$, pcomment_out  #Operation comment

      if gcode$ = 1051, scomm_fx_arg = scomm$, pcomment_out  #Machine name

      if gcode$ = 1052, scomm_fx_arg = scomm$, pcomment_out  #Group comment

      if gcode$ = 1053, scomm_fx_arg = scomm$, pcomment_out  #Group name

      if gcode$ = 1054, scomm_fx_arg = scomm$, pcomment_out  #File Descriptor

Link to comment
Share on other sites

As Craig mentioned, those comments are only output to the NCI file if the checkboxes are enabled (Check in Machine Group Properties).

 

Once you've turned on the output, you can process the comments.

 

It is important to understand how the comments are processed internally by the MP executable.

 

Comments are read from the NCI file, and stored inside an internal comment buffer file. This buffer file stores the "NCI Gcode" value (indicates what "type" of comment string is stored on that line), and then stores the String value associated with that NCI gcode.

 

The comments are stored inside this Comment Buffer, until MP encounters the Command Variable 'comment$', all by itself on a post line. When MP "sees" this command variable, it triggers a mechanism inside MP that dumps the content of the comment buffer, and processes each line, using the 'pcomment$/pcomment2' set of post blocks.

 

Inside the 'pcomment2' post block, there is logic that deals with each different NCI Gcode value for comments.

 

That means that if you put 'comment$' inside your 'pheader$' post block, on a separate line all by itself, then that is where your comments will be output.

 

Now the trick to keep in mind is that all the comments get processed. That means if you've got an "Operation Comment", (NCI Gcode 1008), that it will be output before the Tool List, and before the call to 'psof$'.

 

What I recommend you do is create a "flag" variable that you can use to indicate "where you are" during processing. I typically create a variable like "header_done". Then I use that variable to indicate if we are still processing 'pheader$', or if we are done with header output, and can process comments like normal.

 

Rather than just giving you the code, I'll list out the steps you need to take, and explain the logic flow. Then I'll leave it up to you to make the changes...

 

  1. Start by creating a Flag variable to track the processing of 'pheader$'. I'd recommend 'header_done' as a variable name. Initialize the variable to '0'.
  2. Create a String variable to hold the operation comment for output in 'psof'. I'd recommend 'sop_comm'.
  3. Add the Command Variable 'comment$' to pheader. Wherever you place the variable is where the comments will be output.
  4. Modify the 'pcomment2' post block entry for 'if gcode$ = 1008'. Create an Implied Post Block to check the status of 'header_done'. If header_done is "0", we are still processing 'pheader$', so save the string in 'scomm$' to 'sop_comm', if the string is not an empty string.
  5. Write an 'else' branch in the '1008' comment logic to process Operation Comments "normally", when 'header_done' is not zero.
  6. Add a line of code at the top of 'psof$' to set 'header_done' to '1'.
  7. Add a line of code to check the string 'sop_comm', and output the comment string to the Start of File, when it is not an empty string. After outputting the comment, set the value of 'sop_comm' to an empty string.

Some sample code for processing the '1008' NCI gcode:

      if gcode$ = 1008,                                    #Operation comment
	    [
		if header_done = zero, sop_comm = scomm$ #Save Operation Comment if we are not done with 'pheader$'
		else, sopen_prn, scomm$, sclose_prn, e$  #If 'header_done' is any value other than zero, output normally
		]

The only other "tricky" thing to be aware of is trying to use Manual Entry as the first Operation in your program. If you do this, the Manual Entry code will now be output from 'pheader$', so just be aware of that.

Link to comment
Share on other sites

Craig, yes I have all that I was just wanting to be able to control the comments better.

 

Colin, Thank you that works perfectly. It took me a little bit to figure out how to get step #7 formated correctly but the comments are just where I want them. I still need to work on the tool change comments so I have a couple of further questions.

 

1 Would it be a bad idea to strip the manual entry comments the same way? its not a huge deal I don't use manual entry but that might change in the future.

 

2  Will this same process work to remove all but the op comment from before the tool change for the rest of the tools in the program?  I have tried to just turn them off by # out all comment$ but they still report in the nc. 

 

I know I need to get the MP book but I am currently in the middle of my VB book.

Link to comment
Share on other sites

Craig, yes I have all that I was just wanting to be able to control the comments better.

 

Colin, Thank you that works perfectly. It took me a little bit to figure out how to get step #7 formated correctly but the comments are just where I want them. I still need to work on the tool change comments so I have a couple of further questions.

 

1 Would it be a bad idea to strip the manual entry comments the same way? its not a huge deal I don't use manual entry but that might change in the future.

 

2  Will this same process work to remove all but the op comment from before the tool change for the rest of the tools in the program?  I have tried to just turn them off by # out all comment$ but they still report in the nc. 

 

I know I need to get the MP book but I am currently in the middle of my VB book.

 

  1. "Would it be a bad idea to strip the manual entry comments the same way?". Yes, it would be a "bad idea", because it won't work. The method I showed you for Operation Comments (1008) works well, because only a single 1008 line is output for every operation. Manual Entry is different. Manual Entry outputs a comment line for each line in the Manual Entry dialog. So if you had "12" different lines of NC code, only the last line would be output, since the logic would overwrite the variable value on each pass through the 'pcomment2' post block. What I do for Manual Entry is create a String Buffer file that I can use to record each line of the manual entry. While I'm "buffering out" the manual entry lines, I set a flag variable to indicate that Manual Entry is present as the first operation. Then in 'psof', I test the flag variable. If it is "on", there was a manual entry present. At that point, we just reset the read counter, get the length of the buffer by reading record zero, and create a while loop to read each line in the buffer and output it to the NC file. That is the "proper" way to handle Manual Entry as the first operation in the file. (Note that this is only an issue if the Manual Entry is the first operation, and you need to control the output location.)
  2. The "Tool Comments" are not output with 'comment$'. Look for the 'ptoolcomment' post block. This behavior has also been setup with a "switch" inside the post. Look for "tool_info" in the "General Output Settings". Set it to a value of "3", and you'll get only a Tool List at the program header, and no Tool Comment at the tool changes. No need to make any post edits, other than setting that switch value.
  3. The MP Documentation doesn't cost anything. (Some Resellers may be charging for it, I don't know.) If you have any trouble getting a copy, send me a Private Message, and I'll send you a link to download a copy...
  • Like 1
Link to comment
Share on other sites

 

  1. "Would it be a bad idea to strip the manual entry comments the same way?". Yes, it would be a "bad idea", because it won't work. The method I showed you for Operation Comments (1008) works well, because only a single 1008 line is output for every operation. Manual Entry is different. Manual Entry outputs a comment line for each line in the Manual Entry dialog. So if you had "12" different lines of NC code, only the last line would be output, since the logic would overwrite the variable value on each pass through the 'pcomment2' post block. What I do for Manual Entry is create a String Buffer file that I can use to record each line of the manual entry. While I'm "buffering out" the manual entry lines, I set a flag variable to indicate that Manual Entry is present as the first operation. Then in 'psof', I test the flag variable. If it is "on", there was a manual entry present. At that point, we just reset the read counter, get the length of the buffer by reading record zero, and create a while loop to read each line in the buffer and output it to the NC file. That is the "proper" way to handle Manual Entry as the first operation in the file. (Note that this is only an issue if the Manual Entry is the first operation, and you need to control the output location.)
  2. The "Tool Comments" are not output with 'comment$'. Look for the 'ptoolcomment' post block. This behavior has also been setup with a "switch" inside the post. Look for "tool_info" in the "General Output Settings". Set it to a value of "3", and you'll get only a Tool List at the program header, and no Tool Comment at the tool changes. No need to make any post edits, other than setting that switch value.
  3. The MP Documentation doesn't cost anything. (Some Resellers may be charging for it, I don't know.) If you have any trouble getting a copy, send me a Private Message, and I'll send you a link to download a copy.

 

 

Colin, Sorry for the late reply. I had a fire I had to put out. I did figure out it wouldn't work for the manual entry but left it in for now  "it kinda works". The coding to do it the proper way is beyond my skill level currently. I know just enough to artfully brake a post :) I will send you a PM for the link so I can get it coded the correct way. Currently the NC posts out like this...... again thanks for the help.

%
O12345
(T OP-1)
(DATE - 08-27-15)
(TIME - 2:48 PM)
(HAAS VM-3)
(GROUP COMMENT)
(T1|0.5 FLAT ENDMILL)
(T2|0.25 FLAT ENDMILL)
(T3|NO. 4-40 TAPRH - CUT)
(1 MANUAL ENTRY MANUAL ENTRY MANUAL ENTRY)
N1 G20
N2 G0 G17 G40 G49 G80 G90
(0.5 FLAT ENDMILL)
(TOOL PATH COMMENT #1)
N3 T1 M6
N4 G0 G90 G54 X-1.525 Y-.3889 S9500 M3
N5 M8
N6 G43 H1 Z.25 T2
N7 Z.05
N8 G1 Z0. F85.
N9 X-1.3305 Y-.1945 F99.8
N10 G3 X-1.25 Y0. I-.1945 J.1945
N11 G1 Y1.
N12 G2 X-1. Y1.25 I.25 J0.
N13 G1 X1.
N14 G2 X1.25 Y1. I0. J-.25
N15 G1 Y-1.
N16 G2 X1. Y-1.25 I-.25 J0.
N17 G1 X-1.
N18 G2 X-1.25 Y-1. I0. J.25
N19 G1 Y0.
N20 Y.02
N21 G3 X-1.3305 Y.2145 I-.275 J0.
N22 G1 X-1.525 Y.4089
N23 G0 Z.25
N24 M5
N25 M9
N26 G53 Z0.
N27 M01
(0.25 FLAT ENDMILL)
(2MANUAL ENTRY MANUAL ENTRY MANUAL ENTRY)
(2 MANUAL ENTRY MANUAL ENTRY MANUAL ENTRY)
(2MANUAL ENTRY MANUAL ENTRY MANUAL ENTRY)
(2 MANUAL ENTRY MANUAL ENTRY MANUAL ENTRY)
(TOOL PATH COMMENT #2)
N28 T2 M6
N29 G0 G90 G54 X-1.2625 Y-.1945 S9500 M3
N30 M8
N31 G43 H2 Z.25 T1
N32 Z.05
N33 G1 Z0. F25.
N34 X-1.1653 Y-.0972 F47.5
N35 G3 X-1.125 Y0. I-.0972 J.0972
N36 G1 Y1.
N37 G2 X-1. Y1.125 I.125 J0.
N38 G1 X1.
N39 G2 X1.125 Y1. I0. J-.125
N40 G1 Y-1.
N41 G2 X1. Y-1.125 I-.125 J0.
N42 G1 X-1.
N43 G2 X-1.125 Y-1. I0. J.125
N44 G1 Y0.
N45 Y.02
N46 G3 X-1.1653 Y.1172 I-.1375 J0.
N47 G1 X-1.2625 Y.2145
N48 G0 Z.25
N49 M5
N50 M9
N51 G53 Z0.
N52 M01
(0.5 FLAT ENDMILL)
(TOOL PATH COMMENT #3)
N53 T1 M6
N54 G0 G90 G54 X-1.525 Y-.3889 S9500 M3
N55 M8
N56 G43 H1 Z.25 T3
N57 Z.05
N58 G1 Z0. F85.
N59 X-1.3305 Y-.1945 F99.8
N60 G3 X-1.25 Y0. I-.1945 J.1945
N61 G1 Y1.
N62 G2 X-1. Y1.25 I.25 J0.
N63 G1 X1.
N64 G2 X1.25 Y1. I0. J-.25
N65 G1 Y-1.
N66 G2 X1. Y-1.25 I-.25 J0.
N67 G1 X-1.
N68 G2 X-1.25 Y-1. I0. J.25
N69 G1 Y0.
N70 Y.02
N71 G3 X-1.3305 Y.2145 I-.275 J0.
N72 G1 X-1.525 Y.4089
N73 G0 Z.25
N74 M5
N75 M9
N76 G53 Z0.
N77 M01
(NO. 4-40 TAPRH - CUT)
(TOOL PATH COMMENT #4)
N78 T3 M6
N79 G0 G90 G54 X0. Y0. S200 M3
N80 M8
N81 G43 H3 Z.1 T1
N82 G98 G84 Z0. R.05 F5.
N83 G80
N84 M5
N85 M9
N86 G53 Z0.
N87 G53 X-20. Y0.
N88 M30
%

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