35 lines
1.1 KiB
C#
35 lines
1.1 KiB
C#
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Text;
|
|||
|
|
using System.Threading.Tasks;
|
|||
|
|
using System.Windows;
|
|||
|
|
|
|||
|
|
using Bentley.DgnPlatformNET;
|
|||
|
|
using Bentley.DgnPlatformNET.Elements;
|
|||
|
|
using Bentley.GeometryNET;
|
|||
|
|
using Bentley.MstnPlatformNET;
|
|||
|
|
|
|||
|
|
namespace Mstn.Toolkit.Helpers
|
|||
|
|
{
|
|||
|
|
public class NamedGroupHelper
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// 删除命名组
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="groupName"></param>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
public static NamedGroupStatus DeleteNamedGroup(string groupName)
|
|||
|
|
{
|
|||
|
|
var dgnModelRef = Session.Instance.GetActiveDgnModelRef();
|
|||
|
|
NamedGroupCollection groups = new(dgnModelRef);//获得模型中的NamedGroup集
|
|||
|
|
NamedGroup group = groups.FindByName(groupName);//根据名称获取对应的NamedGroup
|
|||
|
|
if (group != null)//判断是否成功获得指定NamedGroup
|
|||
|
|
{
|
|||
|
|
return group.DeleteFromFile();//将指定NamedGroup删除
|
|||
|
|
}
|
|||
|
|
return NamedGroupStatus.NotFound;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|