diff --git a/Test/FaceIntersectCommand.cs b/Test/FaceIntersectCommand.cs index 30e2d35..82f7bde 100644 --- a/Test/FaceIntersectCommand.cs +++ b/Test/FaceIntersectCommand.cs @@ -40,6 +40,20 @@ public Result Execute(ExternalCommandData commandData, ref string message, Eleme { Trace.WriteLine(xyz.ToString()); } + // create direct shape + using Autodesk.Revit.DB.Transaction trans = new Transaction(doc, "Create Direct Shape"); + trans.Start(); + DirectShape ds = DirectShape.CreateElement(doc, new ElementId(BuiltInCategory.OST_GenericModel)); + ds.ApplicationId = "ApplicationId"; + ds.ApplicationDataId = "ApplicationDataId"; + var curveloop = new CurveLoop(); + for (int i = 0; i < intersection.Count; i++) + { + curveloop.Append(Line.CreateBound(intersection[i], intersection[(i + 1) % intersection.Count])); + } + Solid solid = GeometryCreationUtilities.CreateExtrusionGeometry(new List { curveloop }, XYZ.BasisZ, 1); + ds.SetShape(new GeometryObject[] { solid }); + trans.Commit(); return Result.Succeeded; } public PlanarFace? GetTopFace(Extrusion? extrusion)