With this rule you can choose between parts and assemblies, by default open the directory of the document you have open, and rename all the files you select, because you have activated the multiple selection
Dim oFileDlg As Inventor.FileDialog = Nothing
InventorVb.Application.CreateFileDialog(oFileDlg)
oFileDlg.Filter = "Inventor Files (*.iam;*.ipt)|*.iam;*.ipt"
oFileDlg.DialogTitle = "Change Part or Assembly"
oFileDlg.InitialDirectory = ThisDoc.Path
oFileDlg.MultiSelectEnabled =True
oFileDlg.FilterIndex = 1
oFileDlg.CancelError = True
On Error Resume Next
oFileDlg.ShowOpen()
If Err.Number <> 0 Then
MessageBox.Show("File not chosen.", "Dialog Cancellation")
ElseIf oFileDlg.FileName <> "" Then
Dim Separators() As Char = {"|"}
Sentence = oFileDlg.FileName
Words = Sentence.Split(Separators)
For Each wrd In Words
Dim odoc As Document
odoc = ThisApplication.Documents.Open(wrd, False)
On Error Resume Next
Dim oPlaneYZ As WorkPlane = odoc.ComponentDefinition.WorkPlanes.Item(1)
oPlaneYZ.Name = "YZ Plane (Right)"
Dim oPlaneXZ As WorkPlane = odoc.ComponentDefinition.WorkPlanes.Item(2)
oPlaneXZ.Name = "XZ Plane (TOP)"
Dim oPlaneXY As WorkPlane = odoc.ComponentDefinition.WorkPlanes.Item(3)
oPlaneXY.Name ="XY Plane (Right)"
odoc.Save
odoc.Close
Next
Please accept as solution and give likes if applicable.
I am attaching my Upwork profile for specific queries.
Sergio Daniel Suarez
Mechanical Designer
| Upwork Profile | LinkedIn