Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

try this:

 

 

 

 Sub Main()

Dim oAsmDoc As AssemblyDocument = ThisDoc.Document

Dim oAsmCompDef As AssemblyComponentDefinition = Nothing

oAsmCompDef = oAsmDoc.ComponentDefinition

Dim oCustomParamGroup As CustomParameterGroup = Nothing

Try

oCustomParamGroup = oAsmCompDef.Parameters.CustomParameterGroups.Add("Category name", "Category name")

Catch ex As Exception
'it probably already exists
oCustomParamGroup = oAsmCompDef.Parameters.CustomParameterGroups("Category name")
End Try

'enter existing parameter name, and copy the line for more parameters

Dim oExistingParam As Inventor.Parameter = GetExistingParam(oAsmDoc, "Length")
'add parameter
oCustomParamGroup.Add(oExistingParam)

Dim oExistingParam1 As Inventor.Parameter = GetExistingParam(oAsmDoc, "Width")
'add parameter
oCustomParamGroup.Add(oExistingParam1)

 End Sub

 

Private Function GetExistingParam(ByVal oAssydoc As Inventor.AssemblyDocument, oParamName As String) As Inventor.Parameter

Dim oParam As Inventor.Parameter = Nothing

For Each oParam In oAssydoc.ComponentDefinition.Parameters

If oParam.Name = oParamName Then

Return oParam

End If

Next

Return Nothing

End Function

 

 

 

put it all in one iLogic rule

If this answers your question then please select "Accept as Solution"
Kudo's are also appreciated Smiley Wink

Succes on your project, and have a nice day

Herm Jan