05-30-2018
12:58 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
05-30-2018
12:58 AM
How to read all component if we use apprentice.
We can read all document if we use AllReferencedDocuments. But I don't see option for replace component in this mode. But we can replace component if use ReferencedDocumentDescriptors. But in this mode just read all component in level 1.
Please tell me how to read all component in referenced document or how to replace component in All Referenced Document.
Here's my code.
Sub ReplaceComponent()
' Create an instance of Apprentice.
Dim apprentice As New Inventor.ApprenticeServerComponent
' Open a document.
Dim doc As Inventor.ApprenticeServerDocument
doc = apprentice.Open(FilePath)
'Me-Replace component
For Each docDes As Inventor.DocumentDescriptor In doc.ReferencedDocumentDescriptors
Console.WriteLine(docDes.ReferencedFileDescriptor.FullFileName)
'If docDes.ReferencedFileDescriptor.FullFileName = OldName Then
' Console.WriteLine("-->" & NewName)
' 'docDes.ReferencedFileDescriptor.ReplaceReference(newPartFile)
' 'fileSave.AddFileToSave(NewDoc, NewDoc.FullFileName)
' 'fileSave.ExecuteSave()
' 'Return
'End If
Next
End Sub
Solved! Go to Solution.