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:

CHANGE PROGRAM # from VB Script, is it possible?


Recommended Posts

Hello all,

 

I am trying to find a way to change the program# from a VB script,  looked thru all VB commands available but I see no chance to do so.

I am wondering if this is something that needs to be done thru a Chook or Nethook only.

As always, any advise is greatly appreciated.

By the way, I am running MC2017

Link to comment
Share on other sites
  • 5 weeks later...
On 11/12/2018 at 11:53 AM, Roger Martin from CNC Software said:

This is not available in the VB-Script

The ability to set the Program Number was just recently added to the NET-Hook API for the upcoming Mastercam 2020.

Meaning, the only way to do this now, is with a C-=Hook Add-In.

Hey Roger, is there another way to change the program# for MC2017 or MC2019 other than manually?

Link to comment
Share on other sites

Cartman007,

I am assuming that you do mean the program number that is inside the file, and not the file name itself.

There are some "work around" ways to do what you want, but be aware!

1.  You could use VBSCRIPT to change the .nci name and have the .pst file reference the nci name as the program number. Then use VBSCRIPT to change the name of the nc file to what it should be, if not the same as the program number.

2.  Find a MISC INT that I not used in any way by any of your machine definition files. Set you .PST file to use that MISC INT as the program number.  VBSCRIPT can then set the MISC INT.

3. There are also some ways to use comments, and group names as your input, but it gets a little more complicated.

 

Because these are "work around" and not directly supported functions, please be careful.

 

Please let us know how you make out.

Regards,

Steven

  • Like 1
Link to comment
Share on other sites

CARTMAN007,

I left out the most straight forward method of using VBSCRIPT to modify the program number.

First, Open an temp file that will become your updated nc file.

Open the original file for reading, read  a line, check for program number, and write the data to the temp file.

As you get to the block with the program number in it, change the number to the desired number and write to temp file.

Read remaining data and write to temp file, and then close both files.  Since program numbers are typically near the top, it should not take long.

Delete the original file, and rename the temp file as the original.

Steven

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