Inserting Macro Features
You insert macro features into a model using IFeatureManager::InsertMacroFeature3
or IFeatureManager::IInsertMacroFeature3.
Pass the feature base name that appears in the FeatureManager design tree
as an argument to the method. Also, pass the parameters needed by the
rebuild function as arguments. These
parameters are stored with the feature and are accessible from the rebuild
function and edit definition function
through the IMacroFeatureData
interface.
Selections that are in effect when the feature is inserted are also
stored with the feature and can be used to define the feature. The feature
becomes dependent on these selections, so it is important to manage the
selection list that is in effect at the time a feature is inserted. If
an existing body is to be modified, it must be passed to the IFeatureManager::InsertMacroFeature3
or IFeatureManager::IInsertMacroFeature3method, and several options can
be specified as well.
For macro features using VBA callback functions, the names of the rebuild
and edit definition functions are passed in as well as the module and
file names in which they can be found. For macro features using COM callback
functions, the ProgId of the COM server is passed in and identifies the
rebuild and edit definition functions to associate with this feature.
A macro feature can:
Create a new body that becomes part of the model.
Modify an existing body. In this case, the edit
body passed to IFeatureManager::InsertMacroFeature3 or IFeatureManager::IInsertMacroFeature3
should be Nothing (VBA) or NULL (C++), and the rebuild function should
return the body to insert into the model.
In both cases, there is a limitation that only one body can result from
the rebuild function. For example, if a body-cut operation on an existing
body results in multiple bodies, only one body becomes part of the model;
any other bodies are lost and cause a memory leak. Always check for and
avoid this type of situation.