<?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: BOM materials changing in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/bom-materials-changing/m-p/6398048#M64883</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any&amp;nbsp; alternate preferably in iLogic for changing the materials in an iassembly. It shouldn't replace the materials for all the parts except the applicable parts. For eg, It should replace "Aluminium" in place of "Steel". It shouldn't&amp;nbsp;change the other parts with different materials like "Rubber" etc.,&lt;/P&gt;</description>
    <pubDate>Wed, 22 Jun 2016 13:58:30 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2016-06-22T13:58:30Z</dc:date>
    <item>
      <title>BOM materials changing</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/bom-materials-changing/m-p/6389030#M64748</link>
      <description>&lt;P&gt;Is there any way to change the materials in BOM either preferably in iLogic or in API? it should change material&amp;nbsp;of&amp;nbsp;all the applicable&amp;nbsp;parts in an assembly. eg., Requirement is to replace the all parts with "Steel" to "Aliminium".&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jun 2016 06:19:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/bom-materials-changing/m-p/6389030#M64748</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-06-17T06:19:06Z</dc:date>
    </item>
    <item>
      <title>Re: BOM materials changing</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/bom-materials-changing/m-p/6389305#M64753</link>
      <description>&lt;P&gt;Here in VBA. This will change material for all parts also in sub-assemblies. Material has to&amp;nbsp;exist in material library.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dim oApp As Inventor.Application&lt;BR /&gt;Set oApp = ThisApplication&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dim oDoc As AssemblyDocument&lt;BR /&gt;Set oDoc = ThisApplication.ActiveDocument&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dim strMaterialName As String&lt;BR /&gt;strMaterialName = "Aluminium"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dim oOcc As ComponentOccurrence&lt;BR /&gt;For Each oOcc In oDoc.ComponentDefinition.Occurrences.AllLeafOccurrences&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;oOcc.Definition.Material = oDoc.Materials.Item(strMaterialName)&lt;BR /&gt;Next&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jun 2016 09:50:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/bom-materials-changing/m-p/6389305#M64753</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-06-17T09:50:41Z</dc:date>
    </item>
    <item>
      <title>Re: BOM materials changing</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/bom-materials-changing/m-p/6398020#M64881</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Some Error comes in the Red line&amp;nbsp; &lt;STRONG&gt;Method 'Material' of object 'PartComponentDefinition' failed&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Private Sub CommandButton2_Click()&lt;BR /&gt;Dim oApp As Inventor.Application&lt;BR /&gt;Set oApp = ThisApplication&lt;/P&gt;&lt;P&gt;Dim oDoc As AssemblyDocument&lt;BR /&gt;Set oDoc = ThisApplication.ActiveDocument&lt;/P&gt;&lt;P&gt;Dim strMaterialName As String&lt;BR /&gt;strMaterialName = "1.4307"&lt;/P&gt;&lt;P&gt;Dim oOcc As ComponentOccurrence&lt;BR /&gt;For Each oOcc In oDoc.ComponentDefinition.Occurrences.AllLeafOccurrences&lt;BR /&gt;&lt;FONT color="#ff0000"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;oOcc.Definition.Material = oDoc.Materials.Item(strMaterialName)&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;Next&lt;/P&gt;&lt;P&gt;End Sub&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jun 2016 13:51:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/bom-materials-changing/m-p/6398020#M64881</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-06-22T13:51:51Z</dc:date>
    </item>
    <item>
      <title>Re: BOM materials changing</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/bom-materials-changing/m-p/6398048#M64883</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any&amp;nbsp; alternate preferably in iLogic for changing the materials in an iassembly. It shouldn't replace the materials for all the parts except the applicable parts. For eg, It should replace "Aluminium" in place of "Steel". It shouldn't&amp;nbsp;change the other parts with different materials like "Rubber" etc.,&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jun 2016 13:58:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/bom-materials-changing/m-p/6398048#M64883</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-06-22T13:58:30Z</dc:date>
    </item>
    <item>
      <title>Re: BOM materials changing</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/bom-materials-changing/m-p/6398564#M64898</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;You can put there condition if material name is "steel" then change material.&lt;BR /&gt;&lt;BR /&gt;To error you got: Do you have material named 1.4307 on your material library?&lt;BR /&gt;&lt;BR /&gt;You can translate vba to ilogic quite easy, just take "set" off from lines. Also "on error resume next is not supported in ilogic, but you can use try-catch-method instead.&lt;BR /&gt;&lt;BR /&gt;It would be also good to put condition that checks that part is not content center component. Through api material can be chaged to library components also...even though it should not be possible.&lt;BR /&gt;&lt;BR /&gt;I haven't used iassemblies very much so I can't answer to this issue.</description>
      <pubDate>Wed, 22 Jun 2016 17:31:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/bom-materials-changing/m-p/6398564#M64898</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-06-22T17:31:41Z</dc:date>
    </item>
    <item>
      <title>Re: BOM materials changing</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/bom-materials-changing/m-p/6407546#M65036</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Thanks. As I'm new to this iLogic I don't know how write the condition. this code simply puts the material in all occurrences without caring about its previous material. My requirement is to have a conditional replacement like "Steel" in place of "Aluminium".&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jun 2016 06:42:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/bom-materials-changing/m-p/6407546#M65036</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-06-28T06:42:39Z</dc:date>
    </item>
    <item>
      <title>Re: BOM materials changing</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/bom-materials-changing/m-p/6407693#M65044</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here in VBA. This changes material for each&amp;nbsp;component if material is "Aluminium" to "Steel". You can modify your code from this. This also skips standard content center components.Material will be changed for custom content center components.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Dim oApp As Inventor.Application&lt;BR /&gt;Set oApp = ThisApplication&lt;/P&gt;&lt;P&gt;Dim oDoc As AssemblyDocument&lt;BR /&gt;Set oDoc = ThisApplication.ActiveDocument&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Dim strMaterialNameToChange As String&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;strMaterialNameToChange = "Aluminium"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dim strNewMaterialName As String&lt;BR /&gt;strNewMaterialName = "Steel"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dim oOcc As ComponentOccurrence&lt;BR /&gt;For Each oOcc In oDoc.ComponentDefinition.Occurrences.AllLeafOccurrences&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;If oOcc.Definition.Material.name = strMaterialNameToChange And oOcc.Definition.IsContentMember = False Then&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;oOcc.Definition.Material = oDoc.Materials.Item(strNewMaterialName)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;End If&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;Next&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jun 2016 08:48:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/bom-materials-changing/m-p/6407693#M65044</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-06-28T08:48:21Z</dc:date>
    </item>
    <item>
      <title>Re: BOM materials changing</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/bom-materials-changing/m-p/6408322#M65054</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There is a problem in this red&amp;nbsp;line.. It simply closes the Inventor without changing any material.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dim oApp As Inventor.Application&lt;BR /&gt;Set oApp = ThisApplication&lt;/P&gt;&lt;P&gt;Dim oDoc As AssemblyDocument&lt;BR /&gt;Set oDoc = ThisApplication.ActiveDocument&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Dim strMaterialNameToChange As String&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;strMaterialNameToChange = "Aluminium"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dim strNewMaterialName As String&lt;BR /&gt;strNewMaterialName = "Steel"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dim oOcc As ComponentOccurrence&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT color="#ff0000"&gt;For Each oOcc In oDoc.ComponentDefinition.Occurrences.AllLeafOccurr​ences&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;If oOcc.Definition.Material.name = strMaterialNameToChange And oOcc.Definition.IsContentMember = False Then&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;oOcc.Definition.Material = oDoc.Materials.Item(strNewMaterialName)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;End If&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;Next&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;I don't know the exact issue. but, Do I need to include any object library? &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;Sukpal&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jun 2016 14:22:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/bom-materials-changing/m-p/6408322#M65054</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-06-28T14:22:15Z</dc:date>
    </item>
    <item>
      <title>Re: BOM materials changing</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/bom-materials-changing/m-p/6409814#M65082</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;No need for any extra object library.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have used this kind of loop in many cases and never had problem like that. Is your assembly weldment assembly? Or did you try with other assemblies just in case that there's something wrong with iam you tried??&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jun 2016 04:52:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/bom-materials-changing/m-p/6409814#M65082</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-06-29T04:52:45Z</dc:date>
    </item>
    <item>
      <title>Re: BOM materials changing</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/bom-materials-changing/m-p/6410527#M65094</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Excellent code. It's working in other assembly. Many thanks..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One more help needed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can it be converted in to iLogic?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried the same code(Removing 'Set' Property). but here it gives some error&amp;nbsp;like "End of Statement expected". It would be much better if it works in iLogic as well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sukpal&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jun 2016 13:08:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/bom-materials-changing/m-p/6410527#M65094</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-06-29T13:08:13Z</dc:date>
    </item>
    <item>
      <title>Re: BOM materials changing</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/bom-materials-changing/m-p/6411193#M65109</link>
      <description>&lt;P&gt;The code below seems to work fine with an assembly file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Sub Main()

Dim oApp As Inventor.Application
oApp = ThisApplication

If ThisApplication.ActiveDocumentType &amp;lt;&amp;gt; kAssemblyDocumentObject Then
	MessageBox.Show("ERROR - Active Document is not an assembly document!","iLogic Error")
	Exit Sub
End If

Dim oDoc As AssemblyDocument
oDoc = ThisApplication.ActiveDocument
MessageBox.Show("ASSEMBLY DOCUMENT!","iLogic Debug")

Dim strMaterialNameToChange As String
strMaterialNameToChange = "Aluminium"

Dim strNewMaterialName As String
strNewMaterialName = "Steel"

Dim oOcc As ComponentOccurrence
For Each oOcc In oDoc.ComponentDefinition.Occurrences.AllLeafOccurrences
   If oOcc.Definition.Material.Name = strMaterialNameToChange And oOcc.Definition.IsContentMember = False Then
         oOcc.Definition.Material = oDoc.Materials.Item(strNewMaterialName)
   End If
Next

End Sub&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jun 2016 17:39:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/bom-materials-changing/m-p/6411193#M65109</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-06-29T17:39:21Z</dc:date>
    </item>
    <item>
      <title>Re: BOM materials changing</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/bom-materials-changing/m-p/6412000#M65116</link>
      <description>&lt;P&gt;Sukpal,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;From iLogic Rule editor: Options tab-&amp;gt; put tab in Straight VB Code&lt;/P&gt;&lt;P&gt;Then it works.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jun 2016 04:39:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/bom-materials-changing/m-p/6412000#M65116</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-06-30T04:39:08Z</dc:date>
    </item>
    <item>
      <title>Re: BOM materials changing</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/bom-materials-changing/m-p/6412060#M65117</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunately it's not working for me. gives the same error in iLogic. "End of statement expected" in the below line.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;For Each oOcc In oDoc.ComponentDefinition.Occurrences.AllLeafOccurr​ences&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;Sukpal&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jun 2016 05:47:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/bom-materials-changing/m-p/6412060#M65117</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-06-30T05:47:21Z</dc:date>
    </item>
    <item>
      <title>Re: BOM materials changing</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/bom-materials-changing/m-p/6412073#M65118</link>
      <description>&lt;P&gt;Hi Asikainen,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For me it's not working unfortunately. It gives error in all lines now. &lt;img id="smileyembarrassed" class="emoticon emoticon-smileyembarrassed" src="https://forums.autodesk.com/i/smilies/16x16_smiley-embarrassed.png" alt="Smiley Embarassed" title="Smiley Embarassed" /&gt; previously I had only one error in the below line&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"For Each oOcc In oDoc.ComponentDefinition.Occurrences.AllLeafOccurrences" that End of statement expected.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;Sukpal&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jun 2016 05:58:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/bom-materials-changing/m-p/6412073#M65118</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-06-30T05:58:36Z</dc:date>
    </item>
    <item>
      <title>Re: BOM materials changing</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/bom-materials-changing/m-p/6412629#M65128</link>
      <description>What version of Inventor? Inventor 2015 or ?</description>
      <pubDate>Thu, 30 Jun 2016 13:07:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/bom-materials-changing/m-p/6412629#M65128</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-06-30T13:07:29Z</dc:date>
    </item>
    <item>
      <title>Re: BOM materials changing</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/bom-materials-changing/m-p/6414557#M65155</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes dear Yosso. Inventor 2015 only.&amp;nbsp;But I think I may need to include some object library. Please give some solution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;Sukpal&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jul 2016 10:04:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/bom-materials-changing/m-p/6414557#M65155</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-07-01T10:04:15Z</dc:date>
    </item>
    <item>
      <title>Re: BOM materials changing</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/bom-materials-changing/m-p/6419396#M65216</link>
      <description>&lt;P&gt;The iLogic code seems to work w/o issues.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="http://adndevblog.typepad.com/manufacturing/2013/07/inventor-2014-api-set-part-material.html" target="_blank"&gt;http://adndevblog.typepad.com/manufacturing/2013/07/inventor-2014-api-set-part-material.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Sub Main()

Dim i As Integer
Dim oApp As Inventor.Application
oApp = ThisApplication

If ThisApplication.ActiveDocumentType &amp;lt;&amp;gt; kAssemblyDocumentObject Then
    MessageBox.Show("Active document is NOT an assembly document!","DEBUG ME")
    Exit Sub
End If

Dim oDoc As AssemblyDocument
oDoc = ThisApplication.ActiveDocument

Dim strMaterialNameToChange As String
strMaterialNameToChange = "Aluminum 6061"

Dim strNewMaterialName As String
strNewMaterialName =  "Steel, Galvanized" '"Aluminum 6061"

Dim oMat As Asset

' MessageBox.Show("ASSEMBLY DOCUMENT!","iLogic Debug")

Dim oOcc As ComponentOccurrence
Dim oPartDoc As PartDocument
Dim newMat As Asset

For Each oOcc In oDoc.ComponentDefinition.Occurrences.AllLeafOccurrences
    oPartDoc = oOcc.Definition.Document
    
   For i = 1 To oPartDoc.Assets.Count
       If oPartDoc.Assets.Item(i).DisplayName = strNewMaterialName Then
           oMat = oPartDoc.Assets.Item(i)
           bMatFound = True
           ' MessageBox.Show("MATERIAL FOUND!","iLogic Debug")
           Exit For
       End If
   Next i
    
    If oPartDoc.ActiveMaterial.DisplayName = strMaterialNameToChange And oOcc.Definition.IsContentMember = False Then
        ' MessageBox.Show("IN if/then","iLogic Debug")
        oPartDoc.ActiveMaterial = oMat
    End If
    
Next

Call oDoc.BrowserPanes.ActivePane.TopNode.DoSelect
 
End Sub&lt;/PRE&gt;</description>
      <pubDate>Tue, 05 Jul 2016 13:07:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/bom-materials-changing/m-p/6419396#M65216</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-07-05T13:07:07Z</dc:date>
    </item>
  </channel>
</rss>

