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:

Canned text editing - How to output something other than M codes?


Recommended Posts

Hello again!

I'm looking to modify canned text in my post, I run a lot of cavity tools and would like the ability to reverse the spindle and dwell for a sec before changing tools to sling chips off. I've found reversing to 6000 and waiting for a second is usually all it takes and would save the operator a lot of trouble.

I've messed with gun drill cycles, so I have mastercam labeling the canned cycle properly, but now I'm having a hard time finding the bit in the post that actually outputs the text.

I am trying to use scant6, I have the mpm_okuma post lightly modified but I found a few bits of the code that looked to do what I wanted, but it's still outputting M6's instead.

#Cantext string definitions (spaces must be padded here)
sm00 : "M00"
sm01 : "M01"
scant5 : "G04 P1"
scant6 : "M04 S6000"
strtextno : ""
strcantext : ""

From what I can gather, it's going wrong right around here.

fmt "I" 3 iout #Arc center description in X
fmt "J" 3 jout #Arc center description in Y
fmt "K" 3 kout #Arc center description in Z
fmt "K" 2 lead #Helical lead
fmt "R" 2 arcrad$ #Arc Radius
fmt "F" 15 feed #Feedrate
fmt "P" 11 dwell$ #Dwell
fmt "M" 5 cantext$ #Canned text
# --------------------------------------------------------------------------

This would be perfect for a parts catcher or tailstock, but not for multiple codes from one canned text selection like I'm after. Since I don't want to break M00's, how do I go about switching this canned text off of this single number mode? Is this related to the coolant commands at all?

I made a mpm_okuma.text file and put some stuff in there

[canned text]

1. "Stop"

2. "OStop"

3. "Bld on"

4. "bLd off"

5. "M5"

6. "M04 S6000"

7. "M7"

8. "M8"

9. "M9"

10. "M10"

11. "M11"

Not sure exactly where I found this in searching, but it's not working yet!

Thanks in advance for any help!

Link to comment
Share on other sites

I'm not totally sure what you are asking so I'll try to cover the whole thing but not in great detail.  The information that is shown in the operations is stored inside of the Control Definition text information in XML format.  You're suppose to set this up inside of the Control Definition  under the text section.  This is only what is displayed in the operation, not what is in the actual code.

I'm not sure about your post but the information for the actual code is stored as string variables sm01 through sm200 normally. The numbers in these strings correspond to the numbers in the Control Definition's text area.

Again, I'm not sure about your post but the post should build the strings in the order you place the texts in the can text area using the pcan, pcan1, pcan2, pcant_1 through pcant_200, and the  pcant_out postblocks.

 

  Hope this helps.

Edit:

forgot the T in pcant_out.

Link to comment
Share on other sites

What I am after is a single canned text entry that will output G30 P1 to move to a safe location, then M04 S5000 followed by a G04 P1. I would like for it to display as "throw chips" or in Mastercam, I've got editing the machine def down so that displays properly. It is pcan_06, so every time it is called the post will output M6 as that's the only logic check the post has by default. I would really like to mess with it further and see if I can pull variables from the linking parameters page so I can "clear chips" inbetween holes in a block using canned text, change at point. Or maybe I'll just make another custom drill cycle, that would probably be easiest.

Colin, once again thanks for your help! I'm going to mess around with this and see if I can get what I'm after on my own!

if cantext$ > five,
[
strtextno = no2str(cantext$)
strcantext = strcantext + strm + strtextno
strm is a fixed variable, "M", and strcantext is fixed " ". strtextno is the buffer that is filled in the line before, in this case it's a 6.

So, this makes M6s! I think that makes sense!

Thanks again!

Link to comment
Share on other sites

Yes. That's exactly where you should make your edits.

There is logic that says "if the value of 'cantext$' is greater than 5", then output it as a M-Code.

You can modify that output block, as needed, to capture different conditions.

Here is that same Block, modified to output what you wanted:

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 + scant5
        if cantext$ = 6,
          [
          pbld, n$, "G00 G30 P1", e$
          pbld, n$, "M04 S5000", e$
          pbld, n$, "G04 P1", e$
          ]
        if cantext$ > 6,
          [
          strtextno = no2str(cantext$)
          strcantext = strcantext + strm + strtextno
          ]
        ]

 

  • Thanks 2
Link to comment
Share on other sites

Misc Values work great for triggering output at the Start or End of an Operation. Typically at the Tool Change event.

The advantage of Canned Text is you can activate it in the middle of your path. Either with the Toolpath Editor, or Change at Point (if your path is chain-based). My preference is to use Change at Point, because the options are then tied to the chain, and the output is still active, even if you have to regenerate the path.

  • Thanks 1
  • Like 2
Link to comment
Share on other sites
  • 4 years later...
On 6/29/2022 at 3:55 PM, paintmydrum said:

I to am in the need of post assistance.

i have tried inserting similar changes to no avail.

id like to include a custom canned text to the list. it is a sub program

If I understand what your looking for here's what I do,

        if cantext$ = 52, "M98 P5502", e$

 

 

 

Link to comment
Share on other sites

Go into the Control Definition, and edit the "Canned Text Strings" in the bottom (Post Text) section. Go to the "11th" item in the list, and type a string explaining what "the function does", like "Call Tool Breakage Macro". This will "enable" the 11th option in the list.

Now, edit your Post Processor (make a backup first!!!), in a text editor.

Here is the original section of the Post (search for it):

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$ > four,
          [
          strtextno = no2str(cantext$)
          strcantext = strcantext + strm + strtextno
          ]
        ]

Make edits as follows:

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$ > four & cantext$ <> 11,
          [
          strtextno = no2str(cantext$)
          strcantext = strcantext + strm + strtextno
          ]
        if cantext$ = 11, strcantext = "M98 P8888"
        ]
  • Like 2
Link to comment
Share on other sites
  • 2 weeks later...
On 3/9/2018 at 1:12 PM, Colin Gilchrist said:

In order to get anything "besides M-Code" out of Canned Text, you must modify the 'pcant_out' Post Block. In there, you can add logic to do whatever you want, when MP detects a certain "Canned Text Option" has been turned on.

I have never modified the "pcant_out" Post Block and have had no issues. I also put the Canned Text code in the area where it would be used.

Are you stating that the Canned Text code should be in the Canned Text section of the post? If yes, what would the advantage be?

Link to comment
Share on other sites
15 hours ago, Tim Johnson said:

I have never modified the "pcant_out" Post Block and have had no issues. I also put the Canned Text code in the area where it would be used.

Are you stating that the Canned Text code should be in the Canned Text section of the post? If yes, what would the advantage be?

The advantage is simply the "existing mechanism" which exists inside MP-based Post Processors.

There are 3 Canned Text Post Block Calls: pcan, pcan1, and pcan2.

pcan = Canned Text "Before" (the tool change) > will output a line of code with standard architecture. This includes the call to 'pbld' to output Block Delete (if active), Sequence Number (n$ > only if active), the "canned text" (loaded in 'pcant_out'), and the End of Line (e$).

pcan2 = Canned Text "After" (the tool change) > will output on a separate line, like 'pcan' does.

pcan1 = Canned Text "With". This must be used in 2-parts. First, the "call" to 'pcan1' (generally at the start of the output line), and then the Post Developer includes 'strcantext' as an output parameter, generally at the end of the line of code.

Because of the existing architecture, it allows the Post Developer to 'simply move the call to 'pcan', 'pcan1/strcantext', or 'pcan2', and the output location becomes very easy for you to "move around", to get exactly where you want it to occur.

There is nothing inherently wrong with the way you may be utilizing Canned Text, but when you modify the 'pcant_out', you are simply changing how 'strcantext' gets loaded with output strings.

Technically, you can even leverage Canned Text to "set variable values", or otherwise pass data to the Post, so you "as the developer", can do whatever you want with it.

The biggest advantage to Canned Text, is the ability to trigger events "during the Toolpath itself". We typically do that with "chain-based" (Contour) paths, using the Chain Manager, Right-Clicking on a Chain, and using the "Change at Point" command. Here, you can either use Canned Text, Manual Entry, or just trigger changes like Rapid/Feed switching, Jumping Z-Height (super awesome for hopping over clamps), adding a Dwell Command, or modifying Feed or RPM values. The tricky part with modifying RPM/Feed or Feed/Rapid, is the changes are Modal. So, you generally need to make multiple changes at different points in the path, to get the output you desire. But it allows customizing "the motion" to a very high degree, with minimal Programmer inputs needed.

  • Like 1
Link to comment
Share on other sites

Thanks Colin,

The only issue I've had with Canned Text in the early "X" days (I don't remember which version). I had a problem with my first tool which is almost always the part probe. As soon as the first tool was called the program would puke. It took a while but I found that it would actually happen on the first canned text call no matter which tool change block it was in. What I did as a fix was made Canned Text 100 as "Empty" and put it in my first tool call segment. That fixed my problem. This never happened with the "V" versions. My assumption was there was Canned Text updating during that period of time.

Link to comment
Share on other sites
  • 1 month 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...