Message 1 of 3

Not applicable
09-27-2020
02:09 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
This should close the drawing when sting matches. I dont know why this doest work. Tested it with other value, its fine.
Dim oFileDlg As Inventor.FileDialog = Nothing ThisApplication.CreateFileDialog(oFileDlg) oFileDlg.Filter = "Autodesk Inventor Drawings (*.idw)|*.idw" oFileDlg.DialogTitle = "Select Drawings To Check" oFileDlg.InitialDirectory = ThisApplication.DesignProjectManager.ActiveDesignProject.WorkspacePath oFileDlg.MultiSelectEnabled =True oFileDlg.FilterIndex = 1 oFileDlg.CancelError = True On Error Resume Next oFileDlg.ShowOpen() Dim oDrgDoc As DrawingDocument If Err.Number <> 0 Then MsgBox("File not chosen.",,"Dialog Cancellation") ElseIf oFileDlg.FileName <> "" Then For Each oFileName As String In oFileDlg.FileName.Split("|") oDrgDoc = ThisApplication.Documents.Open(oFileName) doc = ThisApplication.ActiveDocument oDwgName = IO.Path.GetFileNameWithoutExtension(oFileName).ToUpper 'MsgBox(oDwgName) Dim oFD As FileDescriptor oFD = doc.ReferencedFileDescriptors(1).DocumentDescriptor.ReferencedFileDescriptor oModelRef = (oFD.FullFileName.Split("\").Last()).Split(".").First().ToUpper 'MsgBox(oModelRef) 'Test ' DwgName = "one" ' oModelRef = "one" If DwgName = oModelRef Then oDrgDoc.Close(True) oDrgDoc.ReleaseReference End If Next End If
Solved! Go to Solution.