Share

Interface : DefaultParamInterface

The DefaultParamInterface is used to define and persist user-defined defaults for parameters in 3ds Max. If set as persistent, default values are stored in a file located in users\[username]\Autodesk\3ds Max [year]\User Settings\DefaultParameters.ini. This file can be copied to other installations and newer versions of 3ds Max to preserve the settings. Available in 3ds Max 2021.1 Update and higher. Note: For those items that have a preset system (such as the Chamfer modifier), setting default values with this interface has no effect, since the default presets always take precedence.

Methods:

    <boolean>DefaultParamInterface.IsClassCompatible <class>class <&enum>result
       result enums: {#success|#incompatibleClass|#parameterNotFound|#invalidParameterValue|#classNotFound|#iniFileWriteFailure|
                            #paramNotOverridden|#paramOverridden}
       result is Out parameter

Returns whether the specified class can have default values set for parameters. This function checks whether the class implements parameters using the C++ ClassDescriptor2 interface. The function will return either true or false, as well as either #success or #incompatibleClass in the result parameter.

Most geometry and modifiers are compatible, though there are some (such as Splines and older modifiers) that are not.

For example:

res = DefaultParamInterface.IsClassCompatible Teapot &result
format "Teapot result: % %\n" res result
res = DefaultParamInterface.IsClassCompatible Line &result
format "Line result: % %\n" res result
    <value>DefaultParamInterface.GetDefaultParamValue <class>class <string>parameterName <&enum>result
       result enums: {#success|#incompatibleClass|#parameterNotFound|#invalidParameterValue|#classNotFound|#iniFileWriteFailure|
                                                                   #paramNotOverridden|#paramOverridden}
       result is Out parameter

Gets the default value for the specified parameter parameterName for the specified class.

This method returns either the value (if found) or undefined if not, with the reason supplied in the result out parameter.

    <enum>DefaultParamInterface.SetDefaultParamValue <class>class <string>parameterName <value>defaultValue persistent:<boolean>
       SetDefaultParamValue enums: {#success|#incompatibleClass|#parameterNotFound|#invalidParameterValue|#classNotFound|
                                                                                                                           #iniFileWriteFailure|#paramNotOverridden|#paramOverridden
       persistent default value: false

Sets the default value defaultValue for the specified parameter parameterName on the specified class.

If persistent is true, default values are stored in a file located in users\[username]\Autodesk\3ds Max [year]\User Settings\DefaultParameters.ini, and persisted between 3ds Max sessions.

For example:

result = defaultParamInterface.setDefaultParamValue teapot "segs" 4 persistent:true
--> #success
    <enum>DefaultParamInterface.ClearDefaultParamValue <class>class <string>parameterName
       ClearDefaultParamValue enums: {#success|#incompatibleClass|#parameterNotFound|#invalidParameterValue|#classNotFound
                                     |#iniFileWriteFailure|#paramNotOverridden|#paramOverridden

Clears the default value setting for the specified parameter on the specified class from the ini file. Note that the user-defined default value will remain in place for the current 3ds Max session. To revert to the factory default value for the current session, use RestoreFactoryDefaultValue() (below).

    <enum>DefaultParamInterface.ClearAllDefaultParamValues <class>class
       ClearAllDefaultParamValues enums: {#success|#incompatibleClass|#parameterNotFound|#invalidParameterValue|#classNotFound|
                                          #iniFileWriteFailure|#paramNotOverridden|#paramOverridden

Clears all default value settings for the specified class from the ini file. Note that the user-defined default values will remain in place for the current 3ds Max session. To revert to the factory default values for the current session, use RestoreFactoryDefaultValue() (below).

    <enum>DefaultParamInterface.IsDefaultParamValueOverridden <class>class <string>parameterName
       IsDefaultParamValueOverridden enums: {#success|#incompatibleClass|#parameterNotFound|#invalidParameterValue|
                                             #classNotFound|#iniFileWriteFailure|#paramNotOverridden|#paramOverridden

Returns whether the specified parameter on the specified class is currently overridden.

    <enum>DefaultParamInterface.RestoreFactoryDefaultValue <class>class <string>parameterName
       RestoreFactoryDefaultValue enums: {#success|#incompatibleClass|#parameterNotFound|#invalidParameterValue|#classNotFound|
                                          #iniFileWriteFailure|#paramNotOverridden|#paramOverridden

Clears the default value setting for the specified parameter on the specified class from the ini file, and reverts to the factory default value for the current 3ds Max session.

Complete Example

--Set Box Segments to 10
result = DefaultParamInterface.SetDefaultParamValue box "LengthSegs" 10 persistent:true
result = DefaultParamInterface.SetDefaultParamValue box "WidthSegs" 10 persistent:true
result = DefaultParamInterface.SetDefaultParamValue box "HeightSegs" 10 persistent:true
--Clear Box Segment Defaults
result = DefaultParamInterface.ClearAllDefaultParamValues box
result = DefaultParamInterface.ClearDefaultParamValue box "Lengthsegs"
--Editable Poly defaults examples
result = DefaultParamInterface.SetDefaultParamValue Editable_Poly "edgeChamferSmooth" off persistent:true
result = DefaultParamInterface.SetDefaultParamValue Editable_Poly "edgeChamferSegments" 0 persistent:true
result = DefaultParamInterface.SetDefaultParamValue Editable_Poly "edgeChamferMiteringType" 2 persistent:true
result = DefaultParamInterface.SetDefaultParamValue Editable_Poly "extrusionType" 1 persistent:true
result = DefaultParamInterface.SetDefaultParamValue Editable_Poly "insetType" 1 persistent:true
result = DefaultParamInterface.SetDefaultParamValue Editable_Poly "selectMode" 1 persistent:true
result = DefaultParamInterface.SetDefaultParamValue Editable_Poly "weldThreshold" .001 persistent:true
--Edit Poly defaults examples
result = DefaultParamInterface.SetDefaultParamValue Edit_Poly "edgeChamferSmooth" off persistent:true
result = DefaultParamInterface.SetDefaultParamValue Edit_Poly "edgeChamferSegments" 0 persistent:true
result = DefaultParamInterface.SetDefaultParamValue Edit_Poly "extrudeFaceType" 1 persistent:true
result = DefaultParamInterface.SetDefaultParamValue Edit_Poly "insetType" 1 persistent:true
result = DefaultParamInterface.SetDefaultParamValue Edit_Poly "selectMode" 1 persistent:true
result = DefaultParamInterface.SetDefaultParamValue Noisemodifier "strength" [20.0, 20.0, 20.0] persistent:true
result = DefaultParamInterface.SetDefaultParamValue Noisemodifier "fractal" on persistent:true

Was this information helpful?