AnsweredAssumed Answered

Seemingly can't select and delete features in an assembly

Question asked by Mahyar Jalalzadeh Gourabi on Apr 6, 2020
Latest reply on Apr 6, 2020 by Mahyar Jalalzadeh Gourabi



I am working on some code for an assembly document where I need to delete small features such as chamfers etc.. My code functions as intended as it lists every feature inside an assembly. But although the select2 method returns true nothing seems to get selected and therefore can't be deleted at the end. Thank you for your help.


here is my code:


public static void DelMinorFeats(ModelDoc2 modeldoc2)
            AssemblyDoc swAssy = (AssemblyDoc)modeldoc2;
            FeatureManager compFeatMan;
            ModelDoc2 compModel;
            Component2 comp;
            Feature feat;
            Object[] comps;
            Object[] feats;


            comps = swAssy.GetComponents(false);


            foreach (Object oComp in comps)
                comp = (Component2)oComp;
                compModel = comp.GetModelDoc2();
                compFeatMan = compModel.FeatureManager;
                feats = compFeatMan.GetFeatures(true);


                foreach (Object oFeat in feats)
                    feat = (Feature)oFeat;


                    if (feat.GetTypeName2() == "Chamfer" || feat.GetTypeName2() == "Fillet")
                        Debug.Print("   " + feat.Name);
                        feat.Select2(true, 0);