How to include a macro in the model tree

Hi everybody,

I wrote a simple macro to merge all solid bodies present in a part, I would like to include it in the model tree, so that it is executed exactly after certain features and before others. I cannot find the "Macrofeature" entry in any menu.

Thank you very much for your help

SolidworksApi macros
Answers 4
SF
SF 2017-09-06 Best Answer

Here are a couple articles from the API Help that I hope you find useful:

2017 SOLIDWORKS API Help - Creating Macro Features

2017 SOLIDWORKS API Help - Inserting Macro Features

JC
JC 2017-09-06

IFeatureManager::InsertMacroFeature3

This can be A Embeded macro file that Is written in VBA

or a COMServer based one that is controlled by an addin.

MacroFeatures are the most powerful thing in solidworks in my opinion.

since you are using macros currently you will want to use the VBA method

start with this macrofeature code

its a pain to get started with for the first time so ask questions as you start to develop this.

use the above template for formatting purposes.

SM
SM 2017-09-07

Thank you everyone for the suggestions.I will try it out.

SM
SM 2017-09-11

I could manage to do it.

This document is very useful, especially the empty macrofeature code.

It contains also a very helpful presentation about Macrofeatures