// Expands every node in the Feature Manager tree, given a Solidworks ModelDoc2
        private void ExpandAllSolidworksFeaturesInTree(ModelDoc2 model)
        {
            Console.WriteLine("Expanding all features in Solidworks part...");
            if (model == null)
            {
                ShowNonFatalError("Failed to open model. (ActiveDoc is null)");
                return;
            }

            FeatureManager  featureMgr = default(FeatureManager);
            TreeControlItem rootNode   = default(TreeControlItem);

            // Get the root node of the Feature Manager tree
            featureMgr = model.FeatureManager;
            rootNode   = featureMgr.GetFeatureTreeRootItem2((int)swFeatMgrPane_e.swFeatMgrPaneBottom);
            if ((rootNode == null))
            {
                ShowNonFatalError("Failed to get root node of Feature Tree from part. (rootNode is null)");
                return;
            }

            //TreeControlItem childNode = default(TreeControlItem);
            int    nodeObjectType = rootNode.ObjectType;
            object nodeObject     = rootNode.Object;

            // Ignore Annotations and History features
            if (rootNode.Text != "Annotations" && rootNode.Text != "History")
            {
                // Expand the node
                rootNode.Expanded = true;
                traverseLevel     = traverseLevel + 1;
                //childNode = rootNode.GetFirstChild();
            }

            traverseLevel = traverseLevel - 1;
            Console.WriteLine("Expanded all features in part successfully.");
        }