Message 1 of 13
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Trying to have ilogic find parts in an assembly that start with 900C7 so I can link the to a cell in excel showing the QTY and the LENGTH..
Right now I am just trying to get ilogic to find and list them then I know I can move to the next step..
Example:
900C71.250
900C72.125
900C7A.750
900C7P1.1875
And many more.
Here is what I have but it keeps posting the NOTHING message box. I have a few of the parts in the assembly and a few none 900C7 parts.
Dim openDoc As Inventor.Document Dim docFile As Inventor.Document Dim assemblyDoc As AssemblyDocument Dim partOcc As ComponentOccurrence Dim FNamePos As Long Dim docFName As String Dim oList As Collection = New Collection openDoc = ThisApplication.ActiveDocument If openDoc.DocumentType = kAssemblyDocumentObject Then assemblyDoc = openDoc assemblyDef = assemblyDoc.ComponentDefinition Else MessageBox.Show("You must have a valid Assembly document open before using this code!", "File Type Mismatch!",MessageBoxButtons.OK,MessageBoxIcon.Exclamation) End If For Each docFile In openDoc.AllReferencedDocuments If (Left ( docFName, 6) = "900C7P") Then oList.Add(docFName) End If Next If oList.Count = 0 Then MessageBox.Show("NOTHING") Else 'print oList Dim sTotal As String = "Found: " & oList.Count For Each st As String In oList sTotal += vbNewLine & st Next MsgBox(sTotal) End If
Here is a screen shot of the excel file not sure if you need it but you may get a better idea what I am trying.
Thanks for any help..
Solved! Go to Solution.