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 String, _
   ByVal Type As Integer, _
   ByVal DefaultValue As Double, _
   ByVal Options As Integer _
) As Boolean
Visual Basic (Usage) 
Dim instance As IAttributeDef
Dim NameIn As String
Dim Type As Integer
Dim DefaultValue As Double
Dim Options As Integer
Dim value As Boolean
 
value = instance.AddParameter(NameIn, Type, DefaultValue, Options)
C# 
bool AddParameter( 
   string NameIn,
   int Type,
   double DefaultValue,
   int Options
)
C++/CLI 
bool AddParameter( 
&   String^ NameIn,
&   int Type,
&   double DefaultValue,
&   int Options
) 

Parameters

NameIn
Name to be given to the parameter (see Remarks)
Type
Parameter type as defined in swParam_Type_e
DefaultValue
Default value (see Remarks)
Options
Not used

Return Value

True if the parameter is added successfully, false if not

Example

Remarks

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

 
*Email:  
Subject:   Feedback on Help Topics
Page:   AddParameter Method (IAttributeDef)
*Comment:  
*   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:




x

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
x

Web Help Content Version: API Help (English only) 2012 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.