private static Autodesk.DesignScript.Geometry.Curve Convert(Autodesk.Revit.DB.NurbSpline crv)
        {
            var convert = NurbsCurve.ByControlPointsWeightsKnots(crv.CtrlPoints.Select(x => x.ToPoint()).ToArray(), 
                crv.Weights.Cast<double>().ToArray(), crv.Knots.Cast<double>().ToArray(), crv.Degree );

            if (!crv.IsBound) return convert;

            // bound the curve parametric range
            
            // we first get the full parametric domain from the knots
            // note that some knots be negative and the domain may appear reversed
            var parms = crv.Knots.Cast<double>().ToList();
            var fsp = parms.First();
            var fep = parms.Last();

            // obtain the full domain
            var fd = Math.Abs(fsp - fep);

            // these are the start and end parameters of the bound curve
            var sp = crv.get_EndParameter(0);
            var ep = crv.get_EndParameter(1);

            // get the normalized parameters for trim
            var nsp = Math.Abs(fsp - sp) / fd;
            var nep = Math.Abs(fsp - ep) / fd;

            return convert.ParameterTrim(nsp, nep);
        }
        private static Autodesk.DesignScript.Geometry.Curve Convert(Autodesk.Revit.DB.HermiteSpline crv)
        {

            var convert = HermiteToNurbs.ConvertExact(crv);

            if (!crv.IsBound) return convert;

            // bound the curve parametric range

            // we first get the full parametric domain from the parameters
            // note that some knots be negative and the domain may appear reversed
            var parms = crv.Parameters.Cast<double>().ToList();
            var fsp = parms.First();
            var fep = parms.Last();

            // obtain the full domain
            var fd = Math.Abs(fsp - fep);

            // these are the start and end parameters of the bound curve
            var sp = crv.get_EndParameter(0);
            var ep = crv.get_EndParameter(1);

            // get the normalized parameters for trim
            var nsp = Math.Abs(fsp - sp)/fd;
            var nep = Math.Abs(fsp - ep)/fd;

            return convert.ParameterTrim(nsp, nep);

        }