01-23-2017
11:29 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
01-23-2017
11:29 AM
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