public Base CurveToSpeckle(DS.Curve curve, string units = null)
        {
            var  u = units ?? ModelUnits;
            Base speckleCurve;

            if (curve.IsLinear())
            {
                using (DS.Line line = curve.GetAsLine())
                {
                    speckleCurve = LineToSpeckle(line, u);
                }
            }
            else if (curve.IsArc())
            {
                using (DS.Arc arc = curve.GetAsArc())
                {
                    speckleCurve = ArcToSpeckle(arc, u);
                }
            }
            else if (curve.IsCircle())
            {
                using (DS.Circle circle = curve.GetAsCircle())
                {
                    speckleCurve = CircleToSpeckle(circle, u);
                }
            }
            else if (curve.IsEllipse())
            {
                using (DS.Ellipse ellipse = curve.GetAsEllipse())
                {
                    speckleCurve = EllipseToSpeckle(ellipse, u);
                }
            }
            else
            {
                speckleCurve = CurveToSpeckle(curve.ToNurbsCurve(), u);
            }

            CopyProperties(speckleCurve, curve);
            return(speckleCurve);
        }
예제 #2
0
        public Base CurveToSpeckle(DS.Curve curve)
        {
            Base speckleCurve;

            if (curve.IsLinear())
            {
                using (DS.Line line = curve.GetAsLine())
                {
                    speckleCurve = LineToSpeckle(line);
                }
            }
            else if (curve.IsArc())
            {
                using (DS.Arc arc = curve.GetAsArc())
                {
                    speckleCurve = ArcToSpeckle(arc);
                }
            }
            else if (curve.IsCircle())
            {
                using (DS.Circle circle = curve.GetAsCircle())
                {
                    speckleCurve = CircleToSpeckle(circle);
                }
            }
            else if (curve.IsEllipse())
            {
                using (DS.Ellipse ellipse = curve.GetAsEllipse())
                {
                    speckleCurve = EllipseToSpeckle(ellipse);
                }
            }
            else
            {
                speckleCurve = CurveToSpeckle(curve.ToNurbsCurve());
            }

            CopyProperties(speckleCurve, curve);
            return(speckleCurve);
        }