- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
This code works great, but it uses the assembly model to make the views.
Imports Inventor.ViewOrientationTypeEnum Imports Inventor.DrawingViewStyleEnum Imports System.IO
'iLogic code by @ClintBrown3D, https://clintbrown.co.uk/ilogic-quick-tip-file-open-dialogue 'Create File Open Dialogue oDoc = ThisDoc.Document Dim oFileDlg As Inventor.FileDialog = Nothing InventorVb.Application.CreateFileDialog(oFileDlg) '3rd Party File formats: o1 = "3rd Party Files |*.wire; *.CATpart; *.CATproduct;*.dlv3;" o2 = "*.fusiondesign; *.igs; *.iges; *.jt; *.prt; *.obj; *.x_b; *.x_t; *.g; *.neu;" o3 = "*.prt; *.asm; *.rvt; *.3dm; *.sat; *.smt; *.stp; *.ste; *.step; *.stpz; *.stl;" o4 = "*.stlb; *.par; *.psm; *.asm; *.prt; *.sldprt; *.sldasm; *.model; *.session; *.exp" 'Choose the "File Type" by uncommenting one of the options below: 'For "ALL file Types" Comment out all lines in this section 'oFileDlg.Filter = "Drawing Files (*.dwg) (*.idw)|*.dwg; *.idw" oFileDlg.Filter = "Part Files (*.ipt)|*.ipt" 'oFileDlg.Filter = "Assembly Files (*.iam)|*.iam" 'oFileDlg.Filter = "XML files (*.xml)|*.xml" 'oFileDlg.Filter = o1 & o2 & o3 & o4 ' 3rd Party Files 'Set open location using one of these 2 options below, "1)Hard coded" or "2)Project location": 'oFileDlg.InitialDirectory = "C:\TEMP\" 'Hard Coded path: oFileDlg.InitialDirectory = ThisApplication.DesignProjectManager.ActiveDesignProject.WorkspacePath 'Show File Open Dialogue oFileDlg.DialogTitle = "Inventor" oFileDlg.ShowOpen()
But I wanna take the other approach in which I have these two codes, one an Ilogic and the other VBA that bring the open windows browser and lets you pick part files. On the logic one, I can't select multiple files and it is missing the base placement, as the right view on the cube, scale 1/4".
oDoc = ThisDoc.Document Dim oFileDlg As Inventor.FileDialog = Nothing InventorVb.Application.CreateFileDialog(oFileDlg) '3rd Party File formats: o1 = "3rd Party Files |*.wire; *.CATpart; *.CATproduct;*.dlv3;" o2 = "*.fusiondesign; *.igs; *.iges; *.jt; *.prt; *.obj; *.x_b; *.x_t; *.g; *.neu;" o3 = "*.prt; *.asm; *.rvt; *.3dm; *.sat; *.smt; *.stp; *.ste; *.step; *.stpz; *.stl;" o4 = "*.stlb; *.par; *.psm; *.asm; *.prt; *.sldprt; *.sldasm; *.model; *.session; *.exp" 'Choose the "File Type" by uncommenting one of the options below: 'For "ALL file Types" Comment out all lines in this section 'oFileDlg.Filter = "Drawing Files (*.dwg) (*.idw)|*.dwg; *.idw" oFileDlg.Filter = "Part Files (*.ipt)|*.ipt" 'oFileDlg.Filter = "Assembly Files (*.iam)|*.iam" 'oFileDlg.Filter = "XML files (*.xml)|*.xml" 'oFileDlg.Filter = o1 & o2 & o3 & o4 ' 3rd Party Files 'Set open location using one of these 2 options below, "1)Hard coded" or "2)Project location": 'oFileDlg.InitialDirectory = "C:\TEMP\" 'Hard Coded path: oFileDlg.InitialDirectory = ThisApplication.DesignProjectManager.ActiveDesignProject.WorkspacePath 'Show File Open Dialogue oFileDlg.DialogTitle = "Inventor" oFileDlg.ShowOpen()
The VBA code selects multiple files but does not load them as base view right views on the cube and @ 1/4 scale.
Private Sub cmdSourceAdd_Click()
Dim oFileDlg As FileDialog
' Create a new FileDialog object.
Call ThisApplication.CreateFileDialog(oFileDlg)
' Define the filter to select part and assembly files or any file.
oFileDlg.Filter = "Inventor Files (*.iam;*.ipt;*.idw;*.dwg)|*.iam;*.ipt;*.idw;*.dwg|All Files (*.*)|*.*"
' Define the part and assembly files filter to be the default filter.
oFileDlg.FilterIndex = 1
oFileDlg.MultiSelectEnabled = True
' Set the title for the dialog.
oFileDlg.DialogTitle = "Open File Test"
' Set the initial directory that will be displayed in the dialog.
'oFileDlg.InitialDirectory = ThisApplication.FileOptions.ProjectsPath
' Set the flag so an error will be raised if the user clicks the Cancel button.
oFileDlg.CancelError = True
' Show the open dialog. The same procedure is also used for the Save dialog.
' The commented code can be used for the Save dialog.
On Error Resume Next
oFileDlg.ShowOpen
' oFileDlg.ShowSave
' If an error was raised, the user clicked cancel, otherwise display the filename.
If Err Then
MsgBox "User cancelled out of dialog"
ElseIf Not oFileDlg.FileName = "" Then
lstSource.AddItem oFileDlg.FileName
End If
End Sub
I would appreciate the help very much!!! not sure how to integrate to open the base view and set it as the top or right view @ 1/4 scale for all selected files.
Solved! Go to Solution.