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:

T, H, and D code Agreement


Recommended Posts

4 hours ago, Colin Gilchrist said:

If tlngno$ <> t$ | tloffno$ <> t$, result =mprint ("your warning here")

Thanks for the fast reply Colin.

The warning works, but it comes on every time,  even if the T,H and D are matched.

I am placing it in the Manual Entry Section... is there a certain position it should be located?

Link to comment
Share on other sites

Inside your Post, I would put that line (indented at least 6 spaces from the left column), in:

psof$

ptlchg$

and

ptlchg0$

That is the 'start of file', 'tool change', and 'null tool change' post blocks.

That should only warn you if the (Tool Length Number, does not match, the Tool Number), OR, (if the Tool Diameter Offset Number, does not match, the Tool Number).

 

------------------

 

What is your end goal here? Are you just trying to catch Offsets that are entered incorrectly inside the Mastercam interface?

Is this a situation, where 100% of the time, you always want your T# to match the D# and H#?

The reason I ask is that I recommend (for those users) to just set a Global Formula in the top of the Post, and never worry about it again:

tlngno$ = t$

tloffno$ = t$

If you add those 2 Global Formulas (starting in the 1st column of the Post, on the left side), then it will force MP to always make the T/D/H numbers match each other.

  • Like 1
Link to comment
Share on other sites

That was it... nailed it... thanks Colin!

Yes... that's exactly what I'm trying to do.

Either way seems like a good solution, so I'm going to mark this post and see which way the other programmers want to go.

Thanks again!

  • Like 1
Link to comment
Share on other sites
  • 3 weeks later...
13 hours ago, Mick said:

Why at least six spaces in Colin? I'm curious.

Six spaces is simply the default indentation of the generic Posts created by CNC Software. The six spaces indent is to make sure the post developer realizes that the code being written is part of a 'Post Block', and is not "the definition of something".

MP is a column dependent language. If a variable name, or Post Block name, starts in the 1st column, then we are "defining something"; a Variable, Post Block, or Global Formula. So the six spaces serves as a "divider" to separate "the start of a new block", from "the code inside the block".

Technically, only a single space is needed 'in front' of the Post Line, but the six spaces helps you to visually 'see' if the code is inside a block or not. All 'Post Blocks' would start with 'p' (or 'l', 'p', or 'm', for a mill-turn post), in the 1st column.

pdosomething     #start a new block

      mytool = t$   #line of code inside a block

      n$, sgcode, xout, yout, zout, sgfeed, e$ #more code and/or logic

psof$  #start of file (new block start, since it is defined in column)

 

  • Like 4
Link to comment
Share on other sites
9 hours ago, Colin Gilchrist said:

Six spaces is simply the default indentation of the generic Posts created by CNC Software. The six spaces indent is to make sure the post developer realizes that the code being written is part of a 'Post Block', and is not "the definition of something".

MP is a column dependent language. If a variable name, or Post Block name, starts in the 1st column, then we are "defining something"; a Variable, Post Block, or Global Formula. So the six spaces serves as a "divider" to separate "the start of a new block", from "the code inside the block".

Technically, only a single space is needed 'in front' of the Post Line, but the six spaces helps you to visually 'see' if the code is inside a block or not. All 'Post Blocks' would start with 'p' (or 'l', 'p', or 'm', for a mill-turn post), in the 1st column.

pdosomething     #start a new block

      mytool = t$   #line of code inside a block

      n$, sgcode, xout, yout, zout, sgfeed, e$ #more code and/or logic

psof$  #start of file (new block start, since it is defined in column)

 

Thanks for the clarification Colin. That makes sense.

  • Like 2
Link to comment
Share on other sites
10 hours ago, newbeeee said:

I was thinking that the 6 spaces were so if you ever paper printed a copy of your post and hole punched it, the text wouldn't be eaten by the hole punch :lol:

Lol, the spaces do help with visualization of the "post block body" code. Technically, when you print from your Text Editor, there will always be a "Left Margin", which is typically .75 or 1.0 inches. This is where the holes punches would go.

You have to remember Newbeeee, that the Post Block Name does not get indented. It must start in the 1st column. Anything starting in Column 1 is a "definition".

When you see that name, in any place other than the 1st column, it is a "Post Block Call". This means we are making a "jump" to that block of code, and executing all of the post block body code, before returning to the original location of the call.

If you have several 'Post Block Calls' on an output line, then there are many "jump-execute-and-return" sequences being carried out. These calls can nest up to 25 levels deep.

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