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

Apologies, I made a bit of a mistake in that code though I'm still getting the same error. Here is the updated code.

 

Sub Main()

	Dim oAsmDoc as AssemblyDocument = ThisDoc.Document  
	Dim oAsmCompDef As ComponentDefinition  
	oAsmCompDef = oAsmDoc.ComponentDefinition 
	
    Dim oCustomParamGroup As CustomParameterGroup
    oCustomParamGroup = oAsmCompDef.Parameters.CustomParameterGroups.Add("Custom Group", "Rafters")
    
	Dim oUserParam As UserParameter
    oUserParam = ParaExist("Rafters")
	
    oCustomParamGroup.Add(oUserParam)
End Sub

'The ParaExist function returns the parameter with the name passed to it.
Function ParaExist(sName)
	
	Dim oDoc As AssemblyDocument
	oDoc = ThisDoc.Document
	
	Dim oCompDef As AssemblyComponentDefinition
	oCompDef = oDoc.ComponentDefinition
	
	For i = 1 To oCompDef.Parameters.Count
	
		If oCompDef.Parameters(i).Name = sName
			ParaExist = oCompDef.Parameter(i)
			Exit For
		End If
	Next
End Function