diff --git a/BcSamples.txt b/BcSamples.txt
index a78c750c..3314c2e0 100644
--- a/BcSamples.txt
+++ b/BcSamples.txt
@@ -1053,8 +1053,8 @@ C:\a\lib\revit\2016\bc\BuildingCoder\BuildingCoder\bin\Debug\BuildingCoder.dll
BuildingCoder.CmdFlatten # version 2016.0.123.0
ADN Bc R-Z
-Wall Openings
-Report wall opening start and end points along location line
+Wall Opening Side Faces
+Determine wall opening side faces and report their start and end points along location line
LargeImage:
Image:
C:\a\lib\revit\2016\bc\BuildingCoder\BuildingCoder\bin\Debug\BuildingCoder.dll
@@ -1066,4 +1066,13 @@ Determine and report all project parameter GUIDs
LargeImage:
Image:
C:\a\lib\revit\2016\bc\BuildingCoder\BuildingCoder\bin\Debug\BuildingCoder.dll
-BuildingCoder.CmdProjectParameterGuids # version 2016.0.125.0
\ No newline at end of file
+BuildingCoder.CmdProjectParameterGuids # version 2016.0.125.0
+
+ADN Bc R-Z
+Wall Opening Profiles
+Determine and display all wall opening edges including elevation profile lines
+LargeImage:
+Image:
+C:\a\lib\revit\2016\bc\BuildingCoder\BuildingCoder\bin\Debug\BuildingCoder.dll
+BuildingCoder.CmdWallOpeningProfiles # version 2016.0.126.0
+
diff --git a/BuildingCoder/BuildingCoder/BuildingCoder.csproj b/BuildingCoder/BuildingCoder/BuildingCoder.csproj
index 53271ed4..a4663212 100644
--- a/BuildingCoder/BuildingCoder/BuildingCoder.csproj
+++ b/BuildingCoder/BuildingCoder/BuildingCoder.csproj
@@ -219,6 +219,7 @@
+
diff --git a/BuildingCoder/BuildingCoder/CmdWallOpeningProfiles.cs b/BuildingCoder/BuildingCoder/CmdWallOpeningProfiles.cs
new file mode 100644
index 00000000..215bd1ad
--- /dev/null
+++ b/BuildingCoder/BuildingCoder/CmdWallOpeningProfiles.cs
@@ -0,0 +1,181 @@
+#region Header
+//
+// CmdWallOpeningProfiles.cs - determine and display all wall opening edges including elevation profile lines
+//
+// Copyright (C) 2015 by Jeremy Tammik, Autodesk Inc. All rights reserved.
+//
+#endregion // Header
+
+#region Namespaces
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using Autodesk.Revit.Attributes;
+using Autodesk.Revit.DB;
+using Autodesk.Revit.UI;
+#endregion // Namespaces
+
+namespace BuildingCoder
+{
+ [Transaction( TransactionMode.Manual )]
+ class CmdWallOpeningProfiles
+ {
+ static List GetWallOpeningPlanarFaces(
+ Wall wall,
+ ElementId openingId )
+ {
+ List faceList = new List();
+
+ List solidList = new List();
+
+ Options geomOptions = wall.Document.Application.Create.NewGeometryOptions();
+
+ if( geomOptions != null )
+ {
+ geomOptions.ComputeReferences = true;
+ geomOptions.DetailLevel = ViewDetailLevel.Fine;
+ geomOptions.IncludeNonVisibleObjects = false;
+
+ GeometryElement geoElem = wall.get_Geometry( geomOptions );
+
+ if( geoElem != null )
+ {
+ foreach( GeometryObject geomObj in geoElem )
+ {
+ if( geomObj is Solid )
+ {
+ solidList.Add( geomObj as Solid );
+ }
+ }
+ }
+ }
+
+ foreach( Solid solid in solidList )
+ {
+ foreach( Face face in solid.Faces )
+ {
+ if( face is PlanarFace )
+ {
+ if( wall.GetGeneratingElementIds( face ).Any( x => x == openingId ) )
+ {
+ faceList.Add( face as PlanarFace );
+ }
+ }
+ }
+ }
+ return faceList;
+ }
+
+ public Result Execute(
+ ExternalCommandData commandData,
+ ref string message,
+ ElementSet elements )
+ {
+ UIApplication uiapp = commandData.Application;
+ UIDocument uidoc = uiapp.ActiveUIDocument;
+ Document doc = uidoc.Document;
+
+ Result commandResult = Result.Succeeded;
+
+ try
+ {
+ UIDocument uiDoc = commandData.Application.ActiveUIDocument;
+ Document dbDoc = uiDoc.Document;
+
+ List selectedIds = uiDoc.Selection.GetElementIds().ToList();
+
+ using( Transaction trans = new Transaction( dbDoc ) )
+ {
+ trans.Start( "Cmd: GetOpeningProfiles" );
+
+ List newIds = new List();
+
+ foreach( ElementId selectedId in selectedIds )
+ {
+ Wall wall = dbDoc.GetElement( selectedId ) as Wall;
+
+ if( wall != null )
+ {
+ List faceList = new List();
+
+ List insertIds = wall.FindInserts( true, false, false, false ).ToList();
+
+ foreach( ElementId insertId in insertIds )
+ {
+ Element elem = dbDoc.GetElement( insertId );
+
+ if( elem is FamilyInstance )
+ {
+ FamilyInstance inst = elem as FamilyInstance;
+
+ CategoryType catType = inst.Category.CategoryType;
+ Category cat = inst.Category;
+
+ if( catType == CategoryType.Model && ( cat.Id == dbDoc.Settings.Categories.get_Item( BuiltInCategory.OST_Doors ).Id || cat.Id == dbDoc.Settings.Categories.get_Item( BuiltInCategory.OST_Windows ).Id ) )
+ {
+ faceList.AddRange( GetWallOpeningPlanarFaces( wall, insertId ) );
+ }
+ }
+ else if( elem is Opening )
+ {
+ faceList.AddRange( GetWallOpeningPlanarFaces( wall, insertId ) );
+ }
+ }
+
+ foreach( PlanarFace face in faceList )
+ {
+ Plane facePlane = new Plane( face.ComputeNormal( UV.Zero ), face.Origin );
+ SketchPlane sketchPlane = SketchPlane.Create( dbDoc, facePlane );
+
+ foreach( CurveLoop curveLoop in face.GetEdgesAsCurveLoops() )
+ {
+ foreach( Curve curve in curveLoop )
+ {
+ ModelCurve modelCurve = dbDoc.Create.NewModelCurve( curve, sketchPlane );
+ newIds.Add( modelCurve.Id );
+ }
+ }
+ }
+ }
+ }
+
+ if( newIds.Count > 0 )
+ {
+ View activeView = uiDoc.ActiveGraphicalView;
+ activeView.IsolateElementsTemporary( newIds );
+ }
+ trans.Commit();
+ }
+ }
+
+ #region Exception Handling
+
+ catch( Autodesk.Revit.Exceptions.ExternalApplicationException e )
+ {
+ message = e.Message;
+ Debug.WriteLine( "Exception Encountered (Application)\n" + e.Message + "\nStack Trace: " + e.StackTrace );
+
+ commandResult = Result.Failed;
+ }
+ catch( Autodesk.Revit.Exceptions.OperationCanceledException e )
+ {
+ Debug.WriteLine( "Operation cancelled. " + e.Message );
+ message = "Operation cancelled.";
+
+ commandResult = Result.Succeeded;
+ }
+ catch( Exception e )
+ {
+ message = e.Message;
+ Debug.WriteLine( "Exception Encountered (General)\n" + e.Message + "\nStack Trace: " + e.StackTrace );
+
+ commandResult = Result.Failed;
+ }
+
+ #endregion
+
+ return commandResult;
+ }
+ }
+}
diff --git a/BuildingCoder/BuildingCoder/CmdWallOpenings.cs b/BuildingCoder/BuildingCoder/CmdWallOpenings.cs
index 54f216e2..06ec3dd7 100644
--- a/BuildingCoder/BuildingCoder/CmdWallOpenings.cs
+++ b/BuildingCoder/BuildingCoder/CmdWallOpenings.cs
@@ -1,6 +1,6 @@
#region Header
//
-// CmdWallOpenings.cs - report wall opening start and end points along location line
+// CmdWallOpenings.cs - determine wall opening side faces and report their start and end points along location line
//
// Copyright (C) 2015 by Jeremy Tammik, Autodesk Inc. All rights reserved.
//
diff --git a/BuildingCoder/BuildingCoder/Properties/AssemblyInfo.cs b/BuildingCoder/BuildingCoder/Properties/AssemblyInfo.cs
index 739b465c..3ff6594f 100644
--- a/BuildingCoder/BuildingCoder/Properties/AssemblyInfo.cs
+++ b/BuildingCoder/BuildingCoder/Properties/AssemblyInfo.cs
@@ -122,6 +122,7 @@
// 2015-12-17 2016.0.125.0 integrated CmdProjectParameterGuids by CoderBoy
// 2015-12-17 2016.0.125.1 cleaned up CmdWallOpenings
// 2015-12-18 2016.0.125.2 cleaned up CmdProjectParameterGuids
+// 2015-12-18 2016.0.126.0 integrated CmdWallOpeningProfiles by Scott Wilson
//
-[assembly: AssemblyVersion( "2016.0.125.2" )]
-[assembly: AssemblyFileVersion( "2016.0.125.2" )]
+[assembly: AssemblyVersion( "2016.0.126.0" )]
+[assembly: AssemblyFileVersion( "2016.0.126.0" )]