Hide Table of Contents
AddParameter Method (IAttributeDef)

Adds a parameter to the attribute definition using the specified name and default value.

.NET Syntax

Visual Basic (Declaration) 
Function AddParameter( _
   ByVal NameIn As System.String, _
   ByVal Type As System.Integer, _
   ByVal DefaultValue As System.Double, _
   ByVal Options As System.Integer _
) As System.Boolean
Visual Basic (Usage) 
Dim instance As IAttributeDef
Dim NameIn As System.String
Dim Type As System.Integer
Dim DefaultValue As System.Double
Dim Options As System.Integer
Dim value As System.Boolean
value = instance.AddParameter(NameIn, Type, DefaultValue, Options)
System.bool AddParameter( 
   System.string NameIn,
   System.int Type,
   System.double DefaultValue,
   System.int Options
System.bool AddParameter( 
&   System.String^ NameIn,
&   System.int Type,
&   System.double DefaultValue,
&   System.int Options


Name to be given to the parameter (see Remarks)
Parameter type as defined in swParamType_e
Default value (see Remarks)
Not used

Return Value

True if the parameter is added successfully, false if not



Parameters cannot be added after the attribute definition is registered.

The name of the parameter given by NameIn must be unique in the attribute definition.

For parameters of type swParamTypeDouble, the DefaultValue argument allows a default value to be placed in the attribute definition parameter. This value is assigned to the parameters of newly created attribute instances.

NOTE: There is no way to get or set integer parameters in attributes. Instead, use IParameter::GetDoubleValue and IParameter::SetDoubleValue2 to get and set values for integer parameters. If you need to store a negative value, define your attribute parameter as type double. SOLIDWORKS does not allow negative integer values.


See Also

Provide feedback on this topic

SOLIDWORKS welcomes your feedback concerning the presentation, accuracy, and thoroughness of the documentation. Use the form below to send your comments and suggestions about this topic directly to our documentation team. The documentation team cannot answer technical support questions. Click here for information about technical support.

* Required

Subject:   Feedback on Help Topics
Page:   AddParameter Method (IAttributeDef)
*   I acknowledge I have read and I hereby accept the privacy policy under which my Personal Data will be used by Dassault Systèmes

Print Topic

Select the scope of content to print:


We have detected you are using a browser version older than Internet Explorer 7. For optimized display, we suggest upgrading your browser to Internet Explorer 7 or newer.

 Never show this message again

Web Help Content Version: API Help (English only) 2019 SP05

To disable Web help from within SOLIDWORKS and use local help instead, click Help > Use SOLIDWORKS Web Help.

To report problems encountered with the Web help interface and search, contact your local support representative. To provide feedback on individual help topics, use the “Feedback on this topic” link on the individual topic page.