Life cycle of SOLIDWORKS macro feature

Edit ArticleEdit Article

Macro feature resides in the model and saved together with the document. Macro feature can handle various events during its lifecycle

  • Regeneration. Override OnRebuild method to handle this event.
  • Editing. Override OnEditDefinition method to handle this event.
  • Updating state. Override OnUpdateState method to handle this event.

Macro feature is a singleton service. Do not create any class level variables in the macro feature class. If it is required to track the lifecycle of particular macro feature use Feature Handler


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