<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Replace reference file for a specific drawing view. in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/replace-reference-file-for-a-specific-drawing-view/m-p/7194432#M73184</link>
    <description>&lt;P&gt;I know, but I feel it should be possible in the way my code intends to. So that why I ask if I am doing something wrong or what I should change. If someone from Autodesk verifies it's not possible I will do the whole copy hassle..&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/486618"&gt;@johnsonshiue&lt;/a&gt;&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/116141"&gt;@ekinsb&lt;/a&gt;&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/339467"&gt;@adam.nagy&lt;/a&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 30 Jun 2017 09:20:03 GMT</pubDate>
    <dc:creator>Jef_E</dc:creator>
    <dc:date>2017-06-30T09:20:03Z</dc:date>
    <item>
      <title>Replace reference file for a specific drawing view.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/replace-reference-file-for-a-specific-drawing-view/m-p/7190241#M73160</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to add a specific workflow into our Inventor but I am failing to do so.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;&lt;FONT size="4"&gt;&amp;nbsp;The situation&lt;/FONT&gt;&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;We draw pressure tanks and vessels, on these tanks there are many nozzles that are the same (components), but only vary in size.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;Our workflow now is draw 1 nozzle and create a &lt;STRONG&gt;copy design&lt;/STRONG&gt;, change the size and there is a new nozzle. We do this until the 3D model is finished.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;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.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;&lt;FONT size="4"&gt;The problem&lt;/FONT&gt;&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;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.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;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!&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;Here is my code ( quick code for testing) but how can I change the drawing view reference file for a specific drawing view?&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;        ' 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)&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H1&gt;FileDescriptor.ReplaceReference Method&lt;/H1&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;Parent Object: &lt;A href="https://forums.autodesk.com/FileDescriptor.htm" target="_blank"&gt;FileDescriptor&lt;/A&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;H2&gt;&amp;nbsp;&lt;/H2&gt;
&lt;H2&gt;Description&lt;/H2&gt;
&lt;P&gt;&lt;FONT size="2"&gt;Method that replaces the referenced file.&lt;/FONT&gt;&lt;/P&gt;
&lt;H2&gt;&amp;nbsp;&lt;/H2&gt;
&lt;H2&gt;Syntax&lt;/H2&gt;
&lt;P&gt;&lt;FONT size="2"&gt;FileDescriptor.&lt;STRONG&gt;ReplaceReference&lt;/STRONG&gt;( &lt;STRONG&gt;&lt;I&gt;FullFileName&lt;/I&gt;&lt;/STRONG&gt; As String )&lt;/FONT&gt;&lt;/P&gt;
&lt;H2&gt;&amp;nbsp;&lt;/H2&gt;
&lt;H2&gt;Parameters&lt;/H2&gt;
&lt;TABLE class="list"&gt;
&lt;TBODY&gt;
&lt;TR class="header"&gt;
&lt;TD class="list"&gt;Name&lt;/TD&gt;
&lt;TD class="list"&gt;Description&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="list"&gt;FullFileName&lt;/TD&gt;
&lt;TD class="list"&gt;Input string that specifies the full file name to which the reference should be switched.&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;H2&gt;&amp;nbsp;&lt;/H2&gt;
&lt;H2&gt;Remarks&lt;/H2&gt;
&lt;P&gt;&lt;FONT size="2"&gt;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.&lt;/FONT&gt;&lt;/P&gt;
&lt;H2&gt;&amp;nbsp;&lt;/H2&gt;
&lt;H2&gt;Version&lt;/H2&gt;
&lt;P&gt;&lt;FONT size="2"&gt;Introduced in Inventor version 11&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jun 2017 12:36:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/replace-reference-file-for-a-specific-drawing-view/m-p/7190241#M73160</guid>
      <dc:creator>Jef_E</dc:creator>
      <dc:date>2017-06-29T12:36:31Z</dc:date>
    </item>
    <item>
      <title>Re: Replace reference file for a specific drawing view.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/replace-reference-file-for-a-specific-drawing-view/m-p/7191382#M73173</link>
      <description>&lt;P&gt;If nothing else is working, just recreate what you do manually using the code; ie moving sheets/drawing views/replacing reference in a new file..&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jun 2017 18:05:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/replace-reference-file-for-a-specific-drawing-view/m-p/7191382#M73173</guid>
      <dc:creator>MechMachineMan</dc:creator>
      <dc:date>2017-06-29T18:05:06Z</dc:date>
    </item>
    <item>
      <title>Re: Replace reference file for a specific drawing view.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/replace-reference-file-for-a-specific-drawing-view/m-p/7194432#M73184</link>
      <description>&lt;P&gt;I know, but I feel it should be possible in the way my code intends to. So that why I ask if I am doing something wrong or what I should change. If someone from Autodesk verifies it's not possible I will do the whole copy hassle..&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/486618"&gt;@johnsonshiue&lt;/a&gt;&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/116141"&gt;@ekinsb&lt;/a&gt;&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/339467"&gt;@adam.nagy&lt;/a&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jun 2017 09:20:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/replace-reference-file-for-a-specific-drawing-view/m-p/7194432#M73184</guid>
      <dc:creator>Jef_E</dc:creator>
      <dc:date>2017-06-30T09:20:03Z</dc:date>
    </item>
    <item>
      <title>Re: Replace reference file for a specific drawing view.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/replace-reference-file-for-a-specific-drawing-view/m-p/7194461#M73185</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3139519"&gt;@Jef_E&lt;/a&gt;&amp;nbsp;i had the same issues, and i actually&amp;nbsp;recreated the manual labour in code&lt;/P&gt;
&lt;P&gt;I use this tool a lot to avoid the workaround&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Sub ReplaceView()
 
Dim oDoc, oDocTemp As DrawingDocument
Set oDoc = ThisApplication.ActiveDocument
Set oDocTemp = ThisApplication.Documents.Add(kDrawingDocumentObject)

Dim oDrawingView, oDrawingViewTemp As DrawingView
Set oDrawingView = oDoc.SelectSet.Item(1)
Dim strDrawingViewName As String
strDrawingViewName = oDrawingView.Name

Call oDrawingView.CopyTo(oDocTemp.ActiveSheet)
oDrawingView.Delete

oDocTemp.Activate
Set oDrawingViewTemp = oDocTemp.ActiveSheet.DrawingViews(1)

Dim fd As FileDialog
Call ThisApplication.CreateFileDialog(fd)

Dim strFileName As String
fd.ShowOpen
strFileName = fd.FileName

Call oDrawingViewTemp.ReferencedDocumentDescriptor.ReferencedFileDescriptor.ReplaceReference(strFileName)
oDocTemp.Update2
Call oDrawingViewTemp.CopyTo(oDoc.ActiveSheet)

Call oDocTemp.Close(True)
Call oDoc.Activate

oDoc.Update2
 
End Sub&lt;/PRE&gt;</description>
      <pubDate>Fri, 30 Jun 2017 09:30:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/replace-reference-file-for-a-specific-drawing-view/m-p/7194461#M73185</guid>
      <dc:creator>frederic.vandenplas</dc:creator>
      <dc:date>2017-06-30T09:30:22Z</dc:date>
    </item>
    <item>
      <title>Re: Replace reference file for a specific drawing view.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/replace-reference-file-for-a-specific-drawing-view/m-p/7194479#M73186</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3139519"&gt;@Jef_E&lt;/a&gt;&amp;nbsp;i don't think the behaviour of the API is different then the Replace Model Reference in this case...&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jun 2017 09:35:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/replace-reference-file-for-a-specific-drawing-view/m-p/7194479#M73186</guid>
      <dc:creator>frederic.vandenplas</dc:creator>
      <dc:date>2017-06-30T09:35:18Z</dc:date>
    </item>
  </channel>
</rss>

