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:

I'd like to output the line number a tool change will occur in the Tool table


Recommended Posts

I was thinking of updating my posts so that I could write the number of the line a tool change will be called at the beginning of the NC-program

This would involve writing up the line numbers the first time pwrtt$ goes thru the code to collect the Tool data. But , where do I write the n$ collect data lines , pwrtt$ ? Could you point me in the right direction? 

 

In this example below I simulated the N=15

0 BEGIN PGM MAPU MM

1 M129 ; Pullov:1.1

2 PLANE RESET STAY ; TYOTASO OFF

3 *-;T=210 N=15 DIA=10. R1=0. CMNT=   <--------- The line number the tool cal will appear in the code.

4 *-;T=316 DIA=16. R1=0.4 CMNT=

5 *-;T=291 DIA=10. R1=0. CMNT=

6 *-;T=405 DIA=5. CMNT=

7 *-;T=520 DIA=4.7 R1=0. CMNT=

8 *-;T=468 DIA=6.8 CMNT=

;> tool 0 .1 10. 5. 0. 10. 30. 50. 40. 10. 40. 30. 0. 10. 210 10 0 -80.

9 L Z-5. FMAX M91

10 *-Toolpl ORIGO X0. Y0. Z0.

11 * - 10 mm mill

12 L B0 C0 FMAX M70;LASTUKULJETIN ON

13 CYCL DEF 9.0 DWELL TIME

14 CYCL DEF 9.1 TIME 2.0

15 * T210 HALK=10. NURKAN R=0.      <-------- the line on which the tool call appears

16 *TP: Top WCS= Top

17 TOOL CALL 210 Z S3850

18 M3 M22; B-LOCK

19*-PROFILE#1. STK=0. DPTH=-2. Rmp=.3

........

 

 

Gracjan

Link to comment
Share on other sites

Hi Gracjan,

This isn't possible inside 'pwrtt$'. During the "pre-read" routine, MP intentionally skips all of the "motion" NCI Lines. This is done to speed up the processing of large files. As a consequence of this, MP doesn't have any idea how many N blocks have been written.

You would have to attempt this in 'ppost$', after the NC File has been written. You would have to initialize a String buffer, filled with your newly written NC file, and use a While loop to read each NC line, keep track of the N block number, and continue searching until you find a line with "M06" in it. (Use the 'strstr' function.)

Once you've gathered the N Blocks that correspond to each Tool Change, you could then read through the Tool List at the File Start, and insert the N block into the String, before writing it back to the NC File (held in a 2nd, separate String Buffer).

You may want to have your Post Processor output a (Tool List Start) comment, and a (Tool List End) after the Tool Table, to make the logic easier to handle a Tool Table of indeterminate size.

So, this is technically possible, but it would be quite a challenge.

Have you considered modifying your Post to only output N Blocks at the Tool Change event, and just skipping N Blocks on the Motion code? That is what I usually do, and I setup the Post to make the N block number match the Operation Number in Mastercam.

  • Like 1
Link to comment
Share on other sites

Thanx Colin  ,  although it would be tempting to do this stuff,  I also have some other easier options to get what I want. The reason why I thought about this is because the customer

likes to change his entry speed for dynamic 3d milling and the speed needs to be changed in Heidenhain thru a TOOL CALL line.  So you might end up with three "real" tool changes

and 40 speed changes . I'll just post out a string as a comment with the real tool changes for now , they can be then quickly access by using the Find a sring function.

 

Gracjan

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