开发者

In Revit how to do interference detecting programmatically?

开发者 https://www.devze.com 2023-01-08 06:51 出处:网络
More precisely, how can I determine if a Solid is intersect开发者_运维技巧ing another element?

More precisely, how can I determine if a Solid is intersect开发者_运维技巧ing another element? I looked over the Revit API and could not find any information on this.


have a look into the ray projection API, you can shoot a ray in a certain direction and it will return all the elements it hits and their locations etc.

FindReferencesByDirection method I believe is the method that does that.


In Revit 2012, use the ElementIntersectsSolidFilter while filtering elements. You supply the input Solid which could come from another element or from geometry you generate programmatically.


if you looking for intersected elements,I'll use BoundingBoxIntersectsFilter ,it's quick filter with minor performance impact

first,get the geometry boundingbox

GeometryElement geoElem = wall.get_Geometry(_geoOpt) as GeometryElement;
BoundingBoxXYZ boundXYZ = geoElem.GetBoundingBox();

then,create the outline and passed to BoundingBoxIntersectsFilter

if (boundXYZ != null)
{
  outline = new Outline(boundXYZ.Min, boundXYZ.Max);
  boundingFilter = new BoundingBoxIntersectsFilter(outline);

  var filterElems = new FilteredElementCollector(elem.Document).WherePasses(boundingFilter).ToElementIds();
  foreach (var item in filterElems)
  {
     //retrieve intersected elements
  }
}
0

精彩评论

暂无评论...
验证码 换一张
取 消