首页 > 技术文章 > AM二次开发中选择指定范围内的对象

sinceret 2018-10-29 14:58 原文

使用Spatial可以快速选择指定范围内的对象

例如下面的代码可以选择所有在[0,0,0]-[10m,10m,10m]这个盒子之内的对象;

其中ElementsInBox还可以指定对象类型做进一步筛选。

LimitsBox box = LimitsBox.Create(Position.Create(0, 0, 0), Position.Create(10000.0f, 10000.0f, 10000.0f));

DbElement[] eles = Spatial.Instance.ElementsInBox(box, false);

MessageBox.Show(eles.Length.ToString());//多少个?

foreach (DbElement ele in eles)

  mUi.MessageNoConfirm(ele.ToString());

MessageBox.Show("Finish");

 

 Spatial中还有其他功能,详细情况可以参考:Aveva.Pdms.Database.chm

 

推荐阅读