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:

How to limit number line output or file size in NC file


Recommended Posts

IMHO the post would not be the best way to limit file size. It could be done, but the effort likely not worth it. A solution exists out of the box the Cimco DNC MAX product will split up file into pieces the control can handle in memory. The advantage here is that you specify what to do when the chunk of code is finished; and the next begins.

 

Link to comment
Share on other sites
On 3/9/2024 at 11:06 AM, lim-mazak said:

Hi there, how can the post modified to limit the number of line or file size output in NC file? e.g. 100 lines, 1000 lines, 500kb, 1MB, etc.

TIA....


Greetings @lim-mazak

What you can do is limit how many lines you want in your output file.

To do that please first do backup of your post file.

Now create new buffer where you will store your output information's and set variables ( the ones below its just an example from my post file)

#---------------------------File manipulation buffer------------------------------------------------------
#Buffer 6,
wc6           : 1      
rc6           : 1       
size6         : 0       

file_size      : ""
sbufname6$    : ""
fbuf 6 0 255 1 1        
#----------------------------------------------------------------------------------------------------------

#----------------------------------------------------------------------------------------------------------
output              : 0                    # Variable is used for string comparisons
return              : 0                    # Variable is used for closing open files
sauxfile            : ""                   # For using aux file to store new NC file during ppost$ processing
sncfile             : ""                   # Stores path of NC file
s_output            : ""      # Path of the DOC output file (optional)


Create new postblock  " ppost$"

In the varable size6 you will limit the lines amount which you want to be outputted

Keep in mind we are getting total 300 lines in this example, which includes  things from pheader$  and other things before the actual code

ppost$
      sncfile = spathnc$ + snamenc$ + sextnc$
      sauxfile = spathnc$ + snamenc$ + sextaux$
      sbufname6$ = spathnc$ + snamenc$ + sextnc$

      spathaux$ = spathnc$
      snameaux$ = snamenc$
      s_output = spathnc$ + snamenc$  + sextnc$

      auxprg$ = 1
      newaux$
      subout$ = 2


      size6 = 300                              
      rc6 = 1                                    
      while rc6 <= size6,
        [
        file_size = rbuf(6, rc6)                   
        *file_size , e$                             
        ]
      
      subprg$ = 2
      newsub$
      mergesub$, e$

      return = fclose(sauxfile)        
      return = remove(sncfile)
      return = rename(sauxfile, sncfile)
      #return = remove (sbufname6$)
      clearsub$
      clearlcc$ 


Once again before doing any changes do backup.

Kind regards

Ivan. 

  • Like 1
Link to comment
Share on other sites

You can use the "Section NCI" C-hook, to break up a Toolpath Operation, and split it into multiple chunks of toolpath code, each with proper approach/retract motion, so you can run the files in sequence on a machine with small memory. After you run "Section NCI" to split a toolpath into multiple files, you must use "Import NCI" to import and stack up the operations. You can then use the NC File naming attributes to append "incrementing numbers" at the end of the file. "File-1", "File-2", "File-3", etc.

Having the "approach/retract" moves inside the NCI Data, is better than asking your Post to add all the necessary approach/retract data, and include the "Tool Change" and "Retract at end-of-file" data.

This solution has existed inside Mastercam since I started using the software with Version 6.1.3, back in 96'-97'.

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