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:

Post To A File Automatic


Tony35
 Share

Recommended Posts

ok so here is what im trying to do

 

i do a lot of family style parts for our lathe and i want to be able to just post and go and have the NC file named and dropped in the correct folder when i post. i want it to capture the part number im working on and also have it add a P (for okumas) to the beginning of the part number. is this possible in the post?

 

right now i have to post it then do a save as P########

 

using X4

thanks for any ideas :)

Link to comment
Share on other sites

Tony, you may want to search for some info on the VBScript utility. I wanted the same thing you requested some time ago and was directed to a VBScript template that I downloaded from the ftp server. It needed a lot of work to get what I needed and I eventually abandoned it since I'm not trained using the utility and certainly don't have the time to learn it.

Link to comment
Share on other sites

You should be able to rename the NC output - after...

 

From the old Post Reference CD Docs (117 - File Manipulation)

 

Renaming the NC file after posting

When a job is posted from Mastercam, the NC file name is passed as an argument to the post executable and cannot be changed until after posting is complete. You can change the NC output filename after posting completes by using the formula functions in the MP language. It is assumed that either the user or the post has assigned the new file name to the sting variable snewfame.

snewname            # User defined string to hold the new file name
sncfilename         # User defined string to hold the NC program file name

ppost              # This predefined postblock is called after all files are closed at the end of posting
       sncfileame = spathnc + snamenc + sextnc    # path + name + extension
       result = remove(snewname)                  # in case this filename already exists
       result = rename(sncfilename, snewname)     # rename the NC file just created to the name specified in ‘snewname’

The above code snippet first builds the complete NC filename, with the path, file name, and filename extension. Next, the file specified in the string variable snewname is removed from the disk. (This is a precaution. If the file already exists on the disk, you cannot rename another to have that name.) Finally, the NC file is renamed with the new file name.

Link to comment
Share on other sites

ppost is a predefined postblock and must be followed by a $. It can be placed anywhere in your .pst file (although it likely makes sense to place it immediately following peof$)

spathnc, snamenc and sextnc are also predefined (variables) that must be followed by a $...

 

If you wish to have the renamed file open in the editor you will also want to add an additional line to the bottom of the ppost$ postblock:

 

snewname            # User defined string to hold the new file name
sncfilename 		# User defined string to hold the NC program file name

ppost$              # This predefined postblock is called after all files are closed at the end of posting
       sncfileame = spathnc$ + snamenc$ + sextnc$ # path + name + extension
       result = remove(snewname)                  # in case this filename already exists
       result = rename(sncfilename, snewname) 	# rename the NC file just created to the name specified in ‘snewname’
       result = setncstr(2, sncfilename)          # Add to edit list so file will open in editor
                                          		#   2 indicates add, 3 indicates remove from list

 

Obviously the above code is not going to work as is... You need to define snewname appropriately.

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