public Geometry.Surface SurfaceToSpeckle(AC.NurbSurface surface)
        {
            List <double> Uknots = new List <double>();
            List <double> Vknots = new List <double>();

            foreach (var knot in surface.UKnots)
            {
                Uknots.Add((double)knot);
            }
            foreach (var knot in surface.VKnots)
            {
                Vknots.Add((double)knot);
            }

            var _surface = new Geometry.Surface
            {
                degreeU  = surface.DegreeInU,
                degreeV  = surface.DegreeInV,
                rational = surface.IsRationalInU && surface.IsRationalInV,
                closedU  = surface.IsClosedInU(),
                closedV  = surface.IsClosedInV(),
                domainU  = IntervalToSpeckle(surface.GetEnvelope()[0]),
                domainV  = IntervalToSpeckle(surface.GetEnvelope()[1]),
                knotsU   = Uknots,
                knotsV   = Vknots
            };

            _surface.units = ModelUnits;
            _surface.SetControlPoints(ControlPointsToSpeckle(surface.ControlPoints, surface.Weights));
            return(_surface);
        }
Exemplo n.º 2
0
        public Surface SurfaceToSpeckle(AC.NurbSurface surface, string units = null)
        {
            var u = units ?? ModelUnits;

            List <double> Uknots = new List <double>();
            List <double> Vknots = new List <double>();

            foreach (var knot in surface.UKnots)
            {
                Uknots.Add((double)knot);
            }
            foreach (var knot in surface.VKnots)
            {
                Vknots.Add((double)knot);
            }

            var _surface = new Surface()
            {
                degreeU  = surface.DegreeInU,
                degreeV  = surface.DegreeInV,
                rational = surface.IsRationalInU && surface.IsRationalInV,
                closedU  = surface.IsClosedInU(),
                closedV  = surface.IsClosedInV(),
                knotsU   = Uknots,
                knotsV   = Vknots,
                countU   = surface.NumControlPointsInU,
                countV   = surface.NumControlPointsInV,
                domainU  = IntervalToSpeckle(surface.GetEnvelope()[0]),
                domainV  = IntervalToSpeckle(surface.GetEnvelope()[1])
            };

            _surface.SetControlPoints(ControlPointsToSpeckle(surface));
            _surface.units = u;

            return(_surface);
        }