public static Autodesk.Revit.DB.Curve ToRevitType(this Autodesk.DesignScript.Geometry.Curve crv, bool performHostUnitConversion = true) { crv = performHostUnitConversion ? crv.InHostUnits() : crv; dynamic dyCrv = crv; Autodesk.Revit.DB.Curve converted = ProtoToRevitCurve.Convert(dyCrv); if (converted == null) { throw new Exception("An unexpected failure occurred when attempting to convert the curve"); } return(converted); }