Hi @RyanRausch. Below is an example of an iLogic rule you could potentially used to delete the extrusion that the other rule created. Since I did not include a line in the last code to give that extrusion feature a specific name, I decided to attempt to find that same extrude feature a different way in the example below. I am finding it by looping through each possible extrude feature, and checking if the profile that it was it was based on originated from the same named sketch that we used in the first rule. The line of code starting with "oEF.Delete" is where the action is. That is where you can specify which aspects of the feature you want to attempt to preserve when deleting it. The first input True is to retain the consumed sketch. The second input True is to attempt to retain dependent features and sketches. (Those are the ones that may have been created after that feature existed, and are based on that feature somehow, so they are dependent on it. Usually it would not be a good idea to attempt to keep those, and if you do, you may have to fix them.) Then the third input True is to retain dependent work features. For example, if that feature created a new face, and you created a WorkPlane that was offset from that face, that WorkPlane would be dependent on that feature. If you try to maintain those after deleting the feature, you may have to fix them somehow. You get asked the same questions in a pop-up dialog when manually deleting an Extrude feature, and this is a way to control that by code.
Below is the code:
If ThisDoc.Document.DocumentType <> DocumentTypeEnum.kAssemblyDocumentObject Then
MsgBox("An Assembly Document must be active for this rule to work. Exiting.", vbCritical, "")
Exit Sub
End If
Dim oADoc As AssemblyDocument = ThisDoc.Document
Dim oADef As AssemblyComponentDefinition = oADoc.ComponentDefinition
Dim oSketch2 As PlanarSketch = oADef.Sketches.Item("Sketch 2")
Dim oExtFeats As ExtrudeFeatures = oADef.Features.ExtrudeFeatures
If oExtFeats.Count = 0 Then Exit Sub
Dim oExtFeat As ExtrudeFeature = Nothing
For Each oEF As ExtrudeFeature In oExtFeats
If oEF.Definition.Profile.Parent Is oSketch2 Then
oEF.Delete(True, True, True) 'try to preserve everything else associated with it
End If
Next
If this solved your problem, or answered your question, please click ACCEPT SOLUTION .
Or, if this helped you, please click (LIKE or KUDOS) 👍.
Wesley Crihfield

(Not an Autodesk Employee)