Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
Anonymous
in reply to: Anonymous

I tried a bit, but, why isn't he finding the document?

 

Error in rule: Rule4, in document: Assembly1.iam

iProperties:The document named "U:\temp\PTN_Part_Library\PIPE\PIPE_200011.ipt" was not found.

 

GetInput :

Six_Digit = InputBox("Enter 6 Digit number", "iLogic", 000000)

If Six_Digit = "" Then
	Return
Else If Len(Six_Digit) <> "6" Then
MessageBox.Show("Input must be 6 digits", "ilogic")
GoTo GetInput

End If


Dim oDoc As Document
Dim sFilename As String

'hard code path
oLibrary_Folder = "U:\temp\PTN_Part_Library\"


Dim oFilenames() As String
oFilenames = System.IO.Directory.GetFiles(oLibrary_Folder, _
"*.*", SearchOption.AllDirectories)

For Each oFilename As String In oFilenames
	If oFilename.Contains(Six_Digit) Then
		Dim oOptions As Inventor.NameValueMap
		oOptions = ThisApplication.TransientObjects.CreateNameValueMap
		oDoc = ThisApplication.Documents.OpenWithOptions(oFilename, oOptions, False)
		sFilename = oFilename
		Exit For
	End If
Next

If sFilename = "" Then
	MessageBox.Show("No matching libary file found.", "iLogic")
	Return
End If

iCounter = 0

'trying to get the original partnumber
oOriginal_Partnumber = iProperties.Value(sFilename, "Project", "PartNumber") MessageBox.Show(oOriginal_Partnumber)