From 78164ae0c484cb4478e2a4a82a57268b36514b39 Mon Sep 17 00:00:00 2001 From: Jeremy Tammik Date: Fri, 15 May 2015 09:25:04 +0200 Subject: [PATCH] clone solid --- .../BuildingCoder/CmdExportSolidToSat.cs | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/BuildingCoder/BuildingCoder/CmdExportSolidToSat.cs b/BuildingCoder/BuildingCoder/CmdExportSolidToSat.cs index b6d40d62..4d28e08f 100644 --- a/BuildingCoder/BuildingCoder/CmdExportSolidToSat.cs +++ b/BuildingCoder/BuildingCoder/CmdExportSolidToSat.cs @@ -23,6 +23,25 @@ namespace BuildingCoder [Transaction( TransactionMode.Manual )] class CmdExportSolidToSat : IExternalCommand { + #region Clone Solid Workaround before new Revit 2016 Solid.Clone API + static public Solid Clone( /*this*/ Solid solid ) + { + if( solid == null ) + { + return null; + } + + // Better than unioning the solid with itself: + // use a small cube contained within the original + // solid instead, e.g. a 1x1x1 cube at the origin + // or something. + + return BooleanOperationsUtils + .ExecuteBooleanOperation( solid, solid, + BooleanOperationsType.Union ); + } + #endregion // Clone Solid Workaround + /// /// Return the full path of the first file /// found matching the given filename pattern @@ -65,7 +84,7 @@ public Result Execute( // Retrieve all floors from the model - var floors + var floors = new FilteredElementCollector( doc ) .OfClass( typeof( Floor ) ) .ToElements()