Message 1 of 4
Replace content center parts with other material

Not applicable
03-13-2018
06:43 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I would like to extend the functionality of a rule I'm currently using to change the material of all parts within an assembly.
The multivalue list of materials consists of Stainless Steel 304, Stainless Steel 316 & Steel, Mild
This is my rule:
oDoc = ThisApplication.ActiveDocument If oDoc.DocumentType <> Inventor.DocumentTypeEnum.kAssemblyDocumentObject Then MessageBox.Show("This rule can only be run in an Assembly file - exiting rule...", "Rule Error") Return End If Dim oAsmDef As AssemblyComponentDefinition oAsmDef = oDoc.ComponentDefinition oBOM = oAsmDef.BOM ' Make sure that the PartOnly view is enabled. oBOM.PartsOnlyViewEnabled = True oBOMRows = oBOM.BOMViews.Item("Parts Only").BOMRows
Dim oMaterial As Material Try oMaterial = oDoc.Materials.Item(MATERIAL) Catch MsgBox("Unable to find material " & MATERIAL) Return End Try values = MultiValue.List("MATERIAL") For Each oRow As BOMRow In oBOMRows oRowCompDef = oRow.ComponentDefinitions.Item(1) If oRowCompDef.isContentMember Then Continue For If values.Contains(oRowCompDef.Material.Name) Then Dim oPartCompDef As PartComponentDefinition = oRowCompDef oPartCompDef.Material = oMaterial End IF Next iLogicVb.UpdateWhenDone = True
I'd like to modify it to replace any content center fasteners with their counterpart of different material.
For example, if I change from Stainless Steel 304 to Stainless Steel 316, I would like to replace all FSL HEX BOLT SS304 M8 x 25 with FSL HEX BOLT SS316 M8 x 25
Can anyone tell me if this is possible?