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:

Variable Help Needed


Civic Dude
 Share

Recommended Posts

Hey all,

 

The shop I am working for uses a macro to obtain and store tool length values in all of their CNC mills.

 

The question I have is related to "getting a number" through the post for the following output.

 

Below is our standard posted code . . .

 

N1

T1

M06 ( 1/4" CARB BALL MILL)

(MAX - Z1.)

(MIN - Z-.6213)

(TOOLPATH - HMM)

(STOCK LEFT ON WALLS = 0.)

(STOCK LEFT ON FLOORS = -.01)

/ M13 N

 

What I would like to achieve is to have the post pick up the number of the tool and place it right after the M13. In other words it should read

 

/ M13 N1 (For tool #1)

 

I am no post guru and have tried a few things but have not had any success.

 

Obviously this is not a huge deal as the posts work perfect in all other ways.

 

I would just prefer not to have to hand edit the files after posting.

 

Also the way the macro works, the N1 text will assign the height offset in the H1 offset register.

 

If anyone has any ideas it would be much appreciated,

Thanks in advance,

Bob

Link to comment
Share on other sites

Hi Bob,

 

This should be fairly easy to accomplish. The pre-defined variable in the post is "t$" for the tool number. Obviously the tool number is formatted to output a "T" and the tool number, and you want "N" and the tool number.

 

You can use the 'nwadrs' command to assign a new prefix string to the t$ variable, and then switch it back...

 

Look for the "M13" output in your code, I'm guessing the post line will look something like this:

 

n$, "/M13", e$

 

or something like that...

 

Here is what you need to add:

 

code:

add this above the post line that outputs your M13 code

 

result = nwadrs(strn, t$)

n$, "/M13", *t$, e$

result = nwadrs(strt, t$)

 

 

 

 

Now you also need to find the String selector table and add an entry. Here is the default:

# --------------------------------------------------------------------------

#String and string selector definitions for NC output

# --------------------------------------------------------------------------

#Address string definitions

stri "I"

strj "J"

strk "K"

strm "M"

strn "N"

stro "O"

strp "P"

srad "R"

srminus "R-"

strz "Z"

sblank

 

 

You need to add an entry for "T", so after the 'srminus' line, add this

 

strt "T"

 

So your new list should look like this:

# --------------------------------------------------------------------------

#String and string selector definitions for NC output

# --------------------------------------------------------------------------

#Address string definitions

stri "I"

strj "J"

strk "K"

strm "M"

strn "N"

stro "O"

strp "P"

srad "R"

srminus "R-"

strt "T"

strz "Z"

sblank

That will take the t$ variable, change the prefix to "N" output the tool number in your NC code, then switch the prefix back to "T" for that variable.

 

HTH,

Link to comment
Share on other sites

Add this to "ptlchg_com" postblock after "pstock"

 

 

code:

       preadbuf5

if (opcode$ > 0 & opcode$ < 16) | opcode$ = 19,

[

n$, pspc, scomm_str, "MAX - ", *max_depth, scomm_end, e$

n$, pspc, scomm_str, "MIN - ", *min_depth, scomm_end, e$

]

]

spaces$=sav_spc

pstock

result = nwadrs(strn, t$) <------------------------------Here

pfbld, "M13", *t$, e$

result = nwadrs(strt, t$) <---------------------------to Here

if plane$ < 0 | opcode$ = 3 | opcode$ = 16, plane$ = 0

sav_absinc = absinc$

if wcstype > one, absinc$ = zero

pindex

HTH

Link to comment
Share on other sites

Thanks Colin,

I tried your solution and it works like a champ!

 

Now here come's the next question. I also use the older sub_rep post occasionally and would like to make the same changes to that one.

 

I believe this is a Version 7 post but could be mistaken. It is the same sub rep post that has been on this site for a long time.

 

Thanks to all for the suggestions,

Bob

Link to comment
Share on other sites

Hey Colin,

I am running X3 MU1 and have updated it. I will take a look at the post when I get some time but it seems that it doesnt have as many variables as the MPMaster post.

 

Anyway thanks for the fix and I will try it out on the sub rep deal.

 

I see you're in Everett, I lived in Vancouver for 14 years and worked in Oregon. Had a 03' Evo VIII for 4 years too! AWD and turbo makes for a great NW driver.

 

Thanks again for all the help,

Bob

Murfreesboro TN!

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