Exemple #1
0
        /// <summary>
        /// DS Ellipse to SpeckleEllipse
        /// </summary>
        /// <param name="e"></param>
        /// <returns></returns>
        public Ellipse EllipseToSpeckle(DS.Ellipse e)
        {
            using (DS.Plane basePlane = DS.Plane.ByOriginNormalXAxis(e.CenterPoint, e.Normal, e.MajorAxis))
            {
                var ellipse = new Ellipse(
                    PlaneToSpeckle(basePlane),
                    e.MajorAxis.Length,
                    e.MinorAxis.Length,
                    new Interval(e.StartParameter(), e.EndParameter()),
                    null,
                    ModelUnits);

                CopyProperties(ellipse, e);
                return(ellipse);
            }
        }
        /// <summary>
        /// DS Ellipse to SpeckleEllipse
        /// </summary>
        /// <param name="e"></param>
        /// <returns></returns>
        public Ellipse EllipseToSpeckle(DS.Ellipse e, string units = null)
        {
            var u = units ?? ModelUnits;

            using (DS.Plane basePlane = DS.Plane.ByOriginNormalXAxis(e.CenterPoint, e.Normal, e.MajorAxis))
            {
                var ellipse = new Ellipse(
                    PlaneToSpeckle(basePlane, u),
                    e.MajorAxis.Length,
                    e.MinorAxis.Length,
                    new Interval(e.StartParameter(), e.EndParameter()),
                    null,
                    u);

                CopyProperties(ellipse, e);

                ellipse.length = e.Length;
                ellipse.bbox   = BoxToSpeckle(e.BoundingBox.ToCuboid(), u);

                return(ellipse);
            }
        }