The method of Revit contact Filtration
This article mainly introduces the relevant knowledge of "Revit contact filtering method". The editor shows you the operation process through the actual case. The operation method is simple, fast and practical. I hope this "Revit contact filtering method" article can help you solve the problem.
Select the columns that are in contact with the extruded body:
List beam = new List ()
/ / create a solid to obtain a column with intersections according to the cross section of the column
Foreach (Element bttt in fil)
{
FamilyInstance bb = bttt as FamilyInstance
Double lenght = bb.Symbol.GetParameters ("section width") [0] .AsDouble (); / / get the section width of the column
Beam.Add (bttt.Id)
LocationPoint ppp = bttt.Location as LocationPoint
XYZ pt = ppp.Point
Level le = doc.GetElement (bb.LevelId) the level of the floor on which the as Level;// column is located
/ / subtract the section width from the center of the column to form four points
XYZ pt1 = new XYZ (pt.X-lenght, pt.Y-lenght, le.Elevation)
XYZ pt2 = new XYZ (pt.X + lenght, pt.Y-lenght, le.Elevation)
XYZ pt3 = new XYZ (pt.X + lenght, pt.Y + lenght, le.Elevation)
XYZ pt4 = new XYZ (pt.X-lenght, pt.Y + lenght, le.Elevation)
/ / join four points into a curve
CurveLoop profile = new CurveLoop ()
Profile.Append (Line.CreateBound (pt1, pt2))
Profile.Append (Line.CreateBound (pt2, pt3))
Profile.Append (Line.CreateBound (pt3, pt4))
Profile.Append (Line.CreateBound (pt4, pt1))
/ / put the curve into the collection
List loops = new List ()
Loops.Add (profile)
/ / stretch Direction
XYZ vector = new XYZ (0,0,1)
/ / create an entity
Solid solid = GeometryCreationUtilities.CreateExtrusionGeometry (loops, vector, 10)
/ / get the entities in this view that collide with the created entity
FilteredElementCollector collector = new FilteredElementCollector (doc, doc.ActiveView.Id)
ElementIntersectsSolidFilter solidFilter = new ElementIntersectsSolidFilter (solid, false)
Collector.WherePasses (solidFilter)
}
This is the end of the content about "Revit contact filtering method". Thank you for reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.