Using attributes in SOLIDWORKS API to store data and selections

Edit ArticleEdit Article

Attribute feature
Attribute feature

Attributes are special features which can be inserted via IAttributeDef::CreateInstance5 SOLIDWORKS API method. Although attributes are native features available and visible (optionally) in the Feature Manager Tree, they cannot be inserted or edited (only deleted) via regular user interface and only accessible via API.

Attribute instance is created from the attribute definition. Software which will be utilizing attribute should define its definition via ISldWorks::DefineAttribute SOLIDWORKS API method.


  • Attributes can be associated with an selectable object (body, component, face, edge, vertex, loop or feature)
  • Attributes can store parameters
  • Attributes can be hidden in the Feature Tree

Refer the examples from under the Attributes section for more information about usage of attributes.


All articles and code at CodeStack are now open-source and hosted on GitHub. If you want to contribute by modifying existing articles and code snippets, submitting new ones, reporting errors and bugs etc. please follow this blog post for more information. We appreciate any contribution.

Product of Xarial Product of Xarial