None of the standard/installed iLogic 'snippets' will actually 'create' a new parameter, if it does not already exist. That is generally done using Inventor API code, since there are no iLogic shortcut snippets for that task. But there are several different types of parameters, and multiple different types of units that a parameter can have, and some can have a list of possible values to choose from. So, there are two main methods used for creating them.
UserParameters.AddByExpression
UserParameters.AddByValue
Which one is right for a specific situation depends on what units you want it to have, and how you need to define its value/expression. If it is going to have an 'equation' in its 'expression', or refer to the name of another parameter, then you will need to use the AddByExpression method. Otherwise you can usually use the AddByValue method. Below is just one possible example code that is designed to work for any type of document. Parts, assemblies, and drawings can all have parameters, but they are differently, depending on the document type you are working with. Not only that, but when using Inventor's API to create parameters, you have to keep units conversion in mind. Because all 'raw numbers' in a rule, that are supposed to represent any type of 'measurement' value, will be understood as 'database units'. For length/distance that is centimeters, for angles that is radians, and so on, no matter what units your document is set to.
Dim oDoc As Document = ThisDoc.Document
Dim oUParams As UserParameters = Nothing
If (TypeOf oDoc Is AssemblyDocument) OrElse (TypeOf oDoc Is PartDocument) Then
oUParams = oDoc.ComponentDefinition.Parameters.UserParameters
ElseIf TypeOf oDoc Is DrawingDocument Then
oUParams = oDoc.Parameters.UserParameters
End If
If oUParams Is Nothing Then Return
Dim sParamName As String = "MyParam1"
Dim oParamValue As Double = 15.125
Dim oUParam As UserParameter = Nothing
Try
oUParam = oUParams.Item(sParamName)
Catch
oUParam = oUParams.AddByValue(sParamName, oParamValue, UnitsTypeEnum.kInchLengthUnits)
End Try
If oUParam.Value <> oParamValue Then
Try
oUParam.Value = oParamValue
Catch
'what to do if setting its value fails
End Try
End If
The only 'iLogic' in that example is the 'ThisDoc.Document' phrase used in the first line. All the rest is Inventor API.
This example does not include exposing the parameter to create a custom iProperty, but that is also done using additional Inventor API code.
UserParameter.IsKey
UserParameter.ExposedAsProperty
After the above property is set to True for that UserParameter, then you will be able to access the following property, and the properties of the object types it returns. The below line exposes all the additional possible settings you can see within the Format Custom Properties type dialog.
UserParameter.CustomPropertyFormat
CustomPropertyFormat object
...and so on
Wesley Crihfield

(Not an Autodesk Employee)