That makes sense now, thanks again for your help.
One last question...I think...
I have been playing around with it and it seems to work fine except for when a part has already been loaded, or is open in another window. Sometimes I have multiple assemblies open at once and it would derail...
I think you are right. At least it's not working as intended...it's not actually working at all since it's throwing me errors on searching.
I have managed to get it to work the way I wanted to though:
Dim prefix as String = Nothing
prefix = Left(answer, 3)
Dim files() As String
If...
Perfect!!
Once I figured out that I had files returning the full directory path and the part name...
So this:
basePart1 = theSession.Parts.OpenBase(DirectoryPath & files(0), partLoadStatus1)
Became this:
basePart1 = theSession.Parts.OpenBase(files(0), partLoadStatus1)
My next step is going...
Awesome. The user will be inputting at a minimum a portion of the file name.
However what I couldn't get past over the weekend was that files is an array and NX then throws an error when I put files into the add part line of code.
The error being that the function is undefined for the type...
It seems I am stuck again and get past this.
I am using the line
Dim partNumber() As String = Array.FindAll(files, Function(s) s.Contains(answer))
After the search if statement to find the match, however I am left with the error of converting an Array to a String. So I tried to match the...
Thanks Cowski!
although now it's giving me an erro about the file name. I presume I need to do modify the answer string with search results, but I don't know what the GetFiles returned. I am guessing its returning files as a string and then I need to change answer to the value of files? How...
I removed the company name from the file path, but this is ithttp://files.engineering.com/getfile.aspx?folder=7931ff7a-3486-4313-bc7c-cad8d2f29b97&file=addpartandsearch.vb
Ok that makes sense now. Thanks for helping me out again.
I am now getting some errors when I try to declare DirectoryPath as a string = network location.
The error I'm given is "Value of type 'String" cannot be converted to a '1-dimensional array of String'
I still need to have the function GetFiles though right?
and where you have directoryPath that should be the file path written out?
I feel like I am in way over my head here from a programming standpiont...
Ok so trying to remember how to use/call a function. I want to add something like below?
...
Imports System.IO
...
Public Shared Function GetFiles (
path As String,
searchPattern As String
) As String()
...
answer = answer & GetFiles("directory path", answer & "*")
...
That worked perfectly, once I added the else condition of appending the .prt I ran it several times and I don't seem to be getting any errors anymore.
The "other stuff" is important, but how would I go about checking for it? And honestly I would rather the user not have to worry about it, and...
The whole file name goes like atb12345.xx.xxxx.prt where the other characters denote stuff like Revision and what not.
So my first thought was to add the extension, but it will not always be the same.
would I check the answer variable, by doing something like:
If answer = "atb12345"
Then...
Hi I am looking for some help with a journal file that I recorded and modified slightly.
The point of the journal was to enter a part number, in this case atb12345, and then NX would add the file. We are using 9 in Native mode and our part files are organized on the system through various...