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 variable operators


Recommended Posts

Hi,

 

I'm hardly at master at post editing and i am looking for some help with the variable operators.

 

Using * (astericks) with a variable is to output the variable but what are some of the others.

 

I was using variables of my own creation to store varialble values temporarily whilst i switched them until i reallised that ! (exclaimation) does thesame thing, kind of.

 

ie:

 

!spaces$

spaces$=zero

pbld, n$, "output without spaces", e$

spaces$=prv_spaces$

 

Does this work for non 'named' variables such as any variable I might create for my own needs? I have seen other operators such as ' (apostrophy) but I don't know what it does or if there are others.... can anybody tell me?

 

Thanks

Link to comment
Share on other sites

Here's a quick explanation, consider the two following lines of code where we display our variable "MyVar"

 

pbld, n$, MyVar, e$ (MyVar is displayed)

pbld, n$, MyVar, e$ (MyVar is not displayed)

MyVar = MyVar + 2 (MyVar changes)

pbld, n$, MyVar, e$ (MyVar is displayed)

 

In the first line, MyVar will be displayed in the NC file since this is the first time we have called it since the last time it has changed. In the second line, MyVar will not display since it has not changed.

 

pbld, n$, !MyVar, e$ (MyVar is not displayed)

pbld, n$, MyVar, e$ (MyVar is not displayed)

MyVar = MyVar + 2 (MyVar changes)

pbld, n$, MyVar, e$ (MyVar is displayed)

 

Using the "!" symbol tricks the post into thinking that MyVar was already displayed and because of this, MyVar will not be displayed in the lines afterwards until its value changes.

 

pbld, n$, `MyVar, x, y, z, e$

 

In this line, MyVar will only be displayed if it is not alone. In other words, if either "x", "y" or "z" is displayed on that line, MyVar will display also. Please note that pbld and n$ already behave like this, that is why we don't get empty lines with sequence numbers all over the post.

 

pbld, n$, ~MyVar, e$ (displayed)

pbld, n$, MyVar, e$ (displayed)

pbld, n$, MyVar, e$ (MyVar is not displayed)

MyVar = MyVar + 2 (MyVar changes)

pbld, n$, MyVar, e$ (MyVar is displayed)

 

In this case, the "~" symbol forces the output of MyVar but it does not affect the output of the next line. This is useful for debugging.

 

 

The is also a "@" symbol that you can use to get the rounded value of MyVar but I don't really use that one personally.

 

I hope it helps.

Link to comment
Share on other sites

one thing that is crucial to understanding out data is output from a post is MODALITY. Do a serch for modality or PRV_ as I remember writing up a lengthy response on this subject at one time. I will see if IO can find it.

 

but in simple terms MP needs to determine when and what to output to the NC file so there are logical operators that give the post writer extra control when necessary.

 

When variables are modal, their current value is checked with their previously output value stored in PRV_VarName. Every single variable, even user created all get PRV_ variables automatically.

 

So when a variable is modal and the current value is the same that was previously output (PRV_) then it will NOT be output to the NC file.

 

You can use a variable for many things and not just output so you also need operators to control what to do with that variable.

 

When a variable is found on an output line it is output based on modality.

 

Below is how MP handles the variables and their operators

 

Regular output

My_Var, e$ - (solve global formula if any, round/format according to FS, output the value in My_Var to NC depending on modality and update previous (PRV_My_Var)).

 

Forced Output

*My_Var, e$ (Sames as above except it will ignore modality and force output to NC file)

 

Force conditional output

'My_Var, e$ - (first two are same, forces output but only if thee is some other output from same postline, or postline called from, updates PRV variable only if actual output occurs)

 

Forced Update

!My_Var, e$ (First two are the same, NO output to NC file occours, updates PRV with current value) Necessary when My_var is being used to store a value and needs to be kept in sync with the output code.

 

Forced Format

@My_Var, e$ (First two are the same, no output to NC file, DOES NOT update previous) this is handy when you want to compare a formated values in this case @My_Var = prv_My_Var.

 

Forced Debugging

~My_Var, e$ (DOES NOT solve global formula, DOES NOT round/format, otuputs to NC file regardless of modality, DOES NOT update PRV_

 

The above has been around for many moons so even the older post guides and docs will show this data.

 

Hope this helps.

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