Community
Hi,I'm a newbie.....
there is a way (vb.net or vba) to read a .iam file and save the complete list of the .ipt files in a .txt file.
Please,please, if possible attach a sample 🙂
Thank you
Rodolfo
Solved! Go to Solution.
Solved by jdkriek. Go to Solution.
Glad you found something, thought I would post my script anyway incase someone else needed it
' JDK 2013 ' If this is Assy Doc If ThisDoc.Document.DocumentType = 12291 Then ' Define txt doc name Dim sPath As String = "C:\test.txt" Dim oAssDoc As AssemblyDocument = ThisApplication.ActiveDocument Dim oAssDef As AssemblyComponentDefinition = oAssDoc.ComponentDefinition Dim oOccurrence As ComponentOccurrence Dim i As Integer ' If txt doc exists If System.IO.File.Exists(sPath) = True Then ' Open stream to txt doc Dim objWriter As New System.IO.StreamWriter(sPath) ' Look at each occurrence in Assy For Each oOccurrence In oAssDef.Occurrences 'If it's a part file If TypeOf oOccurrence.Definition Is PartComponentDefinition Then i = i + 1 sName = Split(oOccurrence.Name, ":") ' Write occurrence name to txt doc objWriter.Write("Part " & i & ": " & sName(0) & vbNewLine) End If Next ' Close txt doc objWriter.Close() MsgBox("List Written to File") Else MsgBox("File Does Not Exist") End If End If