diff --git a/src/DynamoRebar/Revit/RebarContainer.cs b/src/DynamoRebar/Revit/RebarContainer.cs index 7b959dc..3ea2bb3 100644 --- a/src/DynamoRebar/Revit/RebarContainer.cs +++ b/src/DynamoRebar/Revit/RebarContainer.cs @@ -1,4 +1,4 @@ -// +// // Copyright 2015 Autodesk, Inc. // Author: Thornton Tomasetti Ltd, CORE Studio (Maximilian Thumfart) // @@ -382,15 +382,24 @@ public static RebarContainer ByCurve( /// /// Create Rebar Container by Bars - /// - /// Bars to create the container from - /// - public static RebarContainer ByBars(System.Collections.Generic.List rebars) - { - return new RebarContainer(rebars); - } - - /// + /// + /// Bars to create the container from + /// + public static RebarContainer ByBars(System.Collections.Generic.IEnumerable rebars) + { + List mybars = new List(); + foreach (Revit.Elements.Element e in rebars) + { + if (e.InternalElement is Autodesk.Revit.DB.Structure.Rebar) + { + Revit.Elements.Rebar bar = Revit.Elements.Rebar.FromExisting(e.InternalElement as Autodesk.Revit.DB.Structure.Rebar, true); + mybars.Add(bar); + } + } + return new RebarContainer(mybars); + } + + /// /// Set unobscured in specified View /// /// Rebar Container