SwEx.MacroFeature - advanced framework for SOLIDWORKS macro feature

Edit ArticleEdit Article

SwEx.MacroFeature framework for SOLIDWORKS
SwEx.MacroFeature framework for SOLIDWORKS

SwEx.MacroFeature provides utilities for simplified development of SOLIDWORKS macro features based on the data model.

Source code is available on GitHub

What is macro feature?

Macro feature is a custom element which could be added into Feature Manager Design tree using SOLIDWORKS API. This element will behave in exactly the same way as any other standard feature (e.g. Boss-Extrude, Move-Copy Body, Mate, etc.)

Macro feature in the feature manager tree
Macro feature in the feature manager tree

Macro feature supports parametric nature of SOLIDWORKS and could regenerate if any of the parents changed.

Macro feature provides 3 main handlers

  • Regeneration - called when feature is rebuilt (either as a result of model force rebuild operation or as a result of the updated of any of the dependencies). Macro feature can create new body or bodies or be only a metadata element.
  • Edit - called when feature definition is requested to be edited by the user
  • State update - called every time state is updated (i.e. feature is selected, refreshed etc.)

Macro feature can store additional metadata parameters (including dimensions and selection references).


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