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:

Updating scoolant?


Recommended Posts

I got a post working, sent it to my co worker. First thing he says is there is no coolant. So I go look and sure enough no coolant. I check my original copy... coolant works. I file compare the two... he changed a few formatting things but nothing that looks like it would affect the coolant. So I have played around with it, put some watches on my debug and ran it. Got to a break point after my scoolant. Scoolant = 0, prv_scoolant = 0, coolant$ = 1, prv_coolant$ = 0... Why isn't my scoolant updating? Did it again with a !scoolant and then it worked... but why do I have to tell it to update? I don't remember needing that before.

 

Being still pretty new to post edits I would love a quick run down on how updates work. 

Looked over my fstrsel and it looks fine.

 

# Coolant M code selection

sm09    : "M9"      #Coolant Off (Use sm09_0 through sm09_2)

sm08    : "M8"      #Coolant Flood

sm08_1  : "M7"      #Coolant Mist

sm08_2  : "M8"      #Coolant Tool

sm09_0  : "M9"      #Coolant Flood Off

sm09_1  : "M9"      #Coolant Mist Off

sm09_2  : "M9"      #Coolant Tool Off

scoolant : ""        #Target for string

 

fstrsel sm09 coolant$ scoolant 7 -1

Link to comment
Share on other sites

I have the post back on my computer now. I checked my setting in the MD and it is on. Support for old posts or what ever. That is checked. I ran the debug... scoolant is still null. So I went back and rechecked everything. coolant is on, support is still checked, none of the misc are messing with it. I am stumped.

Thanks Colin for taking a few to look at this.

Link to comment
Share on other sites

Can you post up a Z2G file with the toolpaths, and post-processor included? (Help > Zip 2 Go Utility.)

 

First, make sure you save your file, and then run RAM-Saver. (This just ensures you have a database that is "saved"). Then run Zip 2 Go, check the boxes for Tool Paths and Post-Processor, and you are good to go.

 

If you don't want to post the file here on the forum, send me a PM with your email address, and you can send me the file over email so I can take a look for you...

Link to comment
Share on other sites

Ok, I figured out where you went wrong.

 

The mechanism inside the Post that controls 'scoolant' is known as a String Select Function. The purpose of the function is to take an ordered list of string variables, and output one of the specific strings, using a Numeric Variable as the "Selector".

 

What this means is that you don't mess with the value of 'scoolant', ever!

 

You manipulate the value of the "selector" variable, and through Modality, the post determines if the string should be output, or not.

 

Modality is controlled by MP (the post engine), automatically, based on if the value is output or not.

 

The code you see on an output line looks like this:

   pbld, n$, scoolant, e$

What actually happens when MP reads this line is that it looks at the "scoolant" string. It then checks to see the value of the Selector, which is 'coolant$'.

 

'coolant$' is a numeric variable, meaning that it's value is a number, not a string.

 

When a Numeric Variable is created, MP actually creates two different variable names, the "current" value (which is the name of the variable), and the "previous" value. (MP does this by appending 'prv_' to the front of the variable name.

 

So take the variable 'coolant$'. This is a pre-defined variable in MP, so the MP engine creates these two variables:

 

coolant$

prv_coolant$

 

When a variable is first initialized, the current value, and the previous value are both set to the same "initial" value.

 

'coolant$' is initialized to '0' by default. So the current, and previous are both zero.

 

When using "V9 coolant" in the MD, and turning "on" coolant in the operation, there is a NCI parameter that is output to the NCI file, and the value will be '1' (for flood), '2' for Mist, and '3' for "thru-tool".

 

So, when you encounter 'scoolant' on an output line, MP looks at the value of 'coolant$' (which gets it's value from the NCI automatically).

 

IF the current value is '1', and the previous value is '0', then because of modality, the string will be output. The string value of 'scoolant' is set by MP, automatically, from the list of string values.

 

So 'scoolant' is being changed constantly, but you should not be changing it manually.

 

You should be manipulating the value of 'coolant$' to control coolant output. Your logic should be checking 'coolant$', and the String Select Function will take care of outputting the correct variable for you, "auto-magically".

 

Here is the structure of a String Select Function:

string1  : "First string value"
string2  : "Second string value"
string3  : "Third...."
s_target string : ""    #Should always be an "empty" string, as MP "fills" it in, from the list above

fstrsel string1 coolant$ s_target 3 -1

In that simple example above, there are only 3 strings in the String List. The 4th string is the "target" string, and gets constantly set to new values.

 

The Selector variable is 'coolant$', and gets it's value from the NCI. Each operation will overwrite the value of 'coolant$', and then the logic in 'psof$', 'ptlchg$', or 'ptlchg0$' checks the value of 'coolant$', to see if it should output a string, or not, based on the current vs. previous value.

 

The Target string (s_target) is the variable you have for an output parameter.

 

If 'coolant$' is 1, then the 's_target' string gets set to the value of 'string1'. If the value is '2', then 'string2' is used. If the value is 3, then 'string3' is used.

 

IF the value is '4', then you get a "buffer overflow, or underflow error". Basically, you chose a number that is "out of the range" of that string select function.

 

You can always modify a String Select table to include more string entries, but you also have to change the "number of string entries" in the 'fstrsel' function definition. (the number following the target string on that line. "3" in our example)

 

So you are on the right track with what you were attempting, but you just needed to know how the String Select function actually works, to be able to write the logic correctly.

 

An interesting thing about the String Select function, is that unless you "force" it (put an asterisk in front of the variable name), then it pays attention to modality. So do the rest of the special characters on the output line.

   pbld, n$, scoolant, e$

In that simple output line, the first parameter is a "post block call" to 'pbld'. This post block looks to "see" if Block Delete is enabled, and if it is, then it would output a '/' character. (note that the '/' character is wrapped in single quotes, meaning it is a "dependent string literal". That is important.)

 

The next parameter is 'n$', which is the output parameter for Sequence Number. This will output if you have sequence numbers turned on, or not, if they are disabled.

 

The third parameter is 'scoolant'. The output is controlled by modality.

 

The fourth parameter is "end of line" or 'e$'.

 

The 1st, 2nd, and 4th parameters are setup in a special way. Each one of them is a "dependent" variable. They will not output unless there is other valid output on the line. Meaning (drum roll please), that if there is no output from 'scoolant' (because of modality), then there will be no other output from that line. This mechanism is in place to avoid MP outputting extra blank lines, or a line with just a slash, or a line with just a sequence number.

 

Because of the way that MP is built to handle the coolant, I highly recommend that you don't just go removing the 'scoolant' output parameters. They are modal. So you can leave them there without risking "redundant" output, so long as you control the coolant output with the numeric variable 'coolant$', which is the correct way.

  • Like 1
Link to comment
Share on other sites

Everyone starts at the beginning, no matter what new skill you are trying to learn. When I started, I knew less than you know right now. So don't be too hard on yourself. I just wanted to post a lengthy reply to try and help anyone else that might be struggling with the same concept. Many of the functions in the MP language are very powerful, but can be so daunting and confusing when you first encounter them. I really enjoy helping to peel back the curtain, and teach people how to write and understand the code that makes the magic happen. The post processor is everything in CAM. Everything. Without a good post processor, the entire chain of trace-ability breaks down. You have people resorting to hand-editing their NC code, with is the anathema of good NC Programming. Making hand-edits to your code is time consuming, and error-prone, not to mention "undocumented". It makes it a nightmare for anyone trying to follow and duplicate your work, and puts the onus on you to be "perfect". I much prefer to make the post processor do all the work, and make Mastercam the single "source" for generating the NC Program. I have yet to see a machine that couldn't be 100% perfectly programmed, using the tools that are available in the MP language. That isn't to say that Mastercam itself is perfect, or that editing post processors is easy. It is not easy, but it is achievable. It can be an absolute nightmare trying to create the perfect post and program, especially when you have to use the Misc. Values (ints and reals) to drive the output. It requires you to have the services of a good post writer, and unfortunately, not all are created equal.

 

I do think it is great that you are taking the steps to learn how to edit posts. That skill alone has done wonders for my career, and I'm sure it will for yours as well, you just need to put in the time and effort to learn the language.

  • Like 1
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...