public Plane PlaneToSpeckle(DB.Plane plane)
        {
            var origin = PointToSpeckle(plane.Origin);
            var normal = new Vector(ScaleToSpeckle(plane.Normal.X), ScaleToSpeckle(plane.Normal.Y), ScaleToSpeckle(plane.Normal.Z), ModelUnits);
            var xdir   = new Vector(ScaleToSpeckle(plane.XVec.X), ScaleToSpeckle(plane.XVec.Y), ScaleToSpeckle(plane.XVec.Z), ModelUnits);
            var ydir   = new Vector(ScaleToSpeckle(plane.YVec.X), ScaleToSpeckle(plane.YVec.Y), ScaleToSpeckle(plane.YVec.Z), ModelUnits);

            return(new Plane(origin, normal, xdir, ydir, ModelUnits));
        }
示例#2
0
        public Plane PlaneToSpeckle(DB.Plane plane, string units = null)
        {
            var u      = units ?? ModelUnits;
            var origin = PointToSpeckle(plane.Origin, u);
            var normal = VectorToSpeckle(plane.Normal, u);
            var xdir   = VectorToSpeckle(plane.XVec, u);
            var ydir   = VectorToSpeckle(plane.YVec, u);

            return(new Plane(origin, normal, xdir, ydir, u));
        }
        public Ellipse EllipseToSpeckle(DB.Ellipse ellipse)
        {
            using (DB.Plane basePlane = DB.Plane.CreateByOriginAndBasis(ellipse.Center, ellipse.XDirection, ellipse.YDirection))
            {
                var trim = ellipse.IsBound ? new Interval(ellipse.GetEndParameter(0), ellipse.GetEndParameter(1)) : null;

                return(new Ellipse(
                           PlaneToSpeckle(basePlane),
                           ScaleToSpeckle(ellipse.RadiusX),
                           ScaleToSpeckle(ellipse.RadiusY),
                           new Interval(0, 2 * Math.PI),
                           trim,
                           ModelUnits));
            }
        }
示例#4
0
        public DB.Ellipse EllipseToNative(Ellipse ellipse)
        {
            //TODO: support ellipse arcs
            using (DB.Plane basePlane = PlaneToNative(ellipse.plane))
            {
                var e = DB.Ellipse.CreateCurve(
                    PointToNative(ellipse.plane.origin),
                    ScaleToNative((double)ellipse.firstRadius, ellipse.units),
                    ScaleToNative((double)ellipse.secondRadius, ellipse.units),
                    basePlane.XVec.Normalize(),
                    basePlane.YVec.Normalize(),
                    ellipse.domain.start ?? 0,
                    ellipse.domain.end ?? 2 * Math.PI
                    ) as DB.Ellipse;

                e.MakeBound(ellipse.trimDomain?.start ?? 0, ellipse.trimDomain?.end ?? 2 * Math.PI);
                return(e);
            }
        }
示例#5
0
        public Ellipse EllipseToSpeckle(DB.Ellipse ellipse, string units = null)
        {
            var u = units ?? ModelUnits;

            using (DB.Plane basePlane = DB.Plane.CreateByOriginAndBasis(ellipse.Center, ellipse.XDirection, ellipse.YDirection))
            {
                var trim = ellipse.IsBound ? new Interval(ellipse.GetEndParameter(0), ellipse.GetEndParameter(1)) : null;

                var ellipseToSpeckle = new Ellipse(
                    PlaneToSpeckle(basePlane, u),
                    u == Units.None ? ellipse.RadiusX : ScaleToSpeckle(ellipse.RadiusX),
                    u == Units.None ? ellipse.RadiusY : ScaleToSpeckle(ellipse.RadiusY),
                    new Interval(0, 2 * Math.PI),
                    trim,
                    u);
                ellipseToSpeckle.length = ellipse.Length;
                return(ellipseToSpeckle);
            }
        }