/// <summary>
/// 获得图层的类别名字
/// </summary>
/// <param name="layer"></param>
/// <returns></returns>
public static string[] GetLayerName(int layer)
{
Session theSession = Session.GetSession();
Part workPart = theSession.Parts.Work;
CategoryCollection categoryCollection = workPart.LayerCategories;
Category[] categories = categoryCollection.ToArray();
List<string> outNames = new List<string>();
for (int i = 0; i < categories.Length; i++)
{
if (categories[i].Name.ToUpper() == "ALL")
{
continue;
}
int[] allLayer = categories[i].GetMemberLayers();
for (int j = 0; j < allLayer.Length; j++)
{
if (layer == allLayer[j])
{
outNames.Add(categories[i].Name);
}
}
}
if (outNames.Count == 0)
{
outNames.Add("");
}
return outNames.ToArray();
}
NXOPEN/UG二次开发C#---获得图层的类别名字
最新推荐文章于 2023-04-04 20:15:00 发布