添加项目文件。
This commit is contained in:
34
Mstn.Toolkit/Helpers/NamedGroupHelper.cs
Normal file
34
Mstn.Toolkit/Helpers/NamedGroupHelper.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user