Replace reference file for a specific drawing view.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I am trying to add a specific workflow into our Inventor but I am failing to do so.
The situation
We draw pressure tanks and vessels, on these tanks there are many nozzles that are the same (components), but only vary in size.
Our workflow now is draw 1 nozzle and create a copy design, change the size and there is a new nozzle. We do this until the 3D model is finished.
Then we start to create detail drawings for these nozzles, which works quite fast, but.. (here is the problem) We copy the drawing view to another drawing, and then use change model reference to create the detail the next nozzle.
The problem
The copying to another drawing and then copying it back is too much work.. as we do this alot... So what I was attempting to is eliminating these steps.
I tried having the user select a drawing view, and then replacing the referenced file. But when I do this the reference for the other drawing view is also changed.. ughh bummer!
Here is my code ( quick code for testing) but how can I change the drawing view reference file for a specific drawing view?
' Get the active document Dim oDoc As DrawingDocument = _invApp.ActiveDocument ' Get the selected view Dim oDrawingView As DrawingView = oDoc.SelectSet.Item(1) ' Return the model reference Dim oReference As String oReference = oDrawingView.ReferencedDocumentDescriptor.ReferencedFileDescriptor.ReferencedFile.FullFileName ' Browse for a file Dim fd As OpenFileDialog = New OpenFileDialog() Dim strFileName As String fd.Title = "Open File Dialog" fd.InitialDirectory = IO.Path.GetDirectoryName(oReference) fd.Filter = "All files (*.*)|*.*|All files (*.*)|*.*" fd.FilterIndex = 2 fd.RestoreDirectory = True If fd.ShowDialog() = DialogResult.OK Then strFileName = fd.FileName Else Exit Sub End If ' Replace the reference oDrawingView.ReferencedDocumentDescriptor.ReferencedFileDescriptor.ReplaceReference(strFileName)
FileDescriptor.ReplaceReference Method
Parent Object: FileDescriptor
Description
Method that replaces the referenced file.
Syntax
FileDescriptor.ReplaceReference( FullFileName As String )
Parameters
Name | Description |
FullFileName | Input string that specifies the full file name to which the reference should be switched. |
Remarks
The file being replaced and the replacement file must share ancestry (i.e. they must have the same InternalName). Documents have the same internal name if they are copied using 'Save Copy As' or a file explorer copy.
Version
Introduced in Inventor version 11
Please kudo if this post was helpfull
Please accept as solution if your problem was solved
Inventor 2014 SP2