Face.Intersect(face) method问题

 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;
        }

猜你喜欢

转载自blog.csdn.net/weixin_42479664/article/details/81415952
今日推荐