<?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: iLogic - setting iProperty value to Parts Only BOM Quantity in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-setting-iproperty-value-to-parts-only-bom-quantity/m-p/8237464#M88337</link>
    <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/6131001"&gt;@andrew.tom.reynolds&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hoping that below iLogic code may help to update iProperties of &lt;STRONG&gt;"Parts Only" &lt;/STRONG&gt;BOMView.&lt;/P&gt;
&lt;PRE&gt;Sub Main()
    Dim oDoc As AssemblyDocument
    oDoc = ThisApplication.ActiveDocument
    
    Dim oDef As AssemblyComponentDefinition
    oDef = oDoc.ComponentDefinition
    
    Dim oBOMView As BOMView
    oBOMView = oDef.BOM.BOMViews.Item("Parts Only")
    
    Dim oBOMRow As BOMRow
    For Each oBOMRow In oBOMView.BOMRows
        Dim oReferDoc As Document
        oReferDoc = oBOMRow.ComponentDefinitions.Item(1).Document
        
        If oReferDoc.DocumentType = kPartDocumentObject Then
            Dim occ As ComponentOccurrence
            For Each occ In oDef.Occurrences
                If occ.ReferencedDocumentDescriptor.ReferencedDocument Is oReferDoc Then
                    If occ.Suppressed = False Then
                        iProperties.Value(occ.Name, "Project", "Part Number") = "XYZ"						
                    End If
                End If
            Next
        End If 
    Next 
End Sub&lt;/PRE&gt;
&lt;P&gt;For further investigation, please provide sample assembly file to test. Also, make sure that files are non confidential.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks and regards,&lt;/P&gt;</description>
    <pubDate>Fri, 31 Aug 2018 09:14:11 GMT</pubDate>
    <dc:creator>chandra.shekar.g</dc:creator>
    <dc:date>2018-08-31T09:14:11Z</dc:date>
    <item>
      <title>iLogic - setting iProperty value to Parts Only BOM Quantity</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-setting-iproperty-value-to-parts-only-bom-quantity/m-p/8228783#M88262</link>
      <description>&lt;P&gt;There are quite a few posts similar to this topic, but I can't seem to adapt these to my specific problem so i'm hoping for some help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have an assembly which is configured using iLogic from parameters and options in a spreadsheet. The configuration is done by suppressing and un-suppressing various parts and changing parameters. This is all working well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Once all is said and done, I want to get the Parts Only BOM QTY value for each "active" part in the model and write that value to one of the in-built iProperties ("summary", "comments" or the like). For all "non-active" parts (either suppressed or phantom structure etc), i want to set the same iProperty value to 0. That way, I can use that property later on the drawing view to indicate whether that part is needed or not. There is a downstream reason for this in the CAM software, however crazy it sounds.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please note I only need to do this for parts (can ignore all sub-assemblies) and the Parts Only BOM view is accurate for each configuration.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any chance someone can help with a method of firstly setting an iProperty value all parts (active and in-active) to 0 and then for active items, getting the BOM Parts Only QTY and setting it to that value? I have the method for cycling through only active parts where i'm setting other iProperty values and that's working well. I just don't know how to combine the BOM functions and this into a workable solution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Andrew.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Aug 2018 05:31:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-setting-iproperty-value-to-parts-only-bom-quantity/m-p/8228783#M88262</guid>
      <dc:creator>andrew.tom.reynolds</dc:creator>
      <dc:date>2018-08-28T05:31:33Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic - setting iProperty value to Parts Only BOM Quantity</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-setting-iproperty-value-to-parts-only-bom-quantity/m-p/8237464#M88337</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/6131001"&gt;@andrew.tom.reynolds&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hoping that below iLogic code may help to update iProperties of &lt;STRONG&gt;"Parts Only" &lt;/STRONG&gt;BOMView.&lt;/P&gt;
&lt;PRE&gt;Sub Main()
    Dim oDoc As AssemblyDocument
    oDoc = ThisApplication.ActiveDocument
    
    Dim oDef As AssemblyComponentDefinition
    oDef = oDoc.ComponentDefinition
    
    Dim oBOMView As BOMView
    oBOMView = oDef.BOM.BOMViews.Item("Parts Only")
    
    Dim oBOMRow As BOMRow
    For Each oBOMRow In oBOMView.BOMRows
        Dim oReferDoc As Document
        oReferDoc = oBOMRow.ComponentDefinitions.Item(1).Document
        
        If oReferDoc.DocumentType = kPartDocumentObject Then
            Dim occ As ComponentOccurrence
            For Each occ In oDef.Occurrences
                If occ.ReferencedDocumentDescriptor.ReferencedDocument Is oReferDoc Then
                    If occ.Suppressed = False Then
                        iProperties.Value(occ.Name, "Project", "Part Number") = "XYZ"						
                    End If
                End If
            Next
        End If 
    Next 
End Sub&lt;/PRE&gt;
&lt;P&gt;For further investigation, please provide sample assembly file to test. Also, make sure that files are non confidential.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks and regards,&lt;/P&gt;</description>
      <pubDate>Fri, 31 Aug 2018 09:14:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-setting-iproperty-value-to-parts-only-bom-quantity/m-p/8237464#M88337</guid>
      <dc:creator>chandra.shekar.g</dc:creator>
      <dc:date>2018-08-31T09:14:11Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic - setting iProperty value to Parts Only BOM Quantity</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-setting-iproperty-value-to-parts-only-bom-quantity/m-p/8238190#M88354</link>
      <description>&lt;P&gt;This should do what you want.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Sub Main()
	
	Dim oDoc as AssemblyDocument = ThisApplication.ActiveDocument
	Dim oBom as BOM = oDoc.ComponentDefinition.BOM
	
	oBOM.PartsOnlyViewEnabled = True
	Dim oBOMView as BOMView = oBOM.BOMViews.Item("Parts Only")
		
	'assigned in loop
	Dim oRow as BOMRow
	Dim oCompDef as ComponentDefinition
	Dim oPropSet as PropertySet
	Dim pQty as Inventor.Property
	Dim oBOMDoc as Document
	
	For Each oRow In oBOMView.BOMRows 'i=1 To oBOMView.BOMRows.Count
		'oRow = oBOMView.BOMRows.Item(i)
		oCompDef  = oRow.ComponentDefinitions.Item("1")
		oBOMDoc = oCompDef.Document
		oPropSet = oBOMDoc.PropertySets.Item("Inventor User Defined Properties")
		
		Try 
			pQty = oPropSet.Item("Assy Qty")
		Catch 
			oPropSet.Add("Custom", "Assy Qty")
			pQty = oPropSet.Item("Assy Qty")
		End Try
		
		pQty.Value = oRow.TotalQuantity
		
	Next

End Sub&lt;/PRE&gt;</description>
      <pubDate>Fri, 31 Aug 2018 14:45:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-setting-iproperty-value-to-parts-only-bom-quantity/m-p/8238190#M88354</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-08-31T14:45:18Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic - setting iProperty value to Parts Only BOM Quantity</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-setting-iproperty-value-to-parts-only-bom-quantity/m-p/8242909#M88385</link>
      <description>&lt;P&gt;Thanks for your help guys, but i actually found another method that someone had posted for a similar scenario that is working well for me using 'count'.&lt;/P&gt;&lt;PRE&gt;For Each aDoc In oDoc.AllReferencedDocuments
	'Check if referenced document is a Part file. 
	If aDoc.DocumentType = kPartDocumentObject Then
		FNamePos = InStrRev(aDoc.FullFileName, "\", - 1)
		docFName = Mid(aDoc.FullFileName, FNamePos + 1, Len(aDoc.FullFileName) - FNamePos)
		iProperties.Value(docFName, "Project", "Project") = ORDER_NUMBER
		iProperties.Value(docFName, "Summary", "Company") = PROJECT	
		quantityValue = oADO.AllReferencedOccurrences(aDoc).Count
		iProperties.Value(docFName, "Summary", "Comments") = quantityValue
	End If
Next&lt;/PRE&gt;</description>
      <pubDate>Tue, 04 Sep 2018 06:34:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-setting-iproperty-value-to-parts-only-bom-quantity/m-p/8242909#M88385</guid>
      <dc:creator>andrew.tom.reynolds</dc:creator>
      <dc:date>2018-09-04T06:34:22Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic - setting iProperty value to Parts Only BOM Quantity</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-setting-iproperty-value-to-parts-only-bom-quantity/m-p/8243725#M88390</link>
      <description>&lt;P&gt;Glad you found a solution that works for you.&amp;nbsp; However, you should be aware that this code will count all occurrences, even ones that are marked phantom or reference.&amp;nbsp; If there is ever the possibility of using reference parts, you should use the BOM functions shown in my example, or filter them out in your loop.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Sep 2018 13:23:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-setting-iproperty-value-to-parts-only-bom-quantity/m-p/8243725#M88390</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-09-04T13:23:52Z</dc:date>
    </item>
  </channel>
</rss>

