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:

Make Your Post Catch Common Errors


Recommended Posts

I'm not sure about you guys, but I tend to overlook simple, but critical details when I am programming. Some of my most common oversights are forgetting to turn on the coolant, and making sure that H and D outputs are appropriate for the tool. As a safeguard against my scatter-brained behavior, I have built a safety net into my post that will notify me that I have overlooked something. I will share this safety net for any of you that have an interest.

 

When posting, as each toolpath operation is processed, the post checks for any common errors that I have designated. If any are found, a popup box appears notifying the toolpath number, tool description and the error encountered.

 

The core of this feature is the popup box. You will need to add an entire postblock like this:

ptlchg_errorpop #Pop-up common toolchange errors
 if DepthCuts = 0,
	 [
	 if NumEntities = 1, errorcheck = 1
	 else, errorcheck = 3
	 ]
 else, errorcheck = 3
 if tloffno$ <> t$ & tloffno$ <> zero, [if mprint(stooldiameteroffserror, 2) = 2, exitpost$] #Diameter
 if tloffno$ = zero, [if mprint(stooldiameteroffszeroerror, 2) = 2, exitpost$] #Zero Diameter
 if tlngno$ <> t$ & tlngno$ <> zero, [if mprint(stoollengthoffserror, 2) = 2, exitpost$] #Length
 if tlngno$ = zero, [if mprint(stoollengthoffszeroerror, 2) = 2, exitpost$] #Length
 if coolant$ = zero, result = mprint(scoolantisoffserror, 1) #No Coolant

The strings that contain the text in the boxes are defined like this:

# --------------------------------------------------------------------------
# Error Checks
# --------------------------------------------------------------------------
sOpSeqNo	 : "" #Operation manager displayed operation number
stoollengthoffserror = "Operation " + sOpSeqNo + ": " + "(" + s20001 + ") TOOL LENGTH OFFSET DOES NOT MATCH TOOL NUMBER"
stoollengthoffszeroerror = "Operation " + sOpSeqNo + ": " + "(" + s20001 + ") TOOL LENGTH OFFSET IS ZERO"
stooldiameteroffserror = "Operation " + sOpSeqNo + ": " + "(" + s20001 + ") TOOL DIAMETER OFFSET DOES NOT MATCH TOOL NUMBER"
stooldiameteroffszeroerror = "Operation " + sOpSeqNo + ": " + "(" + s20001 + ") TOOL DIAMETER OFFSET IS ZERO"
scoolantisoffserror = "Operation " + sOpSeqNo + ": " + "(" + s20001 + ") COOLANT IS TURNED OFF"
serrordetect = "POTENTIAL OFFSET AND/OR COOLANT ERRORS DETECTED. NOTIFY?"
s20001 : "" #String for tool description
s20002 : "" #String for tool description

 

And finally, since I have jobs that I intentionally leave the coolant off, I created an escape route from the parade of popups, like this:

ptlchg_errorcheck  #Check for common toolchange errors
   if errorcheck = 0,
   [
    if tloffno$ <> t$ | tlngno$ <> t$ | coolant$ = zero, result = mprint(serrordetect, 2)
    if result = 1, errorcheck = 1
    if result = 2, errorcheck = 2
      ]
   if errorcheck = 1, ptlchg_errorpop

This creates a single popup that notifies me that errors were found. Do I want to see them?

 

Now, to make this work, you need to:

1. In the pparameter$ section, add this:

if prmcode$ = 15084, NumEntities = rpar(sparameter$, 1)
if prmcode$ = 15211, DepthCuts = rpar(sparameter$, 1)
if prmcode$ = 15240, sOpSeqNo = sparameter$	 #This is the operation manager operation number
if prmcode$ = 20001,
 [
 s20001 = sparameter$
 s20002 = sparameter$
 ]

2. In the variable format area, add this:

fmt	 4 errorcheck #Flag for error notification
fmt	 4 NumEntities #Flag for Contour Chains
fmt	 4 DepthCuts #Flag for Depth Cuts

 

3. In the psof$, ptlchg0$, and ptlchg$ sections, add this near the top:

 ptlchg_errorcheck #Check for common toolchange errors

 

Note: Some of the popups have one option, and some have two. On major errors, I have assigned the second button to exit the post.

 

I have tried to thumbnail an image of a coolant popup, without success. So, I have attached a PDF of the image here:

coolant.pdf

  • Like 3
Link to comment
Share on other sites

It seems that I omitted the string definition for the tool description.

 

This code also is needed:

s20001 : ""				 #String for tool description
s20002 : ""				 #String for tool description

 

(These lines have been added into the original post above, so be careful not to double define them)

 

AxelZu, I have edited your file and attached.

mpmaster.txt

  • Like 1
Link to comment
Share on other sites

This was an awesome idea, I love the idea of it catching minor problems which can be a big problem at the machine. I implemented this into my post the only question I have is, I purposely messed up tool lengths and diameters to try it out and on one of my operations I have it set for depth cuts and it is giving the same warning for each depth. The operation is setup with 9 depths and I get the same error message 9 times. Do you know of something that may cause this. I am using a slightly modified mpfan post that came with X7.

Link to comment
Share on other sites

The following fixes the repetitive popups on depth cuts:

Change this:

ptlchg_errorpop #Pop-up common toolchange errors
 errorcheck = 1

 

To this:

ptlchg_errorpop #Pop-up common toolchange errors
    if DepthCuts = 0, errorcheck = 1
    else, errorcheck = 3

 

In the pparameter$ section, add this:

if prmcode$ = 15211, DepthCuts = rpar(sparameter$, 1)

 

In the variable format area, add this:

fmt	 4 DepthCuts #Flag for Depth Cuts

  • Like 1
Link to comment
Share on other sites

For those of you that have already edited this into your post...

 

The following fixes the repetitive popups on multiple chains:

Change this:

ptlchg_errorpop #Pop-up common toolchange errors
 if DepthCuts = 0, errorcheck = 1
 else, errorcheck = 3

To this:

ptlchg_errorpop #Pop-up common toolchange errors
 if DepthCuts = 0,
	 [
	 if NumEntities = 1, errorcheck = 1
	 else, errorcheck = 3
	 ]
 else, errorcheck = 3

 

In the pparameter$ section, add this:

if prmcode$ = 15084, NumEntities = rpar(sparameter$, 1)

 

In the variable format area, add this:

fmt	 4 NumEntities #Flag for Contour Chains

 

For those of you that have not done anything yet, I have edited the original instructions to incorporate these refinements.

  • Like 1
Link to comment
Share on other sites

Hi Ex-Wcc,

 

Try looking at your post and see if there is an "update operation ID" at the end of 'ptoolchng1002$'. (!op_id$)

 

I like to move this code to the end of 'psof$', 'ptlchg$', and 'ptlchg0$', so that I can test the value of 'op_id$' and see if it has changed. That way you can easily identify if you are still in the same toolpath operation (depth cut or multi-pass), or if you are processing a new operation.

 

It would probably be easy to catch these errors in 'pwrtt$', so that you could build a list of errors (error type and operation number) and then prompt to alert the user that the list has been generated. If you save the list of errors to a string buffer, you can rename the buffer file to whatever makes sense ("part nubmer" + .txt maybe?), and then use the 'setncstr' function to display the error buffer list in the NC editor...

 

Just a thought...

Link to comment
Share on other sites

Colin,

 

I had considered the text file generation, but I kind of like the 'in-your-face' style of the popup windows.

 

To be honest, I had not yet considered filtering the depth cuts until Jamie had brought it up, and the way that I approached it made the most sense to me. The subsequent refinement for multiple chains was a result of the first refinement.

 

The suggestions you made will be looked at in the new post that I am working on. Thanks for the feedback. :cheers:

  • Like 1
Link to comment
Share on other sites

I have not yet got myself to the point that I'm actually editing the .pst file. However, I was concerned about my habit of forgetting to make sure that I had a different D comp. number than my Tool number when it came to the older machines that don't have a separate offsett for diameter comps. You know what happens when your diameter comp is picked up and your control doesn't have a seperate D offset from the length offset. Believe me I love your idea of putting in pop up windows to warn of potential problems and someday I will do the same.

 

Untill then I found a way that takes away most of my trouble with the D comp. thing. I simply went into the control definition and clicked on tool. There is a place to check for "Add to tool", then one field for length, and the other for diameter. For the older machines that don't have the seperate offset for diameter comps. I add the amount of the magazine capacity ( you can use any number though ) to the diameter field. Now when you create a new tool MasterCam will fill in the diameter offset in your tool creation page automatically. If you entered 20 to "Add to tool" and you create an end mill with the tool number 4, it will automatically fill in the diameter field with the number 34.

 

Tools already created in an existing file may not change real time, but newly created tools will. Now I could swear that in X6 I could change this setting for only the file currently opened if I opened it from "Machine group properties/files/edit. This wouldn't change the setting for new files. When I just tried it in X7, it didn't seem to work unless I made the change from Settings/machine definition manager. When you make the change that way, it changes that machine setting for every file after that. There may be a pick when you change the control definition from Settings/machine definition manager that will only change the file you currently have opened, I don't know.

 

When I find a method that works for a task I often won't try other settings for quite some time. As I said, I'm just getting started with getting the code to read the way I want it to.

 

I hope this made enough sense to use it.

Link to comment
Share on other sites

For anyone that decides to implement these safety checks: beware that the code does not support X style coolant. V9 coolant uses the 'coolant$' predefined variable in the post. X Style coolant used Canned Text values to determine the state of each individual coolant option, and never sets the 'coolant$' variable. It will always be zero.

Link to comment
Share on other sites

Logic can be added to the post so that the correct "D" value is output.

This allows you to post to dissimilar machines, without modifying any tool settings.

Below is some examples.

Setting d_offset to 30 would output all "D" values as T + 30.

 

 

h_offset : 0 # Length offset method

# 0 = H value is always same as Tool number

# 1 = H value as set in Mastercam tool parameter (from NCI file)

 

d_offset : 0 # 0 = D value is always same as Tool number

# 1 = D value as set in Mastercam tool parameter (from NCI file)

# > 1 = D value is Tool number plus value of d_offset variable

 

 

 

p_tlngno # output tool length offset

if h_offset = 0, *h_num, !tlngno$

else, *tlngno$

 

p_tloffno # output tool dia offset

if d_offset > 1, d_num = t$ + d_offset

else, d_num = t$

if d_offset = 1, d_num = tloffno$ #set from NCI

d_num, !tloffno$

Link to comment
Share on other sites
  • 3 weeks later...

What I like is that possible errors are shown in the NC-code as well.

 

For this, I made the following changes to the ptlchg_errorpop. So if by change this NC-code is send to the machine, the operator knows why code is missing. Another reason is for those that like to hit the "Cancel" button on every error message.

 

ptlchg_errorpop #Pop-up common toolchange errors

if DepthCuts = 0,

[

if NumEntities = 1, errorcheck = 1

else, errorcheck = 3

]

else, errorcheck = 3

if tloffno$ <> t$ & tloffno$ <> zero, result = mprint(stooldiameteroffserror, 2)

[

if result = two, #Diameter

[

n$, "Operation ", *sOpSeqNo, ": (", *s20001, ") TOOL DIAMETER OFFSET DOES NOT MATCH TOOL NUMBER", e$

exitpost$

]

]

if tloffno$ = zero, result = mprint(stooldiameteroffszeroerror, 2)

[

if result = two, #Zero Diameter

[

n$, "Operation ", *sOpSeqNo, ": (", *s20001, ") TOOL DIAMETER OFFSET IS ZERO", e$

exitpost$

]

]

if tlngno$ <> t$ & tlngno$ <> zero, result = mprint(stoollengthoffserror, 2)

[

if result = two, #Length

[

n$, "Operation ", *sOpSeqNo, ": (", *s20001, ") TOOL LENGTH OFFSET DOES NOT MATCH TOOL NUMBER", e$

exitpost$

]

]

if tlngno$ = zero, result = mprint(stoollengthoffszeroerror, 2)

[

if result = two, #Length

[

n$, "Operation ", *sOpSeqNo ": (", *s20001,") TOOL LENGTH OFFSET IS ZERO", e$

exitpost$

]

]

if coolant$ = zero, result = mprint(scoolantisoffserror, 1) #No Coolant Only supported for V9 style coolant!!!

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