<?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: Error by placing partlist on drawing in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-by-placing-partlist-on-drawing/m-p/6876392#M70163</link>
    <description>&lt;P&gt;Hi Mike,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks for your reply.&lt;/P&gt;&lt;P&gt;This code was a snipset of the original code, but I just found the solution by myself&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just put&amp;nbsp;&lt;STRONG&gt;oBOM.StructuredViewFirstLevelOnly = True&lt;/STRONG&gt; in the code and now it runs great.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Geert&lt;/P&gt;</description>
    <pubDate>Tue, 14 Feb 2017 11:44:46 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2017-02-14T11:44:46Z</dc:date>
    <item>
      <title>Error by placing partlist on drawing</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-by-placing-partlist-on-drawing/m-p/6875967#M70158</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i sometimes get the following error by placing a partlist on a inventor DWG&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"Object of type 'System.UInt32' cannot be converted to type 'Inventor.CommandTypesEnum"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Why is that?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I use this VB.NET code:&lt;/P&gt;&lt;PRE&gt;Dim oDrawDoc As Inventor.DrawingDocument
oDrawDoc = m_inventorApplication.ActiveDocument

Dim oSheet As Inventor.Sheet
oSheet = oDrawDoc.ActiveSheet

Dim oDrawingView As Inventor.DrawingView
oDrawingView = oSheet.DrawingViews.Item(1)

Dim oRefDoc As Inventor.AssemblyDocument
oRefDoc = oDrawingView.ReferencedFile.ReferencedDocument

Dim oBOM As Inventor.BOM
oBOM = oRefDoc.ComponentDefinition.BOM
oBOM.StructuredViewEnabled = True
                    
Dim oBOMView As Inventor.BOMView
oBOMView = oBOM.BOMViews.Item("Structured")

Dim oPoint2D As Inventor.Point2d
oPoint2D = m_inventorApplication.TransientGeometry.CreatePoint2d(66,0) 

Dim oPartList As Inventor.PartsList
oPartList = oSheet.PartsLists.Add(oDrawingView, oPoint2D, Inventor.PartsListLevelEnum.kStructured, Nothing, 1, False) 


&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Geert&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2017 07:53:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-by-placing-partlist-on-drawing/m-p/6875967#M70158</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-02-14T07:53:47Z</dc:date>
    </item>
    <item>
      <title>Re: Error by placing partlist on drawing</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-by-placing-partlist-on-drawing/m-p/6876374#M70162</link>
      <description>&lt;P&gt;Hmm, that's strange. When it throws the error again, click on the second error tab. You can read there some more info about the error.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, you can shorten your code like this (orange is what I've changed):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Dim oDrawDoc As Inventor.DrawingDocument = m_inventorApplication.ActiveDocument
Dim oSheet As Inventor.Sheet = oDrawDoc.ActiveSheet&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT color="#FF6600"&gt;If oSheet.DrawingViews.Count = 0 Then Exit For&lt;/FONT&gt;&lt;/STRONG&gt;
Dim oDrawingView As Inventor.DrawingView = oSheet.DrawingViews.Item(1)
Dim oRefDoc As Inventor.AssemblyDocument = oDrawingView.ReferencedFile.ReferencedDocument
Dim oBOM As Inventor.BOM = oRefDoc.ComponentDefinition.BOM
oBOM.StructuredViewEnabled = True
Dim oBOMView As Inventor.BOMView = oBOM.BOMViews.Item("Structured")
Dim oPoint2D As Inventor.Point2d = m_inventorApplication.TransientGeometry.CreatePoint2d(66, 0)&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT color="#FF6600"&gt;Dim oLevel As Inventor.PartsListLevelEnum = Inventor.PartsListLevelEnum.kStructured&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;Dim oPartList As Inventor.PartsList = oSheet.PartsLists.Add(oDrawingView, oPoint2D, &lt;STRONG&gt;&lt;FONT color="#FF6600"&gt;oLevel&lt;/FONT&gt;&lt;/STRONG&gt;, Nothing, 1, False)&lt;/PRE&gt;</description>
      <pubDate>Tue, 14 Feb 2017 11:33:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-by-placing-partlist-on-drawing/m-p/6876374#M70162</guid>
      <dc:creator>Owner2229</dc:creator>
      <dc:date>2017-02-14T11:33:26Z</dc:date>
    </item>
    <item>
      <title>Re: Error by placing partlist on drawing</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-by-placing-partlist-on-drawing/m-p/6876392#M70163</link>
      <description>&lt;P&gt;Hi Mike,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks for your reply.&lt;/P&gt;&lt;P&gt;This code was a snipset of the original code, but I just found the solution by myself&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just put&amp;nbsp;&lt;STRONG&gt;oBOM.StructuredViewFirstLevelOnly = True&lt;/STRONG&gt; in the code and now it runs great.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Geert&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2017 11:44:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-by-placing-partlist-on-drawing/m-p/6876392#M70163</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-02-14T11:44:46Z</dc:date>
    </item>
  </channel>
</rss>

