<?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: Copy View from a file in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/copy-view-from-a-file/m-p/7025465#M71733</link>
    <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As far as I know, Apprentice doesn't contain any UI capabilities so objects like Drawing Views may not be accessible. You could try opening the drawing instead as invisible&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Dim InvApplication As Inventor.Application =
&amp;nbsp;&amp;nbsp;&amp;nbsp; ' System.Runtime.InteropServices.Marshal.
&amp;nbsp;&amp;nbsp;&amp;nbsp; '&amp;nbsp; GetActiveObject("Inventor.Application")

Dim sPath As String = "C:/My Folder/ MyDrawing.idw"

Dim oIDW As Inventor.DrawingDocument =&amp;nbsp;InvApplication.Documents.Open(sPath, False)&lt;/PRE&gt;
&lt;P&gt;don't forget to close it after&lt;/P&gt;
&lt;PRE&gt;oIDW.Close
oIDW = nothing&lt;/PRE&gt;
&lt;P&gt;Nacho&lt;/P&gt;</description>
    <pubDate>Wed, 19 Apr 2017 01:08:17 GMT</pubDate>
    <dc:creator>NachitoMax</dc:creator>
    <dc:date>2017-04-19T01:08:17Z</dc:date>
    <item>
      <title>Copy View from a file</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/copy-view-from-a-file/m-p/7019393#M71718</link>
      <description>&lt;P&gt;I was able to use view.copyto to copy views from a file to another file when I have the source drawing open in inventor. But when I try to copy views from an ApprenticeServerDocument, I can read view names and locations but can not copy the views. Is this because ApprenticeServerDocument can only provide access to the drawing's properties but can't use the methods of the objects? Any one can help me on this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;        Dim dwgDoc As DrawingDocument
        dwgDoc = _invApp.ActiveDocument

        Dim dwgSheet As Sheet
        dwgSheet = dwgDoc.ActiveSheet


        Dim oApprentice As ApprenticeServerComponent

        oApprentice = New ApprenticeServerComponent

        Dim oADoc As ApprenticeServerDocument

        oADoc = oApprentice.Open("D:\Drawing1.idw")

        MsgBox(oADoc.DocumentType.ToString)

        Dim oASheets As Sheets
        oASheets = oADoc.Sheets

        For Each sht As Sheet In oASheets
            MsgBox(sht.Name)

            Dim oADViews As DrawingViews
            oADViews = sht.DrawingViews

            For Each oVw As DrawingView In oADViews
                MsgBox(oVw.Name &amp;amp; " is " &amp;amp; oVw.ViewType.ToString &amp;amp; ", at " &amp;amp; oVw.Position.X.ToString &amp;amp; ", " &amp;amp; oVw.Position.Y.ToString)
                Try
                    oVw.CopyTo(dwgSheet)
                Catch ex As Exception
                    MsgBox("Copy Faled.")
                End Try
                
            Next

        Next


        oADoc.Close()
        oApprentice.Close()&lt;/PRE&gt;</description>
      <pubDate>Sun, 16 Apr 2017 03:14:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/copy-view-from-a-file/m-p/7019393#M71718</guid>
      <dc:creator>bwang-tecoustics</dc:creator>
      <dc:date>2017-04-16T03:14:38Z</dc:date>
    </item>
    <item>
      <title>Re: Copy View from a file</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/copy-view-from-a-file/m-p/7025465#M71733</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As far as I know, Apprentice doesn't contain any UI capabilities so objects like Drawing Views may not be accessible. You could try opening the drawing instead as invisible&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Dim InvApplication As Inventor.Application =
&amp;nbsp;&amp;nbsp;&amp;nbsp; ' System.Runtime.InteropServices.Marshal.
&amp;nbsp;&amp;nbsp;&amp;nbsp; '&amp;nbsp; GetActiveObject("Inventor.Application")

Dim sPath As String = "C:/My Folder/ MyDrawing.idw"

Dim oIDW As Inventor.DrawingDocument =&amp;nbsp;InvApplication.Documents.Open(sPath, False)&lt;/PRE&gt;
&lt;P&gt;don't forget to close it after&lt;/P&gt;
&lt;PRE&gt;oIDW.Close
oIDW = nothing&lt;/PRE&gt;
&lt;P&gt;Nacho&lt;/P&gt;</description>
      <pubDate>Wed, 19 Apr 2017 01:08:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/copy-view-from-a-file/m-p/7025465#M71733</guid>
      <dc:creator>NachitoMax</dc:creator>
      <dc:date>2017-04-19T01:08:17Z</dc:date>
    </item>
  </channel>
</rss>

