Message 1 of 5
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm working on an external rule to add and format a set of parameters to all parts within an assembly.
I'm trying to check if the parameter exists then add and format if it doesn't.
I've found a few examples and unsuccessfully tried to piece something together.
The attached code runs without error, but it doesn't affect the parts in the assembly. It does nothing.
Suggestions?
Dim oAssDoc As AssemblyDocument = ThisDoc.Document Dim oDoc As Document For Each oDoc In oAssDoc.AllReferencedDocuments If oDoc.DocumentType = DocumentTypeEnum.kPartDocumentObject Then Dim oParams As Inventor.Parameters = oDoc.ComponentDefinition.Parameters Dim oUserParams As UserParameters = oParams.UserParameters oMyParameter = oUserParams Try 'Try to Change value Of param Parameter("RMCat") = Parameter("RMCat") Catch 'Create Param as it doesn't exist oParameter = oMyParameter.AddByValue("RMCat", "Plate-Sheet", UnitsTypeEnum.kTextUnits) MultiValue.SetList("RMCat", "Plate-Sheet", "Check Plate", "Round", "Tube", "Rubber", "None") Parameter.Param("RMCat").Comment = "Raw Material Category" End Try End If Next
Dewayne
Inventor Pro 2023
Vault Pro 2023
Inventor Pro 2023
Vault Pro 2023
Solved! Go to Solution.