private static ElementCurveReference TryGetCurveReference(Revit.Elements.Element curveObject, string nodeTypeString = "This node") { var cs = curveObject.InternalGeometry().OfType<Autodesk.Revit.DB.Curve>(); if (cs.Any()) return new ElementCurveReference(cs.First()); throw new ArgumentException(nodeTypeString + " requires a ElementCurveReference extracted from a Revit Element! " + "You supplied an " + curveObject.ToString() + ", but we could not extract a CurveReference from it!"); }