Message 1 of 11
Intersection between Plane (View) and PlanarFace (extracted from floor)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi everyone 🙂
I have a problem with the intersection of a View plane and a Face. I am in a section and I wish to receive the intersectioncurve between my viewplane and my ceilings.
Here I receive the plane of my Section View
View activeView = doc.ActiveView;
var origin = activeView.Origin;
var direction = activeView.ViewDirection;
Plane plane = Plane.CreateByNormalAndOrigin(direction, origin);
Here is my code to receive the upper faces of my ceilings.
var floors = new FilteredElementCollector(doc, activeView.Id).WherePasses(new ElementCategoryFilter(BuiltInCategory.OST_Floors)).WhereElementIsNotElementType().Cast<Element>().ToList();
foreach(Element f in floors)
{
var opt = new Options();
var e = f.get_Geometry(opt);
List<PlanarFace> faces = new List<PlanarFace>();
foreach (GeometryObject obj in e)
{
Solid solid = obj as Solid;
if (null != solid)
{
foreach (Face face in solid.Faces)
{
PlanarFace pf = face as PlanarFace;
XYZ normal = pf.FaceNormal;
if (normal.X == 0 && normal.Y == 0 && normal.Z == 1)
{
faces.Add(pf);
// TODO: Intersection between pf and plane
}
}
}
}
}
PlanarFace has no Method to intersect with a Plane and the other way round. Can anyone please help me with this one? I´m a little stuck right now 😞