<?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 Place part views on active sheet in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/place-part-views-on-active-sheet/m-p/8808229#M97704</link>
    <description>&lt;P&gt;Attempting to use this iLogic below to select a part and then place two views on the active sheet, not seeing why the views are not getting generated. Any help appreciated.&lt;/P&gt;&lt;PRE&gt;Imports Inventor.ViewOrientationTypeEnum
Imports Inventor.DrawingViewStyleEnum

Dim oDrawingDoc As DrawingDocument
Dim oPartDoc As PartDocument
Dim oSheet As Sheet
Dim oIsoView As DrawingView
Dim oFlatView As DrawingView

ViewScaleFlat = 1 / 4
ViewScaleIso = 1/14

'Present a File Selection dialog
Dim oFileDlg As Inventor.FileDialog = Nothing
InventorVb.Application.CreateFileDialog(oFileDlg)
oFileDlg.InitialDirectory = oOrigRefName
oFileDlg.CancelError = True
On Error Resume Next
oFileDlg.ShowOpen()
If Err.Number &amp;lt;&amp;gt; 0 Then
Return
ElseIf oFileDlg.FileName &amp;lt;&amp;gt; "" Then
oPartDoc = oFileDlg.FileName
End If

' Current open drawing sheet
oDrawingDoc = ThisApplication.ActiveDocument
oSheet = oDrawingDoc.ActiveSheet

' Create a new NameValueMap object
Dim oBaseViewOptions As NameValueMap
oBaseViewOptions = ThisApplication.TransientObjects.CreateNameValueMap

'False = flat pattern view
oBaseViewOptions.Add("SheetMetalFoldedModel", False) 

'Bottom left corner points for views
oPoint1 = ThisApplication.TransientGeometry.CreatePoint2d(7, 7.125) ' iso view
oPoint2 = ThisApplication.TransientGeometry.CreatePoint2d(20, 18)' flat pattern

'Place the Views
oIsoView = oSheet.DrawingViews.AddBaseView(oPartDoc, oPoint1, ViewScaleIso, kIsoTopRightViewOrientation, kHiddenLineRemovedDrawingViewStyle)
oFlatView = oSheet.DrawingViews.AddBaseView(oPartDoc, oPoint2, ViewScaleFlat, kDefaultViewOrientation, kHiddenLineDrawingViewStyle, , , oBaseViewOptions)&lt;/PRE&gt;</description>
    <pubDate>Wed, 22 May 2019 17:41:35 GMT</pubDate>
    <dc:creator>blindholm16</dc:creator>
    <dc:date>2019-05-22T17:41:35Z</dc:date>
    <item>
      <title>Place part views on active sheet</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/place-part-views-on-active-sheet/m-p/8808229#M97704</link>
      <description>&lt;P&gt;Attempting to use this iLogic below to select a part and then place two views on the active sheet, not seeing why the views are not getting generated. Any help appreciated.&lt;/P&gt;&lt;PRE&gt;Imports Inventor.ViewOrientationTypeEnum
Imports Inventor.DrawingViewStyleEnum

Dim oDrawingDoc As DrawingDocument
Dim oPartDoc As PartDocument
Dim oSheet As Sheet
Dim oIsoView As DrawingView
Dim oFlatView As DrawingView

ViewScaleFlat = 1 / 4
ViewScaleIso = 1/14

'Present a File Selection dialog
Dim oFileDlg As Inventor.FileDialog = Nothing
InventorVb.Application.CreateFileDialog(oFileDlg)
oFileDlg.InitialDirectory = oOrigRefName
oFileDlg.CancelError = True
On Error Resume Next
oFileDlg.ShowOpen()
If Err.Number &amp;lt;&amp;gt; 0 Then
Return
ElseIf oFileDlg.FileName &amp;lt;&amp;gt; "" Then
oPartDoc = oFileDlg.FileName
End If

' Current open drawing sheet
oDrawingDoc = ThisApplication.ActiveDocument
oSheet = oDrawingDoc.ActiveSheet

' Create a new NameValueMap object
Dim oBaseViewOptions As NameValueMap
oBaseViewOptions = ThisApplication.TransientObjects.CreateNameValueMap

'False = flat pattern view
oBaseViewOptions.Add("SheetMetalFoldedModel", False) 

'Bottom left corner points for views
oPoint1 = ThisApplication.TransientGeometry.CreatePoint2d(7, 7.125) ' iso view
oPoint2 = ThisApplication.TransientGeometry.CreatePoint2d(20, 18)' flat pattern

'Place the Views
oIsoView = oSheet.DrawingViews.AddBaseView(oPartDoc, oPoint1, ViewScaleIso, kIsoTopRightViewOrientation, kHiddenLineRemovedDrawingViewStyle)
oFlatView = oSheet.DrawingViews.AddBaseView(oPartDoc, oPoint2, ViewScaleFlat, kDefaultViewOrientation, kHiddenLineDrawingViewStyle, , , oBaseViewOptions)&lt;/PRE&gt;</description>
      <pubDate>Wed, 22 May 2019 17:41:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/place-part-views-on-active-sheet/m-p/8808229#M97704</guid>
      <dc:creator>blindholm16</dc:creator>
      <dc:date>2019-05-22T17:41:35Z</dc:date>
    </item>
    <item>
      <title>Re: Place part views on active sheet</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/place-part-views-on-active-sheet/m-p/8808352#M97705</link>
      <description>&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #f5f5f5; color: #3e3e3e; font-family: Menlo,Monaco,Consolas,'Courier New',monospace; font-size: 15px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 1.7142; orphans: 2; overflow-wrap: break-word; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-break: break-all; word-spacing: 0px;"&gt;oPartDoc = oFileDlg.FileName&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #f5f5f5; color: #3e3e3e; font-family: Menlo,Monaco,Consolas,'Courier New',monospace; font-size: 15px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 1.7142; orphans: 2; overflow-wrap: break-word; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-break: break-all; word-spacing: 0px;"&gt;part doc = file path ---&amp;gt; not going to work, this you don't know because of On Error Resume Next. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #f5f5f5; color: #3e3e3e; font-family: Menlo,Monaco,Consolas,'Courier New',monospace; font-size: 15px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 1.7142; orphans: 2; overflow-wrap: break-word; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-break: break-all; word-spacing: 0px;"&gt;Replace your OnError thinking with the better Try/Catch/Finally method of error capturing.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #f5f5f5; color: #3e3e3e; font-family: Menlo,Monaco,Consolas,'Courier New',monospace; font-size: 15px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 1.7142; orphans: 2; overflow-wrap: break-word; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-break: break-all; word-spacing: 0px;"&gt;Use these methods to get a document from the Application.Documents&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Menlo,Monaco,Consolas,&amp;quot;Courier New&amp;quot;,monospace"&gt;&lt;FONT color="#002000"&gt;&lt;FONT&gt;D&lt;SPAN style="display: inline !important; float: none; background-color: #f5f5f5; color: #3e3e3e; font-family: Menlo,Monaco,Consolas,'Courier New',monospace; font-size: 15px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 1.7142; orphans: 2; overflow-wrap: break-word; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-break: break-all; word-spacing: 0px;"&gt;ocuments.Open(filepath)&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #f5f5f5; color: #3e3e3e; font-family: Menlo,Monaco,Consolas,'Courier New',monospace; font-size: 15px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 1.7142; orphans: 2; overflow-wrap: break-word; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-break: break-all; word-spacing: 0px;"&gt;or &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #f5f5f5; color: #3e3e3e; font-family: Menlo,Monaco,Consolas,'Courier New',monospace; font-size: 15px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 1.7142; orphans: 2; overflow-wrap: break-word; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-break: break-all; word-spacing: 0px;"&gt;Documents.OpenWithOptions(filepath,options,openvisibleorhidden)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #f5f5f5; color: #3e3e3e; font-family: Menlo,Monaco,Consolas,'Courier New',monospace; font-size: 15px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 1.7142; orphans: 2; overflow-wrap: break-word; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-break: break-all; word-spacing: 0px;"&gt;or &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #f5f5f5; color: #3e3e3e; font-family: Menlo,Monaco,Consolas,'Courier New',monospace; font-size: 15px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 1.7142; orphans: 2; overflow-wrap: break-word; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-break: break-all; word-spacing: 0px;"&gt;for each doc in Documents&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #f5f5f5; color: #3e3e3e; font-family: Menlo,Monaco,Consolas,'Courier New',monospace; font-size: 15px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 1.7142; orphans: 2; overflow-wrap: break-word; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-break: break-all; word-spacing: 0px;"&gt;if doc.fullfilename = filepath then&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #f5f5f5; color: #3e3e3e; font-family: Menlo,Monaco,Consolas,'Courier New',monospace; font-size: 15px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 1.7142; orphans: 2; overflow-wrap: break-word; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-break: break-all; word-spacing: 0px;"&gt;partdoc=doc&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #f5f5f5; color: #3e3e3e; font-family: Menlo,Monaco,Consolas,'Courier New',monospace; font-size: 15px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 1.7142; orphans: 2; overflow-wrap: break-word; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-break: break-all; word-spacing: 0px;"&gt;end if&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #f5f5f5; color: #3e3e3e; font-family: Menlo,Monaco,Consolas,'Courier New',monospace; font-size: 15px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 1.7142; orphans: 2; overflow-wrap: break-word; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-break: break-all; word-spacing: 0px;"&gt;next&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 May 2019 18:20:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/place-part-views-on-active-sheet/m-p/8808352#M97705</guid>
      <dc:creator>JamieVJohnson2</dc:creator>
      <dc:date>2019-05-22T18:20:20Z</dc:date>
    </item>
  </channel>
</rss>

