5 Replies Latest reply on Mar 22, 2018 4:26 AM by Henrik Landström

    C#, ReferencePattern and check if IsSuppresed?

    Henrik Landström

      Hi

       

      I have standAlone code trying to traverse a assembly and find some key values. Sometimes, there might be a folder named "Bracket Support pattern". In that folder, there should be a CircularPattern and what I am trying to do is to get the following:

      Angle of the pattern, number of features, and if any of them are suppressed.

       

           var circulatPattern = (Feature)featuresInFolder[i];

           Console.WriteLine(" Name of feature: " + circulatPattern.Name);

           Console.WriteLine(" Type of feature: " + circulatPattern.GetTypeName2());

       

           Dimension d3 = circulatPattern.Parameter("D3");

       

           Console.WriteLine($"Angle of feature: {d3.Value.ToString()}");

       

           var subf = (Feature)circulatPattern.GetFirstSubFeature();

       

           while (subf != null) {

           Console.WriteLine($"Current Subfeature: {subf.Name} of type {subf.GetTypeName2()}");

       

           var maybeSuppressedInConfig = subf.IsSuppressed2((int)swInConfigurationOpts_e.swAllConfiguration, configurationNames);

           for (int j = 0; j < configurationNames.Length; j++) {

                if(maybeSuppressedInConfig[j]) {

                     Console.WriteLine($"Suppresed in {configurationNames[j]}");

                } else {

                Console.WriteLine($"Not suppresed in {configurationNames[j]}");

                }

           }

       

       

           subf = subf.GetNextFeature();

           if(subf.GetTypeName2() != "ReferencePattern") { break; }

           }

      }


      The issue is that I get false as response to all checks of in a feature is suppressed. Maybe I need to traverse from the feature in the pattern, as that feature type is ReferencePattern and find the component /feature that has the actual IsSuppressed-flag. Or should it be done some other way?