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:

Script that re-names nci file names (issue)


Recommended Posts

Good morning...

 

I recieved a script from another member (on the Industrial Forum) that re-names the nci files to the Group names.

 

It works great, but I am having one issue with it, that seems "file specific" or more correctly "Mill Machine Group" specific.

 

Attached is an MCX6 file, and the script...

 

 

 

When I run the script on the attached file, all the nci file names have added onto them "nci" at the beginning of the nci file name.

 

When the script runs on say the group that is named "T09_A", the nci file name will read "nciT09_A.nci"...

 

 

I have gone and created a new Mill Machine Group, in this same MCX6 file, placed the Groups and operations under this newly created Mill Machine Group, and then run the script, and after doing that, the nci file names come out correctly (The ops under the group named "T09_A" have the nci file name of "T09_A.nci".

 

And, if I create a new mastercam file, create a group, and some operations within the group, and then run the script, in this case the nci file name also comes out correctly, without the added "nci" at the beginning of the nci file name...

 

 

It would not be such a big problem, except that I have multiple hundreds, if not thousands of Mastercam files from over the past 10 years that I want to be able to run this script on...

 

 

It seems to be specific to the Mill Machine Group that exists in the files already, but I have been un-able to determine why the added "nci" prefix is being.

 

 

Any help would be appreciated...

 

Thank you...

TREWTRETREWTREWER.MCX-6

RenameNciByGroup.zip

Link to comment
Share on other sites

So after you've run this VBS script on your sample part...

If you go to post the operations in the "T09_A" machine group the NCI (and thus NC) file that is created is "nciT09_A.nci" ???

I just tried this and I'm not seeing that behavior.

If I look that the NC name in under the "toolpath" branch each operation in that group, everyone is -> T09_A.NC

Does the "Mission Complete" list show the correct name, or?

post-1117-0-97648700-1372192728_thumb.jpg

Link to comment
Share on other sites

You know, that does not surprize me...

 

I always seem to have some weird thing going on on my system that others can't replicate...

 

I just tried to make a video clip of me doing all the steps, and showing how it comes out on my computer, but, too big...

 

I am going to try on another computer here...

Link to comment
Share on other sites

Let me ask an idiotic question...

 

If I can't make this function correctly on my system, could the script be modified to "fix" the issue, by searching out "nci" at the beginning of the nci file name, and then deleting it, even if it would have to run it, and then re-parse everything to run "again" to remove the NCI prefix?

 

Sounds stupid, I know, but this script is something I had years ago in V9 (or something very similar) and it saved me SO much work and errors in setting the NCI name, that I would deal with a "stupid" solution, if it will give me the result I would want to see....

 

 

 

I know the thing to do is to figure out why it is doing this, and fix THAT, but those pesky customers really get in the way of me having any fun at my job, so I have to please them first...which leaves very little extra time to do the cool stuff.....

 

 

Thanks for your help...

Link to comment
Share on other sites

Dude .... not sure whats going on here. That is one crazy file. Dozens of empty, nonsense-named ToolPath groups ... and whats the 'Electrode' reference ? (see attached Pic)

 

After opening the file, I saw that all the toolpaths seemed to be already named correctly. I selected a post and posted all files, and they seemed to post correctly, NCI files included. Looks like the file does what you want, already.

 

I went and renamed ALL operations in the file to a single name "ABCDEFG.nc", then ran the script. SOME of the operations were renamed correctly per the script, some remained untouched (still referencing ABCDEFG.nc)

 

Looks like the script doesnt perform as advertised on MY box, but Im not getting any of the renaming issues you are having, either

post-39678-0-84994200-1372196895_thumb.png

Link to comment
Share on other sites

Check to see if the name we're about to apply starts with "nci" and if so remove the unwanted "nci" prefix ->

 

' Added (start) ->

' Make sure that there is no leading or trailing spaces on the "name"

NewNciName = Trim(NewNciName)

' Debug - TESTING ONLY - Make it have the unwanted "nci", so we know that we're actually removing it.

NewNciName = "nci" & NewNciName

Dim nciPos

' Search for "nci" on the start of the name

nciPos = InStr(1, NewNciName, "nci")

If nciPos = 1 Then ' This name starts with "nci"

WriteString(vbNewLine & "Old -> [" & NewNciName & "]") ' Debug

' Strip off the leading "nci"

NewNciName = Mid(NewNciName, 4)

WriteString(vbNewLine & "New -> [" & NewNciName & "]") ' Debug

End If

 

DebugMsg = GetPathFromExtension("NCI") & NewNciName & ".NCI" ' Debug

WriteString(vbNewLine & "[" & Index & "]:" & " SetNciNameFromOperationID-> " & "[" & DebugMsg & "]") ' Debug

' <- Added (end)

 

' Original code ->

Call SetNciNameFromOperationID(Index, GetPathFromExtension("NCI") & NewNciName & ".NCI")

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