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:

use variables in any generic post


jlw™
 Share

Recommended Posts

Let's say I have a semi-generic post my reseller gave me.  Is there any way to make it output a variable like if I want this:

 

use_var.png

 

I like doing this so that tap depth can be adjusted easily.  Any way to make post output it?  If you even try in the linking parameters you get this little gem:

 

use_var2.png

  • Like 1
Link to comment
Share on other sites

The post can output variables for ex...

        pbld, n$, 035, "500", 061, *mr1$, scomm_str, "STOCK DIA", scomm_end, e$
        pbld, n$, 035, "501", 061, *mr2$, scomm_str, "LENGTH", scomm_end, e$
        pbld, n$, 035, "502", 061, *mr3$, scomm_str, "CLEARANCE", scomm_end, e$
        pbld, n$, "G10P0Z-", 091, 035, "501", 043, 035, "502", 093, e$

 but I don't think you'll be able to enter the variable in MasterCam like that.

  • Like 1
Link to comment
Share on other sites

You could, in theory, create a little logic postblock something along the lines of,

 

if depth$ = 501, then... 

 

and have it add a new prefix. Or modify a custom drilling cycle to do that. However, it wouldn't verify correctly at all.

 

What I do for my macros is have a separate postblock set up, and turn it on or off using a misc. int. So if I have a threadmill, I set it up like normal in mastercam, and set "Use Threadmill Macro" to one in my misc numbers. This forces the output through the postblock which then strips and reformats everything the way I want it to. That way, my program verifies like normal inside mastercam yet I get the output I want in the NC.

Link to comment
Share on other sites

One way I could think of that wouldn't be that hard would be to cheat.. make a switch in the post to look for -501.00  assuming your not running metric..

You are unlikely to ever have an actual -501 value to worry about unless

   A. your machines are a hell of a lot bigger than what I'm used to seeing, or

   B. you have some completely bizarre method for zeroes with them way off in outer space.

 

If either of those cases are likely then this would be a bad idea, otherwise, you could just make the post include logic in the proper place to look for -501 and if it exists place a #501 in the code..

 

There are a number of ways you could accomplish this, personally I think making the logic look for  if Z < 500 then make your ouotput be # abs(original Z value)  whcich would allow you to use any macro variable over 500..

 

If you were using metric and 500 could come up you could always go with a larger number like 100501 then just subtract the 100000 from it in the post..

 

Either way .. seems like it could be done without too much trouble, but you will have to be willing to fudge it a bit.. don't think you will get away with the # in the actual fields no matter what..

Link to comment
Share on other sites

That data entry field only accepts numeric values. What I do is setup a Misc Integer to control the switching to "Macro Variable output", and then use the Misc Real Numbers to indicate the Variable Number I want to use.

 

So say you enter -1.25 in the "incremental Depth" field. I would link that to "Misc Real #1". Then put "501" in MR1. In the post logic, I set it up to output #501=-1.25 just after the Tool Change. And then later in the operation, I force use the "nwadrs", and "nwprfx" functions to make the Z values output the variable number.

 

It is also possible to do it in reverse, and enter the 500, 501, 502 in the depth fields, but then you don't get backplot as others have mentioned.

 

I also do this with Feed Rate, Plunge Rate, Retract Rate, and so on...

  • Like 1
Link to comment
Share on other sites

And.. yeah now that I read Cathedrals post.. verify would indeed be totally screwed up..

 

I was thinking originally that you could make a misc int to flag it to put in a variable in the code.. but then it gets weird if you want to use variables in multiple places.. say clearance and depth for example..

Link to comment
Share on other sites

And.. yeah now that I read Cathedrals post.. verify would indeed be totally screwed up..

 

I was thinking originally that you could make a misc int to flag it to put in a variable in the code.. but then it gets weird if you want to use variables in multiple places.. say clearance and depth for example..

 

Just use the original variable names, and use the "new address" and "new prefix" functions to swap the string values. (and assign the value like "depth = mr1$"). Easy peasy.

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