V8i C# SS3 - Is it possible to extract the category of feature configured in GSA

All,

I have configured categories in GSA for all features and below is one of the example

Is it possible to retrieve the category name of a feature configured in GSA using C#? I have tried IStorageImportCriteria and IClassImportCriteria but could not find the category information. 

  • Hello,

    try it with the xft.

    using Bentley.Interop.Xft;
    
    FeatureMgr mngr = new FeatureMgr();
    var defee = mngr.GetFeatureDefs(true, true);
    while (defee.MoveNext())
    {
      string category = defee.Current.CategoryName;
    }

    HTH

    Martin
  • Thanks Martin. Worked like a charm.

    I was able to get the information from class definition using below code but I think the solution provided by you is much cleaner and better.

    IList<Bentley.ECObjects.Instance.IECInstance> currFeatureInstances = currentClassImp.ClassDefinition.GetCustomAttributeList();
    foreach (Bentley.ECObjects.Instance.IECInstance iecInstance in currFeatureInstances)

    {

    if(iecInstance.ClassDefinition.Name == "ECXfm")

    {

    string featureCategory = iecInstance.GetPropertyValue("XfmCategory").NativeValue.ToString();

    break;

    }

    }