From 9159aa7aaf766cf8cd04cf0d61177bd84dc8e5b1 Mon Sep 17 00:00:00 2001 From: chuongmep <31106432+chuongmep@users.noreply.github.com> Date: Wed, 26 Jun 2024 21:15:20 +0800 Subject: [PATCH] Update FaceIntersectCommand.cs --- Test/FaceIntersectCommand.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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)