Hide Table of Contents
CreateInstance5 Method (IAttributeDef)

Creates an instance of this attribute on the specified object with the specified options.

.NET Syntax

Visual Basic (Declaration) 
Function CreateInstance5( _
   ByVal OwnerDoc As ModelDoc2, _
   ByVal OwnerObj As System.Object, _
   ByVal NameIn As System.String, _
   ByVal Options As System.Integer, _
   ByVal ConfigurationOption As System.Integer _
) As Attribute
Visual Basic (Usage) 
Dim instance As IAttributeDef
Dim OwnerDoc As ModelDoc2
Dim OwnerObj As System.Object
Dim NameIn As System.String
Dim Options As System.Integer
Dim ConfigurationOption As System.Integer
Dim value As Attribute
 
value = instance.CreateInstance5(OwnerDoc, OwnerObj, NameIn, Options, ConfigurationOption)
C# 
Attribute CreateInstance5( 
   ModelDoc2 OwnerDoc,
   System.object OwnerObj,
   System.string NameIn,
   System.int Options,
   System.int ConfigurationOption
)
C++/CLI 
Attribute^ CreateInstance5( 
&   ModelDoc2^ OwnerDoc,
&   System.Object^ OwnerObj,
&   System.String^ NameIn,
&   System.int Options,
&   System.int ConfigurationOption
) 

Parameters

OwnerDoc
Document whose FeatureManager design tree to which to add this attribute
OwnerObj

Component or entity to which to add this attribute:

NameIn
Name to assign to this attribute instance (see Remarks)
Options
Creation control options (see Remarks)
ConfigurationOption
Configuration options as defined in swInConfigurationOpts_e

Return Value

Newly created IAttribute object

Example

Remarks

When you add an attribute to a feature, the FeatureManager design tree might not reflect the new state of the model. This discrepancy exists for performance reasons (rebuilding the FeatureManager design tree is very time-consuming). You can request a rebuild after you have added a number of attributes to save time.

The attribute is created as a feature and displayed in the FeatureManager design tree, which means that the name specified in nameIn must be unique in the FeatureManager design tree for the document.

You can create attributes on entity objects such as faces and edges, on features, or on the document itself. Do not use this method to set an attribute to or get an attribute from an assembly body. Instead, use IFace2::SetFaceId or IFace2::GetFaceId to set or get the attribute.

Setting or clearing bits in the options argument controls the creation of the attribute:

 

Bit Value Meaning

1

1

Attribute is created hidden in the FeatureManager design tree (see IFeature::SetUIState)

1

0

Attribute is created visible in the FeatureManager design tree

For example, options = 1 creates an attribute that is hidden in the FeatureManager design tree.

NOTE: By default, SolidWorks adds attributes only to the active configuration. SolidWorks adds the attribute to all other configurations as a suppressed feature. You can unsuppress the attribute by selecting it with IModelDocExtension::SelectByID2 and calling IModelDoc2::EditUnsuppressDependent2. If you want to add your attributes to a non-active configuration, then the user must edit the properties of that particular configuration and make sure that the Suppress New Features option is disabled.

If you add an attribute to an entity, SolidWorks strips the attribute feature from the entity if the entity is included in your export to a library feature or library feature part. See the SolidWorks Help for more information about library features.

NOTE: An attribute is a feature; thus, this method respects the IConfiguration::SuppressNewFeatures setting.

 

See Also

Availability

SolidWorks 2003 SP1, Revision Number 11.1


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:   CreateInstance5 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) 2014 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.