AnsweredAssumed Answered

Feature References in a Macrofeature

Question asked by Alexander Schaaf on Aug 13, 2020
Latest reply on Aug 13, 2020 by Alexander Schaaf


I'm using Solidworks 2018 SP5 and a VB.NET Solidworks AddIn to create a macrofeature that is using the following callchain:

First I obtain the current body in the model using


Then I'm selecting two sketches programatically using 


Where the profile gets selection mark 1 and path gets selection mark 4

Then I'm inserting the macrofeature using


The selections and editbodies get correctly written and the macrofeature is being created.


Now during my Rebuild method the following happens:

  1. MacrofeatureData object is accessed and selections are being made using ISelectionMgr::SuspendSelectionList and ISelectionMgr::AddSelectionListObject
  2. Swept body is being created using IModeler::CreateSweptBody
  3. SweptBody is being cut from InputBody using the Macrofeature Body obtained from IMacroFeatureData::EditBodies and then using IBody2::Operations2 with SWBODYCUT option
  4. UserIDs are assigned using GetEntitiesNeedUserId as shown in API example
  5. Modified body is returned by Rebuild function


Now my problem is, that the references of the Feature contain EVERY feature in the design tree that modified the body before

I don't want these references! I was also able to reproduce this issue with the macrofeature from API Help:

2018 SOLIDWORKS API Help - Cut Body in Half using Macro Feature Example (VBA) 

Is there any way I can remove those references? My Macrofeature is basically a modified version of a simple Swept Cut feature. The basic swept cut feature does not even have a input body reference: 2018 SOLIDWORKS API Help - ISweepFeatureData Interface Members 


I already tried to remove the input body as reference in the macrofeaturedata object and obtain the current body during the rebuild method, but the references on the other features remain. I seems like, as soon as I modify an input body, every feature that has modified the body before is referenced.


Any Help and Ideas are appreciated!


Thanks in Advance