Beispiel #1
0
        public static Autodesk.DesignScript.Geometry.Curve ToProtoType(this Autodesk.Revit.DB.Curve revitCurve,
                                                                       bool performHostUnitConversion = true, Reference referenceOverride = null)
        {
            if (revitCurve == null)
            {
                throw new ArgumentNullException("revitCurve");
            }
            dynamic dyCrv = revitCurve;

            Autodesk.DesignScript.Geometry.Curve converted = RevitToProtoCurve.Convert(dyCrv);
            if (converted == null)
            {
                throw new Exception("An unexpected failure occurred when attempting to convert the curve");
            }
            if (performHostUnitConversion)
            {
                UnitConverter.ConvertToDynamoUnits(ref converted);
            }

            // If possible, add a geometry reference for downstream Element creation
            var revitRef = referenceOverride ?? revitCurve.Reference;

            if (revitRef != null)
            {
                converted.Tags.AddTag(ElementCurveReference.DefaultTag, revitRef);
            }

            return(converted);
        }
Beispiel #2
0
        /// <summary>
        /// An extension method to convert a Revit Curve to a ProtoGeometry Curve.  Note that Bound Revit curves will be returned in trimmed form.
        /// </summary>
        /// <param name="revitCurve"></param>
        /// <returns></returns>
        public static Autodesk.DesignScript.Geometry.Curve ToProtoType(this Autodesk.Revit.DB.Curve revitCurve)
        {
            if (revitCurve == null)
            {
                throw new ArgumentNullException("revitCurve");
            }

            dynamic dyCrv = revitCurve;

            return(RevitToProtoCurve.Convert(dyCrv));
        }
Beispiel #3
0
        /// <summary>
        /// An extension method to convert a Revit Curve to a ProtoGeometry Curve.  Note that Bound Revit curves will be returned in trimmed form.
        /// </summary>
        /// <param name="revitCurve"></param>
        /// <returns></returns>
        public static Autodesk.DesignScript.Geometry.Curve ToProtoType(this Autodesk.Revit.DB.Curve revitCurve)
        {
            if (revitCurve == null)
            {
                throw new ArgumentNullException("revitCurve");
            }

            dynamic dyCrv = revitCurve;

            Autodesk.DesignScript.Geometry.Curve converted = RevitToProtoCurve.Convert(dyCrv);

            // If possible, add a geometry reference for downstream Element creation
            var revitRef = revitCurve.Reference;

            if (revitRef != null)
            {
                converted.Tags.AddTag(ElementCurveReference.DefaultTag, revitRef);
            }

            return(converted);
        }