Example #1
0
        // Suppresses limit mates to make it easier to find the free degree of freedom in a joint
        public List<Mate2> suppressLimitMates(IComponent2 component)
        {
            ModelDoc2 modelDoc = component.GetModelDoc2();
            List<Mate2> limitMates = new List<Mate2>();

            object[] objs = component.GetMates();

            //limit mates aren't always present
            if (objs != null)
            {
                foreach (object obj in objs)
                {
                    if (obj is Mate2)
                    {
                        Mate2 swMate = (Mate2)obj;
                        if (swMate.MinimumVariation != swMate.MaximumVariation)
                        {
                            limitMates.Add(swMate);
                        }
                    }
                }
            }
            
            foreach (Mate2 swMate in limitMates)
            {
                ModelDoc2 doc = component.GetModelDoc2();
                Feature feat = (Feature)swMate;
                feat.Select(false);
                feat.SetSuppression2((int)swFeatureSuppressionAction_e.swSuppressFeature, (int)swInConfigurationOpts_e.swThisConfiguration, null);
            }

            return limitMates;
        }