<?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: How to add parts list row to object collection inventor vba in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-add-parts-list-row-to-object-collection-inventor-vba/m-p/10551790#M127766</link>
    <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/10857590"&gt;@adiazLRYTC&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just looking through your code, I see that you never create the ObjectCollection, you're just declaring a variable of type ObjectCollection. You also need to create it for the variable to not just be Nothing.&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Dim ObjColl As ObjectCollection
Set ObjColl = ThisApplication.TransientObjects.CreateObjectCollection 'Create object collection&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;When it's created it'll exist and you can add objects to it &lt;img class="lia-deferred-image lia-image-emoji" src="https://forums.autodesk.com/html/@B4D44A73814D7FC0D950DEDFACB97081/emoticons/1f642.png" alt=":slightly_smiling_face:" title=":slightly_smiling_face:" /&gt; &lt;/P&gt;</description>
    <pubDate>Tue, 17 Aug 2021 12:39:56 GMT</pubDate>
    <dc:creator>JhoelForshav</dc:creator>
    <dc:date>2021-08-17T12:39:56Z</dc:date>
    <item>
      <title>How to add parts list row to object collection inventor vba</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-add-parts-list-row-to-object-collection-inventor-vba/m-p/10550143#M127741</link>
      <description>&lt;P&gt;Hello everyone, I am working on a coding project that requires me to add the following to a list (Part Number, Description, Category, G_L, Component Type, Revision Number). Rather then adding them each into their separate lists, I was thinking that adding the entire row from the parts list onto an object collection would be much faster. That way if I need info I can just call from the collection rather then each individual list. it would be much easier and faster. But I am having trouble on adding an entire row to a collection. Any ideas? here is what I have to far.&lt;/P&gt;&lt;P&gt;Public Sub CheckRevised()&lt;BR /&gt;Dim ThisDrwing As Inventor.DrawingDocument&lt;BR /&gt;Dim oSheet As Sheet&lt;BR /&gt;Dim oDrawingView As DrawingView&lt;BR /&gt;Dim oModelDoc As Document&lt;BR /&gt;Dim ThisAssem As Inventor.AssemblyDocument&lt;BR /&gt;Dim oBom As BOM&lt;BR /&gt;Dim oBOMView As BOMView&lt;BR /&gt;Dim compDef As ComponentDefinition&lt;BR /&gt;Dim doc As Document&lt;BR /&gt;Dim row As BOMRow&lt;BR /&gt;Dim prop As Property&lt;BR /&gt;Dim PartNumList As Variant&lt;BR /&gt;Dim DescripList As Variant&lt;BR /&gt;Dim CategList As Variant&lt;BR /&gt;Dim glList As Variant&lt;BR /&gt;Dim CompTypeList As Variant&lt;BR /&gt;Dim ObjColl As ObjectCollection&lt;BR /&gt;'Check if they wanted to run function&lt;BR /&gt;IntMsg = MsgBox("This Function initiates a drawing check, would you like to continue?", vbYesNo)&lt;BR /&gt;If IntMsg = 6 Then&lt;BR /&gt;'Check if drawing&lt;BR /&gt;If ThisApplication.ActiveDocumentType = kDrawingDocumentObject Then&lt;BR /&gt;Set ThisDrwing = ThisApplication.ActiveDocument&lt;BR /&gt;'If first sheet not active then prompt that we will default to use the first sheet "Ok?"&lt;BR /&gt;If ThisDrwing.ActiveSheet.Name &amp;lt;&amp;gt; ThisDrwing.Sheets(1).Name Then&lt;BR /&gt;IntMsgs = MsgBox("First sheet not found active, will default to use first sheet. Ok?", vbYesNo)&lt;BR /&gt;End If&lt;BR /&gt;If IntMsgs = 7 Then&lt;BR /&gt;MsgBox ("Function canceled.")&lt;BR /&gt;End&lt;BR /&gt;End If&lt;BR /&gt;'On sheet look at first views scource, and get scource model&lt;BR /&gt;Set oSheet = ThisDrwing.ActiveSheet&lt;BR /&gt;Set oDrawingView = oSheet.DrawingViews.Item(1)&lt;BR /&gt;Set oModelDoc = oDrawingView.ReferencedDocumentDescriptor.ReferencedDocument&lt;BR /&gt;Set ThisAssem = ThisApplication.Documents.Open(oModelDoc.FullDocumentName, True)&lt;BR /&gt;Set ThisAssem = ThisApplication.ActiveDocument&lt;BR /&gt;Set oBom = ThisAssem.ComponentDefinition.BOM&lt;BR /&gt;oBom.StructuredViewEnabled = False&lt;BR /&gt;oBom.StructuredViewFirstLevelOnly = False&lt;BR /&gt;oBom.PartsOnlyViewEnabled = True&lt;BR /&gt;Set oBOMView = oBom.BOMViews(2)&lt;BR /&gt;'load parts list into array (Part Number, Description, Category, G_L, Component Type, Revision Number)&lt;BR /&gt;ReDim PartNumList(1)&lt;BR /&gt;For Each row In oBOMView.BOMRows&lt;BR /&gt;Set compDef = row.ComponentDefinitions(1)&lt;BR /&gt;Set doc = compDef.Document&lt;BR /&gt;ObjColl.Add (doc.PropertySets("Design Tracking Properties")) &amp;lt;&amp;lt; HERE IS THE TROUBLE&lt;/P&gt;&lt;P&gt;Next&lt;/P&gt;&lt;P&gt;Else&lt;BR /&gt;MsgBox ("File opened must me drawing document, function canceled.")&lt;BR /&gt;End&lt;BR /&gt;End If&lt;BR /&gt;Else&lt;BR /&gt;MsgBox ("Function canceled.")&lt;BR /&gt;End&lt;BR /&gt;End If&lt;BR /&gt;End Sub&lt;/P&gt;</description>
      <pubDate>Mon, 16 Aug 2021 21:21:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-add-parts-list-row-to-object-collection-inventor-vba/m-p/10550143#M127741</guid>
      <dc:creator>adiazLRYTC</dc:creator>
      <dc:date>2021-08-16T21:21:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to add parts list row to object collection inventor vba</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-add-parts-list-row-to-object-collection-inventor-vba/m-p/10551790#M127766</link>
      <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/10857590"&gt;@adiazLRYTC&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just looking through your code, I see that you never create the ObjectCollection, you're just declaring a variable of type ObjectCollection. You also need to create it for the variable to not just be Nothing.&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Dim ObjColl As ObjectCollection
Set ObjColl = ThisApplication.TransientObjects.CreateObjectCollection 'Create object collection&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;When it's created it'll exist and you can add objects to it &lt;img class="lia-deferred-image lia-image-emoji" src="https://forums.autodesk.com/html/@B4D44A73814D7FC0D950DEDFACB97081/emoticons/1f642.png" alt=":slightly_smiling_face:" title=":slightly_smiling_face:" /&gt; &lt;/P&gt;</description>
      <pubDate>Tue, 17 Aug 2021 12:39:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-add-parts-list-row-to-object-collection-inventor-vba/m-p/10551790#M127766</guid>
      <dc:creator>JhoelForshav</dc:creator>
      <dc:date>2021-08-17T12:39:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to add parts list row to object collection inventor vba</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-add-parts-list-row-to-object-collection-inventor-vba/m-p/10552178#M127779</link>
      <description>&lt;P&gt;Just curious...what are you planning on doing with this ObjectCollection full of PropertySet objects after you have collected them into it?&amp;nbsp; If you are planning on reducing processing time, this may not be the best option.&amp;nbsp; If there are a select few properties within each set that you are interested in, it may be more advantageous to just collect their values into something like a collection of collections, or an Array of Arrays, or similar instead.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Aug 2021 14:44:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-add-parts-list-row-to-object-collection-inventor-vba/m-p/10552178#M127779</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2021-08-17T14:44:00Z</dc:date>
    </item>
  </channel>
</rss>

