- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
This has been mentioned in this post from 2016 but maybe it's worth bringing up again as 2018 hasn't resolved the issue yet.
As far as I can tell, the Face.Intersect(face) method always returns FaceIntersectionFaceResult.Intersecting - or I am not implementing it correctly. When I run the code below in a view with a single wall and single floor, each face to face test returns an intersection. Can someone please verify (maybe 2019)?
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
{
var list = new FilteredElementCollector(commandData.Application.ActiveUIDocument.Document, commandData.View.Id).WhereElementIsNotElementType().Where(e => e is Wall || e is Floor);
foreach (var f1 in list.First().get_Geometry(new Options()).OfType<Solid>().First().Faces.OfType<Face>())
{
foreach (var f2 in list.Last().get_Geometry(new Options()).OfType<Solid>().First().Faces.OfType<Face>())
{
if (f1.Intersect(f2) == FaceIntersectionFaceResult.Intersecting)
{
if (System.Windows.Forms.MessageBox.Show("Intersects", "Continue", System.Windows.Forms.MessageBoxButtons.OKCancel, System.Windows.Forms.MessageBoxIcon.Exclamation) == System.Windows.Forms.DialogResult.Cancel) return Result.Succeeded;
}
}
}
return Result.Succeeded;
}
Solved! Go to Solution.