添加项目文件。
This commit is contained in:
55
MSDevTool/Views/SelectByElementId.xaml.cs
Normal file
55
MSDevTool/Views/SelectByElementId.xaml.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
|
||||
using Bentley.DgnPlatformNET;
|
||||
using Bentley.MstnPlatformNET;
|
||||
|
||||
namespace MSDevTool.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// SelectByElementId.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class SelectByElementId : Window
|
||||
{
|
||||
public SelectByElementId()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void Button_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var dgnModel = Session.Instance.GetActiveDgnModel();
|
||||
var splitStrs = TbElementId.Text.Split(',', ' ', ',', ';', ';');
|
||||
if (splitStrs.Length == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
//ElementAgenda agenda = new ElementAgenda();//声明元素容器
|
||||
//agenda.Empty(true);
|
||||
SelectionSetManager.EmptyAll();
|
||||
foreach (var item in splitStrs)
|
||||
{
|
||||
if (string.IsNullOrEmpty(item))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
try
|
||||
{
|
||||
var elementId = long.Parse(item);
|
||||
var element = dgnModel.FindElementById(new ElementId(ref elementId));
|
||||
//if (element != null)
|
||||
//{
|
||||
// agenda.Insert(element, true);//将元素插入容器
|
||||
//}
|
||||
SelectionSetManager.AddElement(element, dgnModel);//将元素容器添加到选择集
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//SelectionSetManager.BuildAgenda(ref agenda);//从当前选择集中获得元素
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user