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:

Post output M911 M912


Recommended Posts

Hello all: I am trying to mod MPFAN post to output three digit M codes in canned text. This would allow us to use the post on our MAZAK Horizontals. When I add the M codes to canned text and select them for output at posting I get a 2 digit output only. I have tried reformating the output variable with no success. Any suggestions?

 

Mcam X5, solids, multiaxis, port expert, etc.

Link to comment
Share on other sites

toolpaths, manual entry, as code.....

or is this something that you need permanent in the post?

 

Yes it should be. I am trying to make this as easy as possible for the programmers. Here, most of our people do their own programming. Unfortunately not all of them are sophisticated Mcam programmers. Thus the making it easy part. I was hoping that I could mod canned text so that a simple selection and placement could be made.

Link to comment
Share on other sites

I am far from a 'guru', but I can offer this:

 

Find this line in your post:

 

fs2 6 3 0 3 0l #Integer, force three leading

 

Copy and paste, then modify to this:

 

fs2 23 3 0 3 0 #Integer, three leading not forced

 

Then modify this line:

 

fmt M 5 cantext$ #Canned text

 

to this:

 

fmt M 23 cantext$ #Canned text

Link to comment
Share on other sites

Canned Text give you a method for outputting M codes to your NC File (as you've already figured out).

 

The issue is that you need to write some additional code into your post to output these specific strings. Just changing the text field in the Control Definition does not change the output from the Post.

 

There are 200 optional canned text entries that you can manipulate. By default (without post modifications), the Canned Text number you use gets converted into an M Code (M + cantext$). So if you use Canned Text number 112, it would get converted into M112 when output to the NC File.

 

The solution (since you want M codes greater than M200) is to modify your post. This will also let you move those M codes up in the Canned Text list.

 

Canned Text 1 and 2 are used to control Machine Stop (M00) and Optional Stop (M01). Canned Text 3 and 4 are used to control Block Delete.

 

So I recommend starting with Canned Text #5 and higher.

 

In this example, I'm using Canned Text 5, 6, 7, and 8. I've modified 5/6 to output M600 and M601, and 7/8 to output M912 and M913.

 

First, make a backup of your Post file before you begin.

 

The first thing inside the Post you need to do is create your output strings (initialize string variables). I've added 4 new string variables to the list below:

 

#Cantext string definitions (spaces must be padded here)
sm00         : "M00"
sm01         : "M01"
sm600        : "M600 "
sm601        : "M601 "
sm912        : "M912 "
sm913        : "M913 "
strtextno    : ""
strcantext   : ""

 

Next you need to modify the pcant_out Post Block to include your new Canned Text options. Specifically, you need to change the 'greater than' condition to be greater than '8'. Then add the code to handle Canned Text 5-8. Do not worry about Canned Text 3 and 4. These are used to control block delete (calls to 'pbld').

 

pcant_out       #Canned text - build the string for output
     #Assign string select type outputs
     if cant_pos < three, #cant_pos indicates canned text output
       [
       if cantext$ = three, bld = one
       if cantext$ = four, bld = zero
       #Build the cantext string
       if cantext$ = one, strcantext = strcantext + sm00
       if cantext$ = two, strcantext = strcantext + sm01
       if cantext$ = 5, strcantext = strcantext + sm600
       if cantext$ = 6, strcantext = strcantext + sm601
       if cantext$ = 7, strcantext = strcantext + sm912
       if cantext$ = 8, strcantext = strcantext + sm913        
       if cantext$ > 8,
         [
         strtextno = no2str(cantext$)
         strcantext = strcantext + strm + strtextno
         ]
       ]
     else, #cant_pos indicates coolant output
       .
       .
       .

 

 

The final step is to modify the Canned Text entries in the Control Definition. That way when a user opens the Canned Text menu, they will see option #7 shows "M912" (or whatever you set it to be).

Link to comment
Share on other sites

Canned Text give you a method for outputting M codes to your NC File (as you've already figured out).

 

[/code]

 

 

The final step is to modify the Canned Text entries in the Control Definition. That way when a user opens the Canned Text menu, they will see option #7 shows "M912" (or whatever you set it to be).

Nice Colin, your replies are always so helpful. I figured this out by using the debugger but now that you mentioned it here it's become clearer; Thx. I see where the formating of the M string for canned text would have no effect on the output desired as G999 is beyond the 200 entries allowed, thus the need for "Gxxx". I was the one that introduced the G999 R. C. Hinds never mentioned what M code he actually wants. Customizing is the way to go though since even if he wanted an M code within the 200 limit he would have to use that value way down the list.

Colin do you recommend removing this from the post?

       if cantext$ > four,<-------------- now turned into five
         [
         strtextno = no2str(cantext$)
         strcantext = strcantext + strm + strtextno

Link to comment
Share on other sites

No, I would not recommend removing that line. I would recommend changing the "greater than" value to be greater than the highest value you are using.

 

Say you used Canned Text options 5-14. Each Canned Text option would be configured to output something different. In that case, I would just change the 'greater than' value to '15'.

 

You could change the action (what happens if the condition is true), to warn the user if something 'unsupported' was used. This would be done with an mprint statement.

Link to comment
Share on other sites

RC,

 

You can usually get help on these modifications from your Reseller, or someone on this board can probably help you out. This is a fairly basic post change. You'll be adding several variable initializations, and making some changes to the pcant_out post block. The last part is modifying the fields in the Control Definition.

Link to comment
Share on other sites

This is an awful lot of work to do a pallet change. Since there are no other inputs that need to go with a pallet change, and no real reason for it to be tied into any actual toolpath, wouldn't it be easier to just do a manual entry toolpath? That's what we do.

Link to comment
Share on other sites
  • 11 months later...

Hey, I'm trying to do the same thing, but use Canned Text 6 and 7 for M3 and M4. Here's what I tried:

 

#Cantext string definitions (spaces must be padded here)
sm00		 : "M0"
sm01		 : "M1"
strtextno    : ""
strcantext   : ""

# --------------------------------------------------------------------------
# Generate string for spindle
sm04    : "M4"	   #Spindle reverse
sm05    : "M5"	   #Spindle off
sm03    : "M3"	   #Spindle forward
spindle : ""		 #Target string

 

 

pcant_out	   #Canned text - build the string for output
  #Assign string select type outputs
  if cant_pos < three, #cant_pos indicates canned text output
    [
    if cantext$ = three, bld = one
    if cantext$ = four, bld = zero
    #Build the cantext string
    if cantext$ = one, strcantext = strcantext + sm00
    if cantext$ = two, strcantext = strcantext + sm01
    if cantext$ = five, strcantext = strcantext + sm05
    if cantext$ = six, strcantext = strcantext + sm03
    if cantext$ = seven, strcantext = strcantext + sm04
    if cantext$ > seven,
	  [
	  strtextno = no2str(cantext$)
	  strcantext = strcantext + strm + strtextno
	  ]
    ]
  else, #cant_pos indicates coolant output

 

 

and my code comes out like this:

 

M5M3M4M05

 

 

Any ideas where I went wrong? Thanks!

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