Message 1 of 14
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi All,
I have the following piece of iLogic cobbled together from various sources:
Dim doc as Document
doc = ThisApplication.ActiveDocument
'Verify the current document has been saved.
If doc.FullFileName = "" Then
MessageBox.Show("This document must be saved first.")
Exit Sub
End If
Dim selectedfile As String = String.Empty
Dim oFileDlg As inventor.FileDialog = Nothing
InventorVb.Application.CreateFileDialog(oFileDlg)
oFileDlg.Filter = "Dwg files (*.dwg)|*.dwg|Excel files (*.xlsx)|*.xlsx|pdf files (*.pdf)|*.pdf|Inventor parts (*.ipt)|*.ipt"
oFileDlg.InitialDirectory = oOrigRefName
oFileDlg.CancelError = True
oFileDlg.MultiSelectEnabled = True
On Error Resume Next
oFileDlg.ShowOpen()
If Err.Number <> 0 Then
Return
ElseIf oFileDlg.FileName <> "" Then
selectedfile = oFileDlg.FileName
End If
MessageBox.Show("You selected: " & selectedfile , "iLogic")
Dim oleReference As ReferencedOLEFileDescriptor
If selectedfile.Contains("|") Then ' we have multiple files selected.
Dim file As String() = selectedfile.Split("|")
For Each s as String in file
MessageBox.Show("You selected: " & s , "iLogic")
oleReference = doc.ReferencedOLEFileDescriptors.Add(s,kOLEDocumentLinkObject)
oleReference.BrowserVisible = True
oleReference.Visible = false
oleReference.DisplayName = Mid$(s, InStrRev(s, "\") + 1)
Next
Else
oleReference = doc.ReferencedOLEFileDescriptors.Add(selectedFile,kOLEDocumentLinkObject)
oleReference.BrowserVisible = True
oleReference.Visible = false
oleReference.DisplayName = Mid$(selectedFile, InStrRev(selectedFile, "\") + 1)
End IfIt works fine except that the resultant "3rd Party" folder contains icons with this image:
Instead of the image created when you manually click the "Insert Object" button on the Manage Ribbon -> Insert tab:
Am I missing something which means that iLogic-inserted olereferences aren't treated the same as manually input ones?
Also, when I do this manually, the files are added to Vault Pro 2014 as "children" of whichever file I have run the iLogic within.
Thanks in advance,
Alex.
----------------------------------------------------------------
Alex Fielder
Inventor Expert
https://github.com/alexfielder/
LinkedIn - Github Inventor Extension Server - Bonkers polygon iLogic thing
Top ten iLogic Tips - API Shortcut In Google Chrome - Assembly Extrusion Example
Alex Fielder
Inventor Expert
https://github.com/alexfielder/
LinkedIn - Github Inventor Extension Server - Bonkers polygon iLogic thing
Top ten iLogic Tips - API Shortcut In Google Chrome - Assembly Extrusion Example
Solved! Go to Solution.