CustomProperty.AddParameter2

Description

Adds a new custom parameter to the custom property. This version has identical behavior to CustomProperty.AddParameter. The only different is that the arguments are rearranged with all default arguments at the end to assist JScript developers.

C# Syntax

Parameter CustomProperty.AddParameter2( String in_ScriptName, siVariantType in_ValueType, Object in_DefaultValue, Object in_Min, Object in_Max, Object in_SuggestedMin, Object in_SuggestedMax, siParamClassification in_Classif, Int32 in_Caps, String in_name, String in_LongName, String in_Guid );

Scripting Syntax

oReturn = CustomProperty.AddParameter2( ScriptName, ValueType, [DefaultValue], [Min], [Max], [SuggestedMin], [SuggestedMax], [Classification], [Capabilities], [Name], [Description], [ObsoleteArg] );

Return Value

The newly created Parameter object.

Parameters

Parameter Type Description
ScriptName String Name of the custom parameter. This argument specifies the ScriptName of a parameter and should not contain any spaces. (See Parameter.ScriptName) If the short name or long name parameters are not specified then this name is also used as the user visible name and description.
ValueType siVariantType Type of the custom parameter. The recommended types are siString, siBool, siInt4, siUByte, and siFloat. (See Parameter.ValueType)
DefaultValue Variant Default value of the custom parameter. A default value for a numerical values including boolean is 0, the string default is "". (See Parameter.Default)
Min Variant Minimum value of the custom parameter. siString and siBool types do not require a Min value. For all other numerical type the default will be minimum value possible for the type for example all unsigned values will have a min=0. (See Parameter.Min)
Max Variant Maximum value of the custom parameter. siString and siBool types do not require a Max value. For all other numerical type the default will be maximum value possible for the type for example the maximum value for siUByte is 255. (See Parameter.Max)
SuggestedMin Variant Suggested minimum value of the custom parameter. siString and siBool types do not require a SuggestedMin value. The default suggested minimum value for numerical values will be 0. The suggested minimum should be equal or larger than the minimum. This value is used to configure the range of UI controls. (See Parameter.SuggestedMin)
SuggestedMax Variant Suggested maximum value of the custom parameter. siString and siBool types do not require a SuggestedMax value. The default suggested maximum value for numerical values will be 100. The suggested maximum should be equal or smaller than the Maximum. This value is used to configure the range of UI controls. (See Parameter.SuggestedMax)
Classification siParamClassification Classification of the custom parameter.

Default Value: siClassifUnknown

Capabilities int (see Integer) Capabilities of the custom parameter. If you create a custom property parameter that is not inspectable, it will not appear in the interface, but is still available from scripting. If the parameter is read-only, it is greyed out in the interface, but is also available from scripting. The siPersistable flag optional and assumed to be enabled for all custom parameters. (See siCapabilities and Parameter.Capabilities)

Default Value: siPersistable

Name String User friendly version of the custom parameter's name. This is the parameter name that appears in in the Scene Explorer (unless Show Script Names is enabled). If this argument is not specified then the ScriptName argument will be visible to users as the parameter's name. (See SIObject.Name and Parameter.ScriptName). This string will appear as the parameter label when the custom property is inspected, unless a specific label is specified in the PPGLayout, see PPGItem.Label.

Default Value: ScriptName is used

Description String A longer description of the Parameter. This string does not appear is the user interface.

Default Value: ScriptName is used

ObsoleteArg String It is not necessary to specify this argument, it is ignored.

Default Value: ""

Examples

VBScript Example

'VBScript example : add custom parameters to a custom property
MAIN()
sub main()
	On Error Resume Next
	set oRoot = Application.ActiveProject.ActiveScene.Root
	set oSphere = oRoot.AddGeometry("Sphere","NurbsSurface")
	set oProp = oSphere.AddProperty("Custom_parameter_list",,"FirstCustomProperty")
	AddCustomParams(oProp)
	'Show a modeless dialog box with all the parameters that we have added
	InspectObj oProp
end sub
sub AddCustomParams (in_customprop)
	' String custom parameter
	set oParam1 = in_customprop.AddParameter2("StrCustomParam", siString, ,,,,,,,, "the string" )
	write_customprop oParam1
	' Boolean custom parameter
	set oParam2 = in_customprop.AddParameter2("BoolCustomParam", siBool, true, ,,,,,, "ShortName", "LongName" )
	write_customprop oParam2
	' Integer custom parameter
	set oParam3 = in_customprop.AddParameter2("Int2CustomParam", siInt2, -1, -5, 5,,, siClassifVisualization, siAnimatable, "ShortName", "LongName" )
	write_customprop oParam3
	' Double custom parameter
	set oParam4 = in_customprop.AddParameter2("DoubleCustomParam", siDouble, 0.695, 0.0123, 10.456,,,,siReadOnly, "ShortName", "LongName" )
	write_customprop oParam4
end sub
sub write_customprop(in_param)
	LogMessage "Name: " & in_param.Name
	LogMessage "Class: " & typename(in_param)
	LogMessage "Type: " & in_param.Type
	LogMessage "Fullname: " & in_param.FullName
	LogMessage "Parent: " & in_param.Parent.Name
	LogMessage "ScriptName : " & in_param.ScriptName
	LogMessage "Description: " & in_param.Description
	LogMessage "Capabilities : " & in_param.Capabilities
	LogMessage "Value : " & in_param.Value
	LogMessage "ValueType: " & in_param.ValueType
	LogMessage "Default: " & in_param.Default
	if ( in_param.ValueType <> siString ) then 
		LogMessage "Min: " & in_param.Min
		LogMessage "Max: " & in_param.Max
		LogMessage "SuggestedMin: " & in_param.SuggestedMin
		LogMessage "SuggestedMax: " & in_param.SuggestedMax
	end if 
end sub

See Also

CustomProperty,CustomProperty.AddParameter,Parameter